aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-08-09 23:46:00 +0800
committerChristian Persch <chpe@src.gnome.org>2004-08-09 23:46:00 +0800
commit7abbc6ae737a47d4649ea19de4ff81e2c0c5012e (patch)
treecbe1567733f381a9134e90596a78f5ac1744cdaa
parentb98cb6c18312939912d99b67667c6f075286efc2 (diff)
downloadgsoc2013-epiphany-7abbc6ae737a47d4649ea19de4ff81e2c0c5012e.tar.gz
gsoc2013-epiphany-7abbc6ae737a47d4649ea19de4ff81e2c0c5012e.tar.zst
gsoc2013-epiphany-7abbc6ae737a47d4649ea19de4ff81e2c0c5012e.zip
Confirm before overwriting a file. Fixes bug #143501. Also fixes crash
2004-08-09 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/ContentHandler.cpp: Confirm before overwriting a file. Fixes bug #143501. Also fixes crash from bug #149550.
-rw-r--r--ChangeLog7
-rw-r--r--embed/mozilla/ContentHandler.cpp13
2 files changed, 18 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 1f3c6eeeb..ee9db322f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-08-09 Christian Persch <chpe@cvs.gnome.org>
+
+ * embed/mozilla/ContentHandler.cpp:
+
+ Confirm before overwriting a file. Fixes bug #143501.
+ Also fixes crash from bug #149550.
+
2004-08-06 Christian Persch <chpe@cvs.gnome.org>
* src/ephy-shell.c: (ephy_shell_new_tab):
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp
index 33458e269..d0daa481e 100644
--- a/embed/mozilla/ContentHandler.cpp
+++ b/embed/mozilla/ContentHandler.cpp
@@ -41,6 +41,7 @@
#include "ephy-embed-single.h"
#include "ephy-embed-shell.h"
#include "ephy-file-chooser.h"
+#include "ephy-gui.h"
#include "ephy-debug.h"
#include <gtk/gtkimage.h>
@@ -134,7 +135,7 @@ NS_IMETHODIMP GContentHandler::PromptForSaveToFile(
{
EphyFileChooser *dialog;
gint response;
- char *filename;
+ char *filename = NULL;
if (mAction != CONTENT_ACTION_SAVEAS)
{
@@ -150,7 +151,14 @@ NS_IMETHODIMP GContentHandler::PromptForSaveToFile(
CONF_STATE_SAVE_DIR);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog),
NS_ConvertUCS2toUTF8 (aDefaultFile).get());
- response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ 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)
{
@@ -169,6 +177,7 @@ NS_IMETHODIMP GContentHandler::PromptForSaveToFile(
else
{
gtk_widget_destroy (GTK_WIDGET (dialog));
+ g_free (filename);
return NS_ERROR_FAILURE;
}