aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-07-31 21:39:47 +0800
committerChristian Persch <chpe@src.gnome.org>2004-07-31 21:39:47 +0800
commitdd79f8051f61ffe8c463b24a4f9e1ff815afd107 (patch)
tree99437dd2a950d357fc7f121f0c236be8f5b07e3c /embed
parentc9294601d6951d8745cbcbf8c24112d3a1e78d35 (diff)
downloadgsoc2013-epiphany-dd79f8051f61ffe8c463b24a4f9e1ff815afd107.tar
gsoc2013-epiphany-dd79f8051f61ffe8c463b24a4f9e1ff815afd107.tar.gz
gsoc2013-epiphany-dd79f8051f61ffe8c463b24a4f9e1ff815afd107.tar.bz2
gsoc2013-epiphany-dd79f8051f61ffe8c463b24a4f9e1ff815afd107.tar.lz
gsoc2013-epiphany-dd79f8051f61ffe8c463b24a4f9e1ff815afd107.tar.xz
gsoc2013-epiphany-dd79f8051f61ffe8c463b24a4f9e1ff815afd107.tar.zst
gsoc2013-epiphany-dd79f8051f61ffe8c463b24a4f9e1ff815afd107.zip
Confirm before overwriting a file. Fixes bug #143501.
2004-07-31 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/ContentHandler.cpp: Confirm before overwriting a file. Fixes bug #143501.
Diffstat (limited to 'embed')
-rw-r--r--embed/mozilla/ContentHandler.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp
index 5ec5e281c..448c6f8bd 100644
--- a/embed/mozilla/ContentHandler.cpp
+++ b/embed/mozilla/ContentHandler.cpp
@@ -49,6 +49,7 @@
#include "ephy-embed-shell.h"
#include "ephy-file-chooser.h"
#include "ephy-stock-icons.h"
+#include "ephy-gui.h"
#include "ephy-debug.h"
#include "eel-gconf-extensions.h"
@@ -130,7 +131,7 @@ NS_IMETHODIMP GContentHandler::PromptForSaveToFile(
{
EphyFileChooser *dialog;
gint response;
- char *filename;
+ char *filename = NULL;
nsEmbedCString defaultFile;
NS_UTF16ToCString (nsEmbedString (aDefaultFile),
@@ -149,13 +150,20 @@ NS_IMETHODIMP GContentHandler::PromptForSaveToFile(
CONF_STATE_SAVE_DIR,
EPHY_FILE_FILTER_ALL);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), defaultFile.get());
- response = gtk_dialog_run (GTK_DIALOG (dialog));
- if (response == GTK_RESPONSE_ACCEPT)
+ do
{
+ g_free (filename);
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+ } while (response == GTK_RESPONSE_ACCEPT
+ && !ephy_gui_confirm_overwrite_file (GTK_WIDGET (dialog), filename));
+ if (response == GTK_RESPONSE_ACCEPT)
+ {
nsCOMPtr <nsILocalFile> destFile (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
+ NS_ENSURE_TRUE (destFile, NS_ERROR_FAILURE);
+
destFile->InitWithNativePath (nsEmbedCString (filename));
g_free (filename);