From ef8a0762ac9e07a36e8d39d2948c8acd065aa350 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 4 Feb 2004 10:45:20 +0000 Subject: ** See bug #53683. 2004-02-04 Not Zed ** 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 --- mail/mail-ops.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'mail/mail-ops.c') 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) -- cgit v1.2.3