diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-12-09 10:09:56 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-12-09 10:09:56 +0800 |
commit | c65fda0e894b86fed0a88ecde17f4040e78af946 (patch) | |
tree | fa7a1d6f5714172e468f6775c2997293abf23ec3 /mail/mail-callbacks.c | |
parent | c224a149c56ec14cb270c61ec8927d84bc3a5a99 (diff) | |
download | gsoc2013-evolution-c65fda0e894b86fed0a88ecde17f4040e78af946.tar gsoc2013-evolution-c65fda0e894b86fed0a88ecde17f4040e78af946.tar.gz gsoc2013-evolution-c65fda0e894b86fed0a88ecde17f4040e78af946.tar.bz2 gsoc2013-evolution-c65fda0e894b86fed0a88ecde17f4040e78af946.tar.lz gsoc2013-evolution-c65fda0e894b86fed0a88ecde17f4040e78af946.tar.xz gsoc2013-evolution-c65fda0e894b86fed0a88ecde17f4040e78af946.tar.zst gsoc2013-evolution-c65fda0e894b86fed0a88ecde17f4040e78af946.zip |
Check to see if the file already exists, if it does prompt the user to for
2000-12-08 Jeffrey Stedfast <fejj@helixcode.com>
* mail-callbacks.c (save_msg_ok): Check to see if the file already
exists, if it does prompt the user to for permission to overwrite
the file.
(forward_message): g_strdup the cursor_uid if there is only a
single message to be forwarded or we'll segfault later.
* mail-ops.c (do_save_messages): Rewrote yet again. I'm back to
almost an identical implementation as the first time I wrote this
except now we write the From line which I had forgotten last
time. This means that we no longer have to unlink the .ev-summary
file created and we also use fewer resources (no need to create a
CamelMboxFolder object).
svn path=/trunk/; revision=6882
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r-- | mail/mail-callbacks.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index ac35067caf..9432ce3ce7 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -500,7 +500,7 @@ forward_message (FolderBrowser *fb, gboolean attach) if (attach) message_list_foreach (fb->message_list, enumerate_msg, uids); else - g_ptr_array_add (uids, fb->message_list->cursor_uid); + g_ptr_array_add (uids, g_strdup (fb->message_list->cursor_uid)); gtk_signal_connect (GTK_OBJECT (composer), "send", GTK_SIGNAL_FUNC (composer_send_cb), NULL); @@ -679,14 +679,36 @@ save_msg_ok (GtkWidget *widget, gpointer user_data) CamelFolder *folder; GPtrArray *uids; char *path; + int fd, ret = 0; /* FIXME: is path an allocated string? */ path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (user_data)); - folder = gtk_object_get_data (GTK_OBJECT (user_data), "folder"); - uids = gtk_object_get_data (GTK_OBJECT (user_data), "uids"); - gtk_object_remove_no_notify (GTK_OBJECT (user_data), "uids"); - mail_do_save_messages (folder, uids, path); + fd = open (path, O_RDONLY); + if (fd != -1) { + GtkWidget *dlg; + GtkWidget *text; + + close (fd); + + dlg = gnome_dialog_new (_("Overwrite file?"), + GNOME_STOCK_BUTTON_YES, + GNOME_STOCK_BUTTON_NO, + NULL); + text = gtk_label_new (_("A file by that name already exists.\nOverwrite it?")); + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), text, TRUE, TRUE, 4); + gtk_window_set_policy (GTK_WINDOW (dlg), FALSE, TRUE, FALSE); + gtk_widget_show (text); + + ret = gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); + } + + if (ret == 0) { + folder = gtk_object_get_data (GTK_OBJECT (user_data), "folder"); + uids = gtk_object_get_data (GTK_OBJECT (user_data), "uids"); + gtk_object_remove_no_notify (GTK_OBJECT (user_data), "uids"); + mail_do_save_messages (folder, uids, path); + } gtk_widget_destroy (GTK_WIDGET (user_data)); } |