diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-04-03 07:58:24 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-04-03 07:58:24 +0800 |
commit | c98a56ead46ff62ddfc938a0f422ce7bcf7a31c6 (patch) | |
tree | 2ff885e0d4b656bd5f4de4d4f27749857ab49618 /mail | |
parent | be23d106da1c548762218892fe058aee1fb9e36c (diff) | |
download | gsoc2013-evolution-c98a56ead46ff62ddfc938a0f422ce7bcf7a31c6.tar.gz gsoc2013-evolution-c98a56ead46ff62ddfc938a0f422ce7bcf7a31c6.tar.zst gsoc2013-evolution-c98a56ead46ff62ddfc938a0f422ce7bcf7a31c6.zip |
Pass the UID of the message being edited to the save-draft signal handler.
2002-04-02 Jeffrey Stedfast <fejj@ximian.com>
* mail-callbacks.c (do_edit_messages): Pass the UID of the message
being edited to the save-draft signal handler.
(composer_save_draft_cb): Pass the old draft uid to our async
append_message function and let the append_message callback worry
about deleting the old draft message on success.
(save_draft_done): Delete the old draft message if we successfully
appended the new draft message.
svn path=/trunk/; revision=16328
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 10 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 35 |
2 files changed, 36 insertions, 9 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 0134d34202..6bd057596f 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,13 @@ +2002-04-02 Jeffrey Stedfast <fejj@ximian.com> + + * mail-callbacks.c (do_edit_messages): Pass the UID of the message + being edited to the save-draft signal handler. + (composer_save_draft_cb): Pass the old draft uid to our async + append_message function and let the append_message callback worry + about deleting the old draft message on success. + (save_draft_done): Delete the old draft message if we successfully + appended the new draft message. + 2002-04-01 Jeffrey Stedfast <fejj@ximian.com> * folder-browser-ui.c: Removed an unused pixmap from diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 6bf6cd617a..988f8b58f8 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -183,7 +183,7 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recip gboolean show_again = TRUE; GString *str; GtkWidget *mbox; - gint i, button; + int i, button; if (!mail_config_get_confirm_unwanted_html ()) { g_message ("doesn't want to see confirm html messages!"); @@ -284,13 +284,13 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case) if (!mail_config_get_prompt_only_bcc ()) return TRUE; - + /* If the user is mailing a hidden contact list, it is possible for them to create a message with only Bcc recipients without really realizing it. To try to avoid being totally confusing, I've changed this dialog to provide slightly different text in that case, to better explain what the hell is going on. */ - + if (hidden_list_case) { first_text = _("Since the contact list you are sending to " "is configured to hide the list's addresses, " @@ -315,7 +315,7 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case) button = gnome_dialog_run_and_close (GNOME_DIALOG (mbox)); mail_config_set_prompt_only_bcc (show_again); - + g_free (message_text); if (button == 0) @@ -422,7 +422,7 @@ composer_get_message (EMsgComposer *composer) /* this means that the only recipients are Bcc's */ /* OK, this is an abusive hack. If someone sends a mail with a - hidden contact list on to to: line and no other recipients, + hidden contact list on the To: line and no other recipients, they will unknowingly create a message with only bcc: recipients. We try to detect this and pass a flag to ask_confirm_for_only_bcc, so that it can present the user with a dialog whose text has been @@ -551,6 +551,7 @@ composer_postpone_cb (EMsgComposer *composer, gpointer data) struct _save_draft_info { EMsgComposer *composer; + const char *old_uid; int quit; }; @@ -559,6 +560,12 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i { struct _save_draft_info *sdi = data; + /* delete the original draft message */ + if (ok && sdi->old_uid) + camel_folder_set_message_flags (folder, sdi->old_uid, + CAMEL_MESSAGE_DELETED, + CAMEL_MESSAGE_DELETED); + if (ok && sdi->quit) gtk_widget_destroy (GTK_WIDGET (sdi->composer)); else @@ -592,7 +599,7 @@ save_draft_folder (char *uri, CamelFolder *folder, gpointer data) } void -composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer data) +composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user_data) { extern char *default_drafts_folder_uri; extern CamelFolder *drafts_folder; @@ -633,8 +640,16 @@ composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer data) sdi = g_malloc (sizeof (struct _save_draft_info)); sdi->composer = composer; gtk_object_ref (GTK_OBJECT (composer)); + sdi->old_uid = (const char *) user_data; sdi->quit = quit; + /* FIXME: we need to have some way of getting the UID of the + newly appended message so that we can update the data that + this callback gets called with (user_data is the UID of the + message being edited) so that if the user saves a + second/third/fourth/etc time, we keep deleting the previous + copy of the draft */ + mail_append_mail (folder, msg, info, save_draft_done, sdi); camel_object_unref (CAMEL_OBJECT (folder)); camel_object_unref (CAMEL_OBJECT (msg)); @@ -2016,6 +2031,7 @@ do_edit_messages (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, voi for (i = 0; i < messages->len; i++) { EMsgComposer *composer; + char *uid; camel_medium_remove_header (CAMEL_MEDIUM (messages->pdata[i]), "X-Mailer"); @@ -2027,10 +2043,11 @@ do_edit_messages (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, voi gtk_signal_connect (GTK_OBJECT (composer), "postpone", composer_postpone_cb, NULL); - /* FIXME: we want to pass data to this callback so - we can remove the old draft when they save again */ + uid = g_strdup (uids->pdata[i]); + gtk_object_set_data_full (GTK_OBJECT (composer), "uid", uid, (GtkDestroyNotify) g_free); + gtk_signal_connect (GTK_OBJECT (composer), "save-draft", - composer_save_draft_cb, NULL); + composer_save_draft_cb, uid); gtk_widget_show (GTK_WIDGET (composer)); } |