aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-ops.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-05-27 01:22:53 +0800
committerDan Winship <danw@src.gnome.org>2001-05-27 01:22:53 +0800
commitf30f7c9229f581132a2fdebe61f16e877e11c68b (patch)
tree06ef5bafef9c8ca9767c44649a56df69dd880f66 /mail/mail-ops.c
parent364cdf26e787ac19200de24beb147c9ac229c16b (diff)
downloadgsoc2013-evolution-f30f7c9229f581132a2fdebe61f16e877e11c68b.tar.gz
gsoc2013-evolution-f30f7c9229f581132a2fdebe61f16e877e11c68b.tar.zst
gsoc2013-evolution-f30f7c9229f581132a2fdebe61f16e877e11c68b.zip
When unreffing a folder we got ourselves (as opposed to one passed in by
* mail-ops.c (mail_send_message, transfer_messages_transfer, set_offline_do): When unreffing a folder we got ourselves (as opposed to one passed in by the caller), sync before unreffing, since we might be holding the only reference to it. (mail_refresh_folder): New op, like mail_sync_folder, but does a camel_folder_refresh_info instead. * folder-browser-factory.c (control_activate): Call mail_refresh_folder, not mail_sync_folder. (The goal is to see new messages: sync used to work with imap because imap_sync was broken, but it doesn't work for that any more.) svn path=/trunk/; revision=10011
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r--mail/mail-ops.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 34a88a7b51..ba12baa140 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -565,6 +565,7 @@ mail_send_message(CamelMimeMessage *message, const char *destination, CamelFilte
if (folder) {
camel_folder_append_message (folder, message, info, ex);
+ camel_folder_sync (folder, FALSE, NULL);
camel_object_unref (CAMEL_OBJECT (folder));
}
@@ -744,7 +745,7 @@ send_queue_send(struct _mail_msg *mm)
camel_folder_expunge (m->queue, &mm->ex);
if (sent_folder)
- camel_folder_sync (sent_folder, FALSE, &mm->ex);
+ camel_folder_sync (sent_folder, FALSE, NULL);
if (m->cancel)
camel_operation_unregister (m->cancel);
@@ -929,6 +930,7 @@ static void transfer_messages_transfer(struct _mail_msg *mm)
camel_folder_thaw(m->source);
camel_folder_thaw(dest);
+ camel_folder_sync(dest, FALSE, NULL);
camel_object_unref((CamelObject *)dest);
}
@@ -1636,6 +1638,42 @@ mail_sync_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, void *d
/* ******************************************************************************** */
+static char *refresh_folder_desc(struct _mail_msg *mm, int done)
+{
+ return g_strdup(_("Refreshing folder"));
+}
+
+static void refresh_folder_refresh(struct _mail_msg *mm)
+{
+ struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm;
+
+ camel_folder_refresh_info(m->folder, &mm->ex);
+}
+
+/* we just use the sync stuff where we can, since it would be the same */
+static struct _mail_msg_op refresh_folder_op = {
+ refresh_folder_desc,
+ refresh_folder_refresh,
+ sync_folder_synced,
+ sync_folder_free,
+};
+
+void
+mail_refresh_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, void *data), void *data)
+{
+ struct _sync_folder_msg *m;
+
+ m = mail_msg_new(&refresh_folder_op, NULL, sizeof(*m));
+ m->folder = folder;
+ camel_object_ref((CamelObject *)folder);
+ m->data = data;
+ m->done = done;
+
+ e_thread_put(mail_thread_new, (EMsg *)m);
+}
+
+/* ******************************************************************************** */
+
static char *expunge_folder_desc(struct _mail_msg *mm, int done)
{
return g_strdup(_("Expunging folder"));
@@ -2149,6 +2187,7 @@ static void set_offline_do(struct _mail_msg *mm)
CAMEL_DISCO_FOLDER (inbox),
"(match-all (not (system-flag \"Seen\")))",
&mm->ex);
+ camel_folder_sync (inbox, FALSE, NULL);
camel_object_unref (CAMEL_OBJECT (inbox));
if (camel_exception_is_set (&mm->ex))
return;