diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-04-10 05:38:37 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-04-10 05:38:37 +0800 |
commit | 3c6234e1c9e2e91a2ffcdb643ba389c3bc123d1a (patch) | |
tree | ad7cd10e9086f07a19d165de314e5d75d617455c /embed | |
parent | 90bcca74d19e1ad7d7254dabf57350f4fe7a93f7 (diff) | |
download | gsoc2013-epiphany-3c6234e1c9e2e91a2ffcdb643ba389c3bc123d1a.tar gsoc2013-epiphany-3c6234e1c9e2e91a2ffcdb643ba389c3bc123d1a.tar.gz gsoc2013-epiphany-3c6234e1c9e2e91a2ffcdb643ba389c3bc123d1a.tar.bz2 gsoc2013-epiphany-3c6234e1c9e2e91a2ffcdb643ba389c3bc123d1a.tar.lz gsoc2013-epiphany-3c6234e1c9e2e91a2ffcdb643ba389c3bc123d1a.tar.xz gsoc2013-epiphany-3c6234e1c9e2e91a2ffcdb643ba389c3bc123d1a.tar.zst gsoc2013-epiphany-3c6234e1c9e2e91a2ffcdb643ba389c3bc123d1a.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.
Diffstat (limited to 'embed')
-rw-r--r-- | embed/mozilla/EphyHeaderSniffer.cpp | 20 | ||||
-rw-r--r-- | embed/mozilla/FilePicker.cpp | 31 |
2 files changed, 25 insertions, 26 deletions
diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp index 1a14fe962..f2ac46543 100644 --- a/embed/mozilla/EphyHeaderSniffer.cpp +++ b/embed/mozilla/EphyHeaderSniffer.cpp @@ -204,18 +204,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 9187915e1..1c9612d93 100644 --- a/embed/mozilla/FilePicker.cpp +++ b/embed/mozilla/FilePicker.cpp @@ -378,30 +378,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; } |