diff options
author | Philip Van Hoof <pvanhoof@gnome.org> | 2005-01-03 20:37:03 +0800 |
---|---|---|
committer | Philip Van Hoof <pvanhoof@src.gnome.org> | 2005-01-03 20:37:03 +0800 |
commit | e244bd48b230087bc62364b5c7e7ffcc635a8b30 (patch) | |
tree | bebd607460e4c322732e128a5430750e40c50e2d /plugins/save-attachments | |
parent | a9495bd904247b9d685258652556cd9f337a1e38 (diff) | |
download | gsoc2013-evolution-e244bd48b230087bc62364b5c7e7ffcc635a8b30.tar gsoc2013-evolution-e244bd48b230087bc62364b5c7e7ffcc635a8b30.tar.gz gsoc2013-evolution-e244bd48b230087bc62364b5c7e7ffcc635a8b30.tar.bz2 gsoc2013-evolution-e244bd48b230087bc62364b5c7e7ffcc635a8b30.tar.lz gsoc2013-evolution-e244bd48b230087bc62364b5c7e7ffcc635a8b30.tar.xz gsoc2013-evolution-e244bd48b230087bc62364b5c7e7ffcc635a8b30.tar.zst gsoc2013-evolution-e244bd48b230087bc62364b5c7e7ffcc635a8b30.zip |
Warning when overwriting file
2004-12-27 Philip Van Hoof <pvanhoof@gnome.org>
* save-attachments.c: Warning when overwriting file
svn path=/trunk/; revision=28212
Diffstat (limited to 'plugins/save-attachments')
-rw-r--r-- | plugins/save-attachments/ChangeLog | 4 | ||||
-rw-r--r-- | plugins/save-attachments/save-attachments.c | 27 |
2 files changed, 30 insertions, 1 deletions
diff --git a/plugins/save-attachments/ChangeLog b/plugins/save-attachments/ChangeLog index df63f244e5..0ecc0d99cf 100644 --- a/plugins/save-attachments/ChangeLog +++ b/plugins/save-attachments/ChangeLog @@ -1,3 +1,7 @@ +2004-12-27 Philip Van Hoof <pvanhoof@gnome.org> + + * save-attachments.c: Warning when overwriting file + 2004-11-01 JP Rosevear <jpr@novell.com> * Makefile.am: dist xml menu file diff --git a/plugins/save-attachments/save-attachments.c b/plugins/save-attachments/save-attachments.c index bcf77df1d8..1a903037da 100644 --- a/plugins/save-attachments/save-attachments.c +++ b/plugins/save-attachments/save-attachments.c @@ -33,6 +33,7 @@ #include <gtk/gtkcheckbutton.h> #include <gtk/gtkdialog.h> +#include <gtk/gtkmessagedialog.h> #include <gtk/gtktreestore.h> #include <gtk/gtkcellrenderertext.h> #include <gtk/gtkcellrenderertoggle.h> @@ -212,7 +213,31 @@ save_part(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, void *d) /* FIXME: if part == data->msg then we need to save this * differently, not using the envelope MimePart */ - em_utils_save_part_to_file(NULL, save, part); + /* + * The underlying em_utils_save_part_to_file ain't using gnome-vfs. Therefor + * the POSIX access-call should suffice for checking the file existence. + */ + + if (access (save, F_OK)) { + GtkWidget *warning = + gtk_message_dialog_new_with_markup (NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_NONE, + _("File exists \"%s\".\n" + "Do you wish to overwrite it?"), save); + + gtk_dialog_add_button (GTK_DIALOG (warning), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); + gtk_dialog_add_button (GTK_DIALOG (warning), _("_Overwrite"), GTK_RESPONSE_YES); + + doit = FALSE; + if (gtk_dialog_run (GTK_DIALOG (warning)) == GTK_RESPONSE_YES) + doit = TRUE; + gtk_widget_destroy (warning); + } + + if (doit) + em_utils_save_part_to_file(NULL, save, part); g_free(ext); g_free(filename); |