aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-07-06 03:44:39 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-07-06 03:44:39 +0800
commit65fc784c44dbe7689ef655aa3319351f52875880 (patch)
tree47d811e9e4badeb5471c695abb52e9f122a3cb76
parentbea4e40ec658149a1daf862ea3594b68721ad9a8 (diff)
downloadgsoc2013-evolution-65fc784c44dbe7689ef655aa3319351f52875880.tar.gz
gsoc2013-evolution-65fc784c44dbe7689ef655aa3319351f52875880.tar.zst
gsoc2013-evolution-65fc784c44dbe7689ef655aa3319351f52875880.zip
Play the "File exists, overwrite?" game. (autosave_run_foreach_cb): Change
2001-07-05 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer.c (save): Play the "File exists, overwrite?" game. (autosave_run_foreach_cb): Change the return val from a gboolean to void. svn path=/trunk/; revision=10824
-rw-r--r--composer/ChangeLog7
-rw-r--r--composer/e-msg-composer.c39
2 files changed, 38 insertions, 8 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 25a11d6f62..364a4cd093 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,10 @@
+2001-07-05 Jeffrey Stedfast <fejj@ximian.com>
+
+ * e-msg-composer.c (save): Play the "File exists, overwrite?"
+ game.
+ (autosave_run_foreach_cb): Change the return val from a gboolean
+ to void.
+
2001-07-04 Larry Ewing <lewing@ximian.com>
* e-msg-composer.c (autosave_load_draft): attach send and postpone
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 3fb82db821..df955c383e 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -858,26 +858,49 @@ save (EMsgComposer *composer,
{
CORBA_Environment ev;
char *my_file_name;
-
+ int fd;
+
if (file_name != NULL)
my_file_name = g_strdup (file_name);
else
my_file_name = e_msg_composer_select_file (composer, _("Save as..."));
-
+
if (my_file_name == NULL)
return;
-
+
+ /* check to see if we already have the file */
+ if ((fd = open (my_file_name, O_RDONLY | O_CREAT | O_EXCL)) == -1) {
+ GtkWidget *dialog, *label;
+
+ dialog = gnome_dialog_new (_("Warning!"), GNOME_STOCK_BUTTON_YES,
+ GNOME_STOCK_BUTTON_NO, NULL);
+ label = gtk_label_new (_("File exists, overwrite?"));
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 0);
+
+ switch (gnome_dialog_run_and_close (GNOME_DIALOG (dialog))) {
+ case -1:
+ gtk_widget_destroy (dialog);
+ return;
+ case 1:
+ return;
+ default:
+ /* ie, the user hit "Yes" so just continue as normal */
+ }
+ } else
+ close (fd);
+
CORBA_exception_init (&ev);
-
+
Bonobo_PersistFile_save (composer->persist_file_interface, my_file_name, &ev);
-
+
if (ev._major != CORBA_NO_EXCEPTION) {
e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
_("Error saving file: %s"), g_basename (file_name));
}
-
+
CORBA_exception_free (&ev);
-
+
g_free (my_file_name);
}
@@ -1134,7 +1157,7 @@ autosave_query_load_orphans (AutosaveManager *am, EMsgComposer *composer)
return matches;
}
-static gboolean
+static void
autosave_run_foreach_cb (gpointer key, gpointer value, gpointer data)
{
EMsgComposer *composer = E_MSG_COMPOSER (value);