aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-04-10 05:40:32 +0800
committerChristian Persch <chpe@src.gnome.org>2004-04-10 05:40:32 +0800
commit4a908200fdd1064924da73f61a64f61d628dae96 (patch)
tree4f0c3c141564bbc1e392631b128a654f3551950a
parent23b63c1cd2fafb38cdbb404577e2639570118d8b (diff)
downloadgsoc2013-epiphany-4a908200fdd1064924da73f61a64f61d628dae96.tar
gsoc2013-epiphany-4a908200fdd1064924da73f61a64f61d628dae96.tar.gz
gsoc2013-epiphany-4a908200fdd1064924da73f61a64f61d628dae96.tar.bz2
gsoc2013-epiphany-4a908200fdd1064924da73f61a64f61d628dae96.tar.lz
gsoc2013-epiphany-4a908200fdd1064924da73f61a64f61d628dae96.tar.xz
gsoc2013-epiphany-4a908200fdd1064924da73f61a64f61d628dae96.tar.zst
gsoc2013-epiphany-4a908200fdd1064924da73f61a64f61d628dae96.zip
Don't quit the filechooser when selecting "No" from the confirm- overwrite
2004-04-09 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/EphyHeaderSniffer.cpp: * embed/mozilla/FilePicker.cpp: Don't quit the filechooser when selecting "No" from the confirm- overwrite dialoge. Fixes bug #139400. * lib/ephy-gui.c: (ephy_gui_confirm_overwrite_file): Convert the filename to UTF-8 before showing it in the confirm dialogue.
-rw-r--r--ChangeLog13
-rw-r--r--embed/mozilla/EphyHeaderSniffer.cpp20
-rw-r--r--embed/mozilla/FilePicker.cpp31
-rw-r--r--lib/ephy-gui.c10
4 files changed, 46 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 7cf72ef22..61be8a2bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2004-04-09 Christian Persch <chpe@cvs.gnome.org>
+ * embed/mozilla/EphyHeaderSniffer.cpp:
+ * embed/mozilla/FilePicker.cpp:
+
+ Don't quit the filechooser when selecting "No" from the confirm-
+ overwrite dialoge. Fixes bug #139400.
+
+ * lib/ephy-gui.c: (ephy_gui_confirm_overwrite_file):
+
+ Convert the filename to UTF-8 before showing it in the confirm
+ dialogue.
+
+2004-04-09 Christian Persch <chpe@cvs.gnome.org>
+
* src/ephy-location-action.c: (compare_actions),
(init_actions_list):
diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp
index d7165af18..07a50e77f 100644
--- a/embed/mozilla/EphyHeaderSniffer.cpp
+++ b/embed/mozilla/EphyHeaderSniffer.cpp
@@ -206,18 +206,18 @@ filechooser_response_cb (EphyFileChooser *dialog, gint response, EphyHeaderSniff
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
- LOG ("Filename %s", filename)
+ if (ephy_gui_confirm_overwrite_file (parent, filename) == FALSE)
+ {
+ g_free (filename);
+ return;
+ }
- if (filename &&
- ephy_gui_confirm_overwrite_file (parent, filename) == TRUE)
+ nsCOMPtr<nsILocalFile> destFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
+ if (destFile)
{
- nsCOMPtr<nsILocalFile> destFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
- if (destFile)
- {
- destFile->InitWithNativePath (nsDependentCString (filename));
-
- sniffer->InitiateDownload (destFile);
- }
+ destFile->InitWithNativePath (nsDependentCString (filename));
+
+ sniffer->InitiateDownload (destFile);
}
g_free (filename);
diff --git a/embed/mozilla/FilePicker.cpp b/embed/mozilla/FilePicker.cpp
index eddb73d5f..42d4b3b33 100644
--- a/embed/mozilla/FilePicker.cpp
+++ b/embed/mozilla/FilePicker.cpp
@@ -379,30 +379,29 @@ NS_IMETHODIMP GFilePicker::Show(PRInt16 *_retval)
gtk_widget_show (GTK_WIDGET (mDialog));
- int response = gtk_dialog_run (GTK_DIALOG (mDialog));
+ int response;
+ char *filename = NULL;
- LOG ("GFilePicker::Show response=%d", response)
-
- switch (response)
+ do
{
- case GTK_RESPONSE_ACCEPT:
- *_retval = nsIFilePicker::returnOK;
- break;
- default:
- *_retval = nsIFilePicker::returnCancel;
- break;
+ response = gtk_dialog_run (GTK_DIALOG (mDialog));
+
+ g_free (filename);
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (mDialog));
+
+ LOG ("GFilePicker::Show response=%d, filename=%s", response, filename)
}
+ while (response == GTK_RESPONSE_ACCEPT &&
+ mMode == nsIFilePicker::modeSave &&
+ !ephy_gui_confirm_overwrite_file (GTK_WIDGET (mDialog), filename));
gtk_widget_hide (GTK_WIDGET (mDialog));
-
- char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (mDialog));
- if (filename == NULL)
+ if (response == GTK_RESPONSE_ACCEPT && filename != NULL)
{
- *_retval = nsIFilePicker::returnCancel;
+ *_retval = nsIFilePicker::returnOK;
}
- else if (mMode == nsIFilePicker::modeSave
- && ephy_gui_confirm_overwrite_file (GTK_WIDGET (mDialog), filename) == FALSE)
+ else
{
*_retval = nsIFilePicker::returnCancel;
}
diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c
index 6072a05ae..591a18d19 100644
--- a/lib/ephy-gui.c
+++ b/lib/ephy-gui.c
@@ -78,18 +78,23 @@ ephy_gui_menu_position_under_widget (GtkMenu *menu,
gboolean
ephy_gui_confirm_overwrite_file (GtkWidget *parent, const char *filename)
{
- char *question;
+ char *question, *converted;
GtkWidget *dialog;
gboolean res;
+ if (filename == NULL) return FALSE;
+
if (!g_file_test (filename, G_FILE_TEST_EXISTS))
{
return TRUE;
}
+ converted = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+ if (converted == NULL) return FALSE;
+
question = g_strdup_printf (_("File %s will be overwritten.\n"
"If you choose yes, the contents will be lost.\n\n"
- "Do you want to continue?"), filename);
+ "Do you want to continue?"), converted);
dialog = gtk_message_dialog_new (parent ? GTK_WINDOW(parent) : NULL,
GTK_DIALOG_MODAL,
GTK_MESSAGE_QUESTION,
@@ -98,6 +103,7 @@ ephy_gui_confirm_overwrite_file (GtkWidget *parent, const char *filename)
res = (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES);
gtk_widget_destroy (dialog);
g_free (question);
+ g_free (converted);
return res;
}