aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-callbacks.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2002-05-14 00:15:55 +0800
committerDan Winship <danw@src.gnome.org>2002-05-14 00:15:55 +0800
commitb05542ec2dede738afe1e4dfdb583c822b98a09e (patch)
tree89d3c6f6b3fb92dca4e9bc93f802ecd780942339 /mail/mail-callbacks.c
parentc538852849865837c38a6603dcd4bf17124b03be (diff)
downloadgsoc2013-evolution-b05542ec2dede738afe1e4dfdb583c822b98a09e.tar.gz
gsoc2013-evolution-b05542ec2dede738afe1e4dfdb583c822b98a09e.tar.zst
gsoc2013-evolution-b05542ec2dede738afe1e4dfdb583c822b98a09e.zip
Update for camel_folder_append_message / camel_folder_transfer_messages_to
* (various places): Update for camel_folder_append_message / camel_folder_transfer_messages_to API change. * mail-ops.c (mail_append_mail): Pass the appended_uid to the callback. * mail-callbacks.c (composer_save_draft_cb, save_draft_done, do_edit_messages): Take advantage of the append_message change to keep track of the UID of the saved draft so that we can delete the old copy of the draft each time we save a new one. Remove the FIXME suggesting we should do that, since we're doing it now. :) svn path=/trunk/; revision=16766
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r--mail/mail-callbacks.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 5ae3b8334e..a7c3adbb9f 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -520,9 +520,11 @@ composer_send_cb (EMsgComposer *composer, gpointer data)
}
static void
-append_mail_cleanup (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data)
+append_mail_cleanup (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, char *appended_uid, void *data)
{
camel_message_info_free (info);
+ if (appended_uid)
+ g_free (appended_uid);
}
void
@@ -551,26 +553,40 @@ composer_postpone_cb (EMsgComposer *composer, gpointer data)
struct _save_draft_info {
EMsgComposer *composer;
- const char *old_uid;
int quit;
};
static void
-save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data)
+save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, char *appended_uid, void *data)
{
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,
+ char *old_uid;
+
+ if (!ok)
+ goto done;
+
+ old_uid = gtk_object_get_data (GTK_OBJECT (sdi->composer), "draft_uid");
+ if (old_uid) {
+ /* delete the original draft message */
+ camel_folder_set_message_flags (folder, old_uid,
CAMEL_MESSAGE_DELETED,
CAMEL_MESSAGE_DELETED);
+ }
+
+ if (appended_uid) {
+ gtk_object_set_data_full (GTK_OBJECT (sdi->composer),
+ "draft_uid", appended_uid,
+ (GtkDestroyNotify)g_free);
+ } else {
+ gtk_object_set_data (GTK_OBJECT (sdi->composer),
+ "draft_uid", NULL);
+ }
- if (ok && sdi->quit)
+ if (sdi->quit)
gtk_widget_destroy (GTK_WIDGET (sdi->composer));
- else
- gtk_object_unref (GTK_OBJECT (sdi->composer));
-
+
+ done:
+ gtk_object_unref (GTK_OBJECT (sdi->composer));
g_free (info);
g_free (sdi);
}
@@ -640,16 +656,8 @@ composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user_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));
@@ -2048,10 +2056,10 @@ do_edit_messages (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, voi
composer_postpone_cb, NULL);
uid = g_strdup (uids->pdata[i]);
- gtk_object_set_data_full (GTK_OBJECT (composer), "uid", uid, (GtkDestroyNotify) g_free);
+ gtk_object_set_data_full (GTK_OBJECT (composer), "draft_uid", uid, (GtkDestroyNotify) g_free);
gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
- composer_save_draft_cb, uid);
+ composer_save_draft_cb, NULL);
gtk_widget_show (GTK_WIDGET (composer));
}