aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-ops.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-02-04 18:45:20 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-02-04 18:45:20 +0800
commitef8a0762ac9e07a36e8d39d2948c8acd065aa350 (patch)
tree344be4bd475744a8e86a98b4952a215facfe6ce8 /mail/mail-ops.c
parent0650e002ea411371bef49056da8f1dfd3fca00f0 (diff)
downloadgsoc2013-evolution-ef8a0762ac9e07a36e8d39d2948c8acd065aa350.tar
gsoc2013-evolution-ef8a0762ac9e07a36e8d39d2948c8acd065aa350.tar.gz
gsoc2013-evolution-ef8a0762ac9e07a36e8d39d2948c8acd065aa350.tar.bz2
gsoc2013-evolution-ef8a0762ac9e07a36e8d39d2948c8acd065aa350.tar.lz
gsoc2013-evolution-ef8a0762ac9e07a36e8d39d2948c8acd065aa350.tar.xz
gsoc2013-evolution-ef8a0762ac9e07a36e8d39d2948c8acd065aa350.tar.zst
gsoc2013-evolution-ef8a0762ac9e07a36e8d39d2948c8acd065aa350.zip
** See bug #53683.
2004-02-04 Not Zed <NotZed@Ximian.com> ** See bug #53683. * mail-ops.c (mail_sync_store): new async op to call CamelStore::sync. * mail-component.c (impl_requestQuit): implement, check to see if we can quit, or have open or unsent messages (and are in online mode). (impl_quit): implement. Trigger off a sync of all open stores, and return FALSE until its done. (impl_upgradeFromVersion): fixed the signature to match the idl, killed that warning at last. ** See bug #53832. * em-folder-browser.c (emfb_folder_properties): only show this if we have a uri set. Strictly, the menu item shouldn't be activated. ** See bug #53131. * em-folder-browser.c (em_folder_browser_show_preview): copy the message list's cursor_uid before calling set_message, since it can get freed during setting the message. svn path=/trunk/; revision=24608
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r--mail/mail-ops.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 10e40eafc5..26dde00460 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -1571,6 +1571,76 @@ mail_sync_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, void *d
e_thread_put(mail_thread_queued_slow, (EMsg *)m);
}
+/* ** SYNC STORE ********************************************************* */
+
+struct _sync_store_msg {
+ struct _mail_msg msg;
+
+ CamelStore *store;
+ int expunge;
+ void (*done) (CamelStore *store, void *data);
+ void *data;
+};
+
+static char *sync_store_desc(struct _mail_msg *mm, int done)
+{
+ struct _sync_store_msg *m = (struct _sync_store_msg *)mm;
+ char *uri, *res;
+
+ uri = camel_url_to_string(((CamelService *)m->store)->url, CAMEL_URL_HIDE_ALL);
+ res = g_strdup_printf(m->expunge
+ ?_("Expunging and storing account '%s'")
+ :_("Storing account '%s'"),
+ uri);
+ g_free(uri);
+
+ return res;
+}
+
+static void sync_store_sync(struct _mail_msg *mm)
+{
+ struct _sync_store_msg *m = (struct _sync_store_msg *)mm;
+
+ camel_store_sync(m->store, m->expunge, &mm->ex);
+}
+
+static void sync_store_synced(struct _mail_msg *mm)
+{
+ struct _sync_store_msg *m = (struct _sync_store_msg *)mm;
+
+ if (m->done)
+ m->done(m->store, m->data);
+}
+
+static void sync_store_free(struct _mail_msg *mm)
+{
+ struct _sync_store_msg *m = (struct _sync_store_msg *)mm;
+
+ camel_object_unref(m->store);
+}
+
+static struct _mail_msg_op sync_store_op = {
+ sync_store_desc,
+ sync_store_sync,
+ sync_store_synced,
+ sync_store_free,
+};
+
+void
+mail_sync_store(CamelStore *store, int expunge, void (*done) (CamelStore *store, void *data), void *data)
+{
+ struct _sync_store_msg *m;
+
+ m = mail_msg_new(&sync_store_op, NULL, sizeof(*m));
+ m->store = store;
+ m->expunge = expunge;
+ camel_object_ref(store);
+ m->data = data;
+ m->done = done;
+
+ e_thread_put(mail_thread_queued_slow, (EMsg *)m);
+}
+
/* ******************************************************************************** */
static char *refresh_folder_desc(struct _mail_msg *mm, int done)