From 1e91f2f7b151984a30552aef782efaf41156f7c5 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: May 16 2007 21:08:37 +0000 Subject: - Revise patch for GNOME bug #362638 to fix RH bug #237206 (certificate prompt causes crash, again). --- diff --git a/evolution-2.8.1-kill-ethread.patch b/evolution-2.8.1-kill-ethread.patch index 00e4630..1300292 100644 --- a/evolution-2.8.1-kill-ethread.patch +++ b/evolution-2.8.1-kill-ethread.patch @@ -1,16 +1,89 @@ --- evolution-2.10.1/mail/mail-send-recv.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/mail-send-recv.c 2007-04-10 22:37:49.000000000 -0400 -@@ -819,7 +819,7 @@ ++++ evolution-2.10.1/mail/mail-send-recv.c 2007-05-16 16:17:38.000000000 -0400 +@@ -725,23 +725,22 @@ + /* ********************************************************************** */ + + struct _refresh_folders_msg { +- struct _mail_msg msg; ++ MailMsg base; + + struct _send_info *info; + GPtrArray *folders; + CamelStore *store; + }; + +-static char * +-refresh_folders_desc (struct _mail_msg *mm, int done) ++static gchar * ++refresh_folders_desc (struct _refresh_folders_msg *m) + { + return g_strdup_printf(_("Checking for new mail")); + } + + static void +-refresh_folders_get (struct _mail_msg *mm) ++refresh_folders_exec (struct _refresh_folders_msg *m) + { +- struct _refresh_folders_msg *m = (struct _refresh_folders_msg *)mm; + int i; + CamelFolder *folder; + +@@ -757,17 +756,14 @@ + } + + static void +-refresh_folders_got (struct _mail_msg *mm) ++refresh_folders_done (struct _refresh_folders_msg *m) + { +- struct _refresh_folders_msg *m = (struct _refresh_folders_msg *)mm; +- + receive_done("", m->info); + } + + static void +-refresh_folders_free (struct _mail_msg *mm) ++refresh_folders_free (struct _refresh_folders_msg *m) + { +- struct _refresh_folders_msg *m = (struct _refresh_folders_msg *)mm; + int i; + + for (i=0;ifolders->len;i++) +@@ -776,11 +772,12 @@ + camel_object_unref(m->store); + } + +-static struct _mail_msg_op refresh_folders_op = { +- refresh_folders_desc, +- refresh_folders_get, +- refresh_folders_got, +- refresh_folders_free, ++static MailMsgInfo refresh_folders_info = { ++ sizeof (struct _refresh_folders_msg), ++ (MailMsgDescFunc) refresh_folders_desc, ++ (MailMsgExecFunc) refresh_folders_exec, ++ (MailMsgDoneFunc) refresh_folders_done, ++ (MailMsgFreeFunc) refresh_folders_free + }; + + static void +@@ -813,13 +810,13 @@ + + get_folders(store, folders, info); + +- m = mail_msg_new(&refresh_folders_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&refresh_folders_info); + m->store = store; + camel_object_ref(store); m->folders = folders; m->info = sinfo; - e_thread_put(mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); ++ mail_msg_unordered_push (m); } else { receive_done ("", data); } --- evolution-2.10.1/mail/mail-component.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/mail-component.c 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/mail/mail-component.c 2007-05-16 16:17:38.000000000 -0400 @@ -965,7 +965,7 @@ if (camel_url_get_param(url, "uid") != NULL) { char *curi = em_uri_to_camel(uri); @@ -21,407 +94,3617 @@ } else { g_warning("email uri's must include a uid parameter"); --- evolution-2.10.1/mail/mail-ops.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/mail-ops.c 2007-04-10 22:37:49.000000000 -0400 -@@ -221,7 +221,7 @@ ++++ evolution-2.10.1/mail/mail-ops.c 2007-05-16 16:19:33.000000000 -0400 +@@ -75,7 +75,7 @@ + /* used for both just filtering a folder + uid's, and for filtering a whole folder */ + /* used both for fetching mail, and for filtering mail */ + struct _filter_mail_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelFolder *source_folder; /* where they come from */ + GPtrArray *source_uids; /* uids to copy, or NULL == copy all */ +@@ -99,8 +99,8 @@ + void *data; + }; + +-static char * +-em_filter_folder_element_describe (struct _mail_msg *mm, int complete) ++static gchar * ++em_filter_folder_element_desc (struct _filter_mail_msg *m) + { + return g_strdup (_("Filtering Selected Messages")); + } +@@ -108,9 +108,8 @@ + /* filter a folder, or a subset thereof, uses source_folder/source_uids */ + /* this is shared with fetch_mail */ + static void +-em_filter_folder_element_filter (struct _mail_msg *mm) ++em_filter_folder_element_exec (struct _filter_mail_msg *m) + { +- struct _filter_mail_msg *m = (struct _filter_mail_msg *)mm; + CamelFolder *folder; + GPtrArray *uids, *folder_uids = NULL; + +@@ -137,15 +136,15 @@ + else + folder_uids = uids = camel_folder_get_uids (folder); + +- camel_filter_driver_filter_folder (m->driver, folder, m->cache, uids, m->delete, &mm->ex); +- camel_filter_driver_flush (m->driver, &mm->ex); ++ camel_filter_driver_filter_folder (m->driver, folder, m->cache, uids, m->delete, &m->base.ex); ++ camel_filter_driver_flush (m->driver, &m->base.ex); + + if (folder_uids) + camel_folder_free_uids (folder, folder_uids); + + /* sync our source folder */ + if (!m->cache) +- camel_folder_sync (folder, FALSE, camel_exception_is_set (&mm->ex) ? NULL : &mm->ex); ++ camel_folder_sync (folder, FALSE, camel_exception_is_set (&m->base.ex) ? NULL : &m->base.ex); + camel_folder_thaw (folder); + + if (m->destination) +@@ -161,15 +160,13 @@ + } + + static void +-em_filter_folder_element_filtered (struct _mail_msg *mm) ++em_filter_folder_element_done (struct _filter_mail_msg *m) + { + } + + static void +-em_filter_folder_element_free (struct _mail_msg *mm) ++em_filter_folder_element_free (struct _filter_mail_msg *m) + { +- struct _filter_mail_msg *m = (struct _filter_mail_msg *)mm; +- + if (m->source_folder) + camel_object_unref (m->source_folder); + +@@ -188,11 +185,12 @@ + mail_session_flush_filter_log (); + } + +-static struct _mail_msg_op em_filter_folder_element_op = { +- em_filter_folder_element_describe, /* we do our own progress reporting? */ +- em_filter_folder_element_filter, +- em_filter_folder_element_filtered, +- em_filter_folder_element_free, ++static MailMsgInfo em_filter_folder_element_info = { ++ sizeof (struct _filter_mail_msg), ++ (MailMsgDescFunc) em_filter_folder_element_desc, /* we do our own progress reporting? */ ++ (MailMsgExecFunc) em_filter_folder_element_exec, ++ (MailMsgDoneFunc) em_filter_folder_element_done, ++ (MailMsgFreeFunc) em_filter_folder_element_free + }; + + void +@@ -202,7 +200,7 @@ + { + struct _filter_mail_msg *m; + +- m = mail_msg_new (&em_filter_folder_element_op, NULL, sizeof (*m)); ++ m = mail_msg_new (&em_filter_folder_element_info); + m->source_folder = source_folder; + camel_object_ref (source_folder); + m->source_uids = uids; +@@ -221,7 +219,7 @@ camel_filter_driver_remove_rule_by_name (m->driver, "new-mail-notification"); } - e_thread_put (mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); ++ mail_msg_unordered_push (m); } /* convenience functions for it */ -@@ -426,7 +426,7 @@ +@@ -260,17 +258,16 @@ + return filename; + } + +-static char * +-fetch_mail_describe (struct _mail_msg *mm, int complete) ++static gchar * ++fetch_mail_desc (struct _fetch_mail_msg *m) + { + return g_strdup (_("Fetching Mail")); + } + + static void +-fetch_mail_fetch (struct _mail_msg *mm) ++fetch_mail_exec (struct _fetch_mail_msg *m) + { +- struct _fetch_mail_msg *m = (struct _fetch_mail_msg *)mm; +- struct _filter_mail_msg *fm = (struct _filter_mail_msg *)mm; ++ struct _filter_mail_msg *fm = (struct _filter_mail_msg *)m; + int i; + + if (m->cancel) +@@ -283,20 +280,20 @@ + /* FIXME: this should support keep_on_server too, which would then perform a spool + access thingy, right? problem is matching raw messages to uid's etc. */ + if (!strncmp (m->source_uri, "mbox:", 5)) { +- char *path = mail_tool_do_movemail (m->source_uri, &mm->ex); ++ char *path = mail_tool_do_movemail (m->source_uri, &fm->base.ex); + +- if (path && !camel_exception_is_set (&mm->ex)) { ++ if (path && !camel_exception_is_set (&fm->base.ex)) { + camel_folder_freeze (fm->destination); + camel_filter_driver_set_default_folder (fm->driver, fm->destination); +- camel_filter_driver_filter_mbox (fm->driver, path, m->source_uri, &mm->ex); ++ camel_filter_driver_filter_mbox (fm->driver, path, m->source_uri, &fm->base.ex); + camel_folder_thaw (fm->destination); + +- if (!camel_exception_is_set (&mm->ex)) ++ if (!camel_exception_is_set (&fm->base.ex)) + g_unlink (path); + } + g_free (path); + } else { +- CamelFolder *folder = fm->source_folder = mail_tool_get_inbox (m->source_uri, &mm->ex); ++ CamelFolder *folder = fm->source_folder = mail_tool_get_inbox (m->source_uri, &fm->base.ex); + + if (folder) { + /* this handles 'keep on server' stuff, if we have any new uid's to copy +@@ -322,17 +319,17 @@ + camel_uid_cache_free_uids (cache_uids); + + fm->cache = cache; +- em_filter_folder_element_filter (mm); ++ em_filter_folder_element_exec (&fm->base); + + /* need to uncancel so writes/etc. don't fail */ +- if (mm->ex.id == CAMEL_EXCEPTION_USER_CANCEL) ++ if (fm->base.ex.id == CAMEL_EXCEPTION_USER_CANCEL) + camel_operation_uncancel(NULL); + + /* save the cache of uids that we've just downloaded */ + camel_uid_cache_save (cache); + } + +- if (fm->delete && mm->ex.id == CAMEL_EXCEPTION_NONE) { ++ if (fm->delete && fm->base.ex.id == CAMEL_EXCEPTION_NONE) { + /* not keep on server - just delete all the actual messages on the server */ + for (i=0;ilen;i++) { + d(printf("force delete uid '%s'\n", (char *)folder_uids->pdata[i])); +@@ -348,7 +345,7 @@ + camel_uid_cache_destroy (cache); + camel_folder_free_uids (folder, folder_uids); + } else { +- em_filter_folder_element_filter (mm); ++ em_filter_folder_element_exec (&fm->base); + } + + /* we unref the source folder here since we +@@ -372,31 +369,28 @@ + } + + static void +-fetch_mail_fetched (struct _mail_msg *mm) ++fetch_mail_done (struct _fetch_mail_msg *m) + { +- struct _fetch_mail_msg *m = (struct _fetch_mail_msg *)mm; +- + if (m->done) + m->done (m->source_uri, m->data); + } + + static void +-fetch_mail_free (struct _mail_msg *mm) ++fetch_mail_free (struct _fetch_mail_msg *m) + { +- struct _fetch_mail_msg *m = (struct _fetch_mail_msg *)mm; +- + g_free (m->source_uri); + if (m->cancel) + camel_operation_unref (m->cancel); + +- em_filter_folder_element_free (mm); ++ em_filter_folder_element_free (&m->fmsg.base); + } + +-static struct _mail_msg_op fetch_mail_op = { +- fetch_mail_describe, /* we do our own progress reporting */ +- fetch_mail_fetch, +- fetch_mail_fetched, +- fetch_mail_free, ++static MailMsgInfo fetch_mail_info = { ++ sizeof (struct _fetch_mail_msg), ++ (MailMsgDescFunc) fetch_mail_desc, ++ (MailMsgExecFunc) fetch_mail_exec, ++ (MailMsgDoneFunc) fetch_mail_done, ++ (MailMsgFreeFunc) fetch_mail_free + }; + + /* ouch, a 'do everything' interface ... */ +@@ -409,7 +403,7 @@ + struct _fetch_mail_msg *m; + struct _filter_mail_msg *fm; + +- m = mail_msg_new (&fetch_mail_op, NULL, sizeof (*m)); ++ m = mail_msg_new (&fetch_mail_info); + fm = (struct _filter_mail_msg *)m; + m->source_uri = g_strdup (source); + fm->delete = !keep; +@@ -426,7 +420,7 @@ if (status) camel_filter_driver_set_status_func (fm->driver, status, status_data); - e_thread_put (mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); ++ mail_msg_unordered_push (m); } /* ********************************************************************** */ -@@ -839,7 +839,7 @@ - m->driver = camel_session_get_filter_driver (session, type, NULL); - camel_filter_driver_set_folder_func (m->driver, get_folder, get_data); +@@ -657,7 +651,7 @@ + /* ** SEND MAIL QUEUE ***************************************************** */ -- e_thread_put(mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); + struct _send_queue_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelFolder *queue; + char *destination; +@@ -689,9 +683,8 @@ } - /* ** APPEND MESSAGE TO FOLDER ******************************************** */ -@@ -921,7 +921,7 @@ - m->done = done; - m->data = data; + static void +-send_queue_send(struct _mail_msg *mm) ++send_queue_exec (struct _send_queue_msg *m) + { +- struct _send_queue_msg *m = (struct _send_queue_msg *)mm; + CamelFolder *sent_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT); + GPtrArray *uids, *send_uids = NULL; + CamelException ex; +@@ -739,17 +732,17 @@ + if (camel_exception_is_set (&ex)) { + if (ex.id != CAMEL_EXCEPTION_USER_CANCEL) { + /* merge exceptions into one */ +- if (camel_exception_is_set (&mm->ex)) +- camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM, "%s\n\n%s", mm->ex.desc, ex.desc); ++ if (camel_exception_is_set (&m->base.ex)) ++ camel_exception_setv (&m->base.ex, CAMEL_EXCEPTION_SYSTEM, "%s\n\n%s", m->base.ex.desc, ex.desc); + else +- camel_exception_xfer (&mm->ex, &ex); ++ camel_exception_xfer (&m->base.ex, &ex); + camel_exception_clear (&ex); + + /* keep track of the number of failures */ + j++; + } else { + /* transfer the USER_CANCEL exeption to the async op exception and then break */ +- camel_exception_xfer (&mm->ex, &ex); ++ camel_exception_xfer (&m->base.ex, &ex); + break; + } + } +@@ -759,7 +752,7 @@ -- e_thread_put (mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); + if (j > 0) + report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Failed to send %d of %d messages"), j, send_uids->len); +- else if (mm->ex.id == CAMEL_EXCEPTION_USER_CANCEL) ++ else if (m->base.ex.id == CAMEL_EXCEPTION_USER_CANCEL) + report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Canceled.")); + else + report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Complete.")); +@@ -785,19 +778,15 @@ } - /* ** TRANSFER MESSAGES **************************************************** */ -@@ -1036,7 +1036,7 @@ - m->done = done; - m->data = data; - -- e_thread_put(mail_thread_queued_slow, (EMsg *)m); -+ mail_msg_slow_ordered_push ((mail_msg_t *) m); + static void +-send_queue_sent(struct _mail_msg *mm) ++send_queue_done (struct _send_queue_msg *m) + { +- struct _send_queue_msg *m = (struct _send_queue_msg *)mm; +- + if (m->done) + m->done(m->destination, m->data); } - /* ** SCAN SUBFOLDERS ***************************************************** */ -@@ -1124,7 +1124,7 @@ - m->data = data; - id = m->msg.seq; + static void +-send_queue_free(struct _mail_msg *mm) ++send_queue_free (struct _send_queue_msg *m) + { +- struct _send_queue_msg *m = (struct _send_queue_msg *)mm; +- + if (m->driver) + camel_object_unref(m->driver); + camel_object_unref(m->queue); +@@ -806,11 +795,12 @@ + camel_operation_unref(m->cancel); + } + +-static struct _mail_msg_op send_queue_op = { +- NULL, /* do our own reporting, as with fetch mail */ +- send_queue_send, +- send_queue_sent, +- send_queue_free, ++static MailMsgInfo send_queue_info = { ++ sizeof (struct _send_queue_msg), ++ (MailMsgDescFunc) NULL, ++ (MailMsgExecFunc) send_queue_exec, ++ (MailMsgDoneFunc) send_queue_done, ++ (MailMsgFreeFunc) send_queue_free + }; + + /* same interface as fetch_mail, just 'cause i'm lazy today (and we need to run it from the same spot?) */ +@@ -823,7 +813,7 @@ + { + struct _send_queue_msg *m; + +- m = mail_msg_new(&send_queue_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&send_queue_info); + m->queue = queue; + camel_object_ref(queue); + m->destination = g_strdup(destination); +@@ -839,13 +829,13 @@ + m->driver = camel_session_get_filter_driver (session, type, NULL); + camel_filter_driver_set_folder_func (m->driver, get_folder, get_data); - e_thread_put(mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); ++ mail_msg_unordered_push (m); + } - return id; + /* ** APPEND MESSAGE TO FOLDER ******************************************** */ + + struct _append_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelFolder *folder; + CamelMimeMessage *message; +@@ -856,45 +846,40 @@ + void *data; + }; + +-static char * +-append_mail_desc (struct _mail_msg *mm, int done) ++static gchar * ++append_mail_desc (struct _append_msg *m) + { + return g_strdup (_("Saving message to folder")); } -@@ -1250,7 +1250,7 @@ - int - mail_get_folder (const char *uri, guint32 flags, - void (*done)(char *uri, CamelFolder *folder, void *data), -- void *data, EThread *thread) -+ void *data, MailMsgDispatchFunc dispatch) + + static void +-append_mail_append (struct _mail_msg *mm) ++append_mail_exec (struct _append_msg *m) { - struct _get_folder_msg *m; - int id; -@@ -1262,7 +1262,7 @@ - m->done = done; - - id = m->msg.seq; -- e_thread_put(thread, (EMsg *)m); -+ dispatch ((mail_msg_t *) m); - return id; +- struct _append_msg *m = (struct _append_msg *)mm; +- + camel_mime_message_set_date(m->message, CAMEL_MESSAGE_DATE_CURRENT, 0); +- camel_folder_append_message(m->folder, m->message, m->info, &m->appended_uid, &mm->ex); ++ camel_folder_append_message(m->folder, m->message, m->info, &m->appended_uid, &m->base.ex); } -@@ -1340,7 +1340,7 @@ - m->done = done; - - id = m->msg.seq; -- e_thread_put (mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); - return id; + static void +-append_mail_appended (struct _mail_msg *mm) ++append_mail_done (struct _append_msg *m) + { +- struct _append_msg *m = (struct _append_msg *)mm; +- + if (m->done) +- m->done(m->folder, m->message, m->info, !camel_exception_is_set(&mm->ex), m->appended_uid, m->data); ++ m->done(m->folder, m->message, m->info, !camel_exception_is_set(&m->base.ex), m->appended_uid, m->data); } -@@ -1437,7 +1437,7 @@ - m->data = data; + static void +-append_mail_free (struct _mail_msg *mm) ++append_mail_free (struct _append_msg *m) + { +- struct _append_msg *m = (struct _append_msg *)mm; +- + camel_object_unref(m->message); + camel_object_unref(m->folder); + g_free (m->appended_uid); + } + +-static struct _mail_msg_op append_mail_op = { +- append_mail_desc, +- append_mail_append, +- append_mail_appended, +- append_mail_free ++static MailMsgInfo append_mail_info = { ++ sizeof (struct _append_msg), ++ (MailMsgDescFunc) append_mail_desc, ++ (MailMsgExecFunc) append_mail_exec, ++ (MailMsgDoneFunc) append_mail_done, ++ (MailMsgFreeFunc) append_mail_free + }; + + void +@@ -911,7 +896,7 @@ + camel_medium_set_header (CAMEL_MEDIUM (message), "X-Mailer", + "Evolution " VERSION SUB_VERSION " " VERSION_COMMENT); + +- m = mail_msg_new (&append_mail_op, NULL, sizeof (*m)); ++ m = mail_msg_new (&append_mail_info); + m->folder = folder; + camel_object_ref(folder); + m->message = message; +@@ -921,13 +906,13 @@ m->done = done; + m->data = data; - e_thread_put (mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); ++ mail_msg_unordered_push (m); } - /* ** SYNC FOLDER ********************************************************* */ -@@ -1498,7 +1498,7 @@ - m->data = data; - m->done = done; + /* ** TRANSFER MESSAGES **************************************************** */ -- e_thread_put(mail_thread_queued_slow, (EMsg *)m); -+ mail_msg_slow_ordered_push ((mail_msg_t *) m); - } + struct _transfer_msg { +- struct _mail_msg msg; ++ MailMsg base; - /* ** SYNC STORE ********************************************************* */ -@@ -1568,7 +1568,7 @@ - m->data = data; - m->done = done; + CamelFolder *source; + GPtrArray *uids; +@@ -939,24 +924,21 @@ + void *data; + }; -- e_thread_put(mail_thread_queued_slow, (EMsg *)m); -+ mail_msg_slow_ordered_push ((mail_msg_t *) m); +-static char * +-transfer_messages_desc (struct _mail_msg *mm, int done) ++static gchar * ++transfer_messages_desc (struct _transfer_msg *m) + { +- struct _transfer_msg *m = (struct _transfer_msg *)mm; +- + return g_strdup_printf(m->delete?_("Moving messages to %s"):_("Copying messages to %s"), + m->dest_uri); + } - /* ******************************************************************************** */ -@@ -1604,7 +1604,7 @@ - m->data = data; - m->done = done; + static void +-transfer_messages_transfer (struct _mail_msg *mm) ++transfer_messages_exec (struct _transfer_msg *m) + { +- struct _transfer_msg *m = (struct _transfer_msg *)mm; + CamelFolder *dest; -- e_thread_put(mail_thread_queued_slow, (EMsg *)m); -+ mail_msg_slow_ordered_push ((mail_msg_t *) m); - } +- dest = mail_tool_uri_to_folder (m->dest_uri, m->dest_flags, &mm->ex); +- if (camel_exception_is_set (&mm->ex)) ++ dest = mail_tool_uri_to_folder (m->dest_uri, m->dest_flags, &m->base.ex); ++ if (camel_exception_is_set (&m->base.ex)) + return; - /* ******************************************************************************** */ -@@ -1640,7 +1640,7 @@ - m->data = data; - m->done = done; + if (dest == m->source) { +@@ -968,7 +950,7 @@ + camel_folder_freeze (m->source); + camel_folder_freeze (dest); -- e_thread_put(mail_thread_queued_slow, (EMsg *)m); -+ mail_msg_slow_ordered_push ((mail_msg_t *) m); +- camel_folder_transfer_messages_to (m->source, m->uids, dest, NULL, m->delete, &mm->ex); ++ camel_folder_transfer_messages_to (m->source, m->uids, dest, NULL, m->delete, &m->base.ex); + + /* make sure all deleted messages are marked as seen */ + +@@ -987,29 +969,26 @@ } - /* ******************************************************************************** */ -@@ -1723,7 +1723,7 @@ - m->data = data; - m->done = done; + static void +-transfer_messages_transferred (struct _mail_msg *mm) ++transfer_messages_done (struct _transfer_msg *m) + { +- struct _transfer_msg *m = (struct _transfer_msg *)mm; +- + if (m->done) +- m->done (!camel_exception_is_set (&mm->ex), m->data); ++ m->done (!camel_exception_is_set (&m->base.ex), m->data); + } -- e_thread_put(mail_thread_queued_slow, (EMsg *)m); -+ mail_msg_slow_ordered_push ((mail_msg_t *) m); + static void +-transfer_messages_free (struct _mail_msg *mm) ++transfer_messages_free (struct _transfer_msg *m) + { +- struct _transfer_msg *m = (struct _transfer_msg *)mm; +- + camel_object_unref (m->source); + g_free (m->dest_uri); + em_utils_uids_free (m->uids); } - /* ** GET MESSAGE(s) ***************************************************** */ -@@ -1783,7 +1783,7 @@ +-static struct _mail_msg_op transfer_messages_op = { +- transfer_messages_desc, +- transfer_messages_transfer, +- transfer_messages_transferred, +- transfer_messages_free, ++static MailMsgInfo transfer_messages_info = { ++ sizeof (struct _transfer_msg), ++ (MailMsgDescFunc) transfer_messages_desc, ++ (MailMsgExecFunc) transfer_messages_exec, ++ (MailMsgDoneFunc) transfer_messages_done, ++ (MailMsgFreeFunc) transfer_messages_free + }; + void - mail_get_message(CamelFolder *folder, const char *uid, void (*done) (CamelFolder *folder, const char *uid, - CamelMimeMessage *msg, void *data), -- void *data, EThread *thread) -+ void *data, MailMsgDispatchFunc dispatch) - { - struct _get_message_msg *m; +@@ -1026,7 +1005,7 @@ + g_assert(uids != NULL); + g_assert(dest_uri != NULL); -@@ -1795,7 +1795,7 @@ +- m = mail_msg_new(&transfer_messages_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&transfer_messages_info); + m->source = source; + camel_object_ref (source); + m->uids = uids; +@@ -1036,13 +1015,13 @@ m->done = done; - m->cancel = camel_operation_new(NULL, NULL); + m->data = data; -- e_thread_put(thread, (EMsg *)m); -+ dispatch ((mail_msg_t *) m); +- e_thread_put(mail_thread_queued_slow, (EMsg *)m); ++ mail_msg_slow_ordered_push (m); } - typedef void (*get_done)(CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data, CamelException *); -@@ -1821,7 +1821,7 @@ - mail_get_message; it adds an exception argument to the callback */ - void - mail_get_messagex(CamelFolder *folder, const char *uid, void (*done) (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data, CamelException *), -- void *data, EThread *thread) -+ void *data, MailMsgDispatchFunc dispatch) + /* ** SCAN SUBFOLDERS ***************************************************** */ + + struct _get_folderinfo_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelStore *store; + CamelFolderInfo *info; +@@ -1050,10 +1029,9 @@ + void *data; + }; + +-static char * +-get_folderinfo_desc (struct _mail_msg *mm, int done) ++static gchar * ++get_folderinfo_desc (struct _get_folderinfo_msg *m) { - struct _get_message_msg *m; - -@@ -1833,7 +1833,7 @@ - m->done = done; - m->cancel = camel_operation_new(NULL, NULL); +- struct _get_folderinfo_msg *m = (struct _get_folderinfo_msg *)mm; + char *ret, *name; + + name = camel_service_get_name((CamelService *)m->store, TRUE); +@@ -1063,25 +1041,22 @@ + } + + static void +-get_folderinfo_get (struct _mail_msg *mm) ++get_folderinfo_exec (struct _get_folderinfo_msg *m) + { +- struct _get_folderinfo_msg *m = (struct _get_folderinfo_msg *)mm; + guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; -- e_thread_put(thread, (EMsg *)m); -+ dispatch ((mail_msg_t *) m); +- m->info = camel_store_get_folder_info (m->store, NULL, flags, &mm->ex); ++ m->info = camel_store_get_folder_info (m->store, NULL, flags, &m->base.ex); } - /* ********************************************************************** */ -@@ -1920,7 +1920,7 @@ - m->data = data; - m->done = done; + static void +-get_folderinfo_got (struct _mail_msg *mm) ++get_folderinfo_done (struct _get_folderinfo_msg *m) + { +- struct _get_folderinfo_msg *m = (struct _get_folderinfo_msg *)mm; +- +- if (!m->info && camel_exception_is_set (&mm->ex)) { ++ if (!m->info && camel_exception_is_set (&m->base.ex)) { + char *url; + + url = camel_service_get_url (CAMEL_SERVICE (m->store)); + w(g_warning ("Error getting folder info from store at %s: %s", +- url, camel_exception_get_description (&mm->ex))); ++ url, camel_exception_get_description (&m->base.ex))); + g_free (url); + } + +@@ -1090,20 +1065,19 @@ + } -- e_thread_put(mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); + static void +-get_folderinfo_free (struct _mail_msg *mm) ++get_folderinfo_free (struct _get_folderinfo_msg *m) + { +- struct _get_folderinfo_msg *m = (struct _get_folderinfo_msg *)mm; +- + if (m->info) + camel_store_free_folder_info(m->store, m->info); + camel_object_unref(m->store); } - /* ** SAVE MESSAGES ******************************************************* */ -@@ -2063,7 +2063,7 @@ +-static struct _mail_msg_op get_folderinfo_op = { +- get_folderinfo_desc, +- get_folderinfo_get, +- get_folderinfo_got, +- get_folderinfo_free, ++static MailMsgInfo get_folderinfo_info = { ++ sizeof (struct _get_folderinfo_msg), ++ (MailMsgDescFunc) get_folderinfo_desc, ++ (MailMsgExecFunc) get_folderinfo_exec, ++ (MailMsgDoneFunc) get_folderinfo_done, ++ (MailMsgFreeFunc) get_folderinfo_free + }; + + int +@@ -1112,19 +1086,19 @@ + struct _get_folderinfo_msg *m; + int id; + +- m = mail_msg_new(&get_folderinfo_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&get_folderinfo_info); + if (op) { +- camel_operation_unref(m->msg.cancel); +- m->msg.cancel = op; ++ camel_operation_unref(m->base.cancel); ++ m->base.cancel = op; + camel_operation_ref(op); + } + m->store = store; + camel_object_ref(store); m->done = done; + m->data = data; +- id = m->msg.seq; ++ id = m->base.seq; - id = m->msg.seq; - e_thread_put(mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); ++ mail_msg_unordered_push (m); return id; } -@@ -2156,7 +2156,7 @@ - m->readonly = readonly; +@@ -1196,7 +1170,7 @@ + presumably create a folder ... */ + + struct _get_folder_msg { +- struct _mail_msg msg; ++ MailMsg base; + + char *uri; + guint32 flags; +@@ -1205,71 +1179,64 @@ + void *data; + }; + +-static char * +-get_folder_desc (struct _mail_msg *mm, int done) ++static gchar * ++get_folder_desc (struct _get_folder_msg *m) + { +- struct _get_folder_msg *m = (struct _get_folder_msg *)mm; +- + return g_strdup_printf(_("Opening folder %s"), m->uri); + } + + static void +-get_folder_get (struct _mail_msg *mm) ++get_folder_exec (struct _get_folder_msg *m) + { +- struct _get_folder_msg *m = (struct _get_folder_msg *)mm; +- +- m->folder = mail_tool_uri_to_folder (m->uri, m->flags, &mm->ex); ++ m->folder = mail_tool_uri_to_folder (m->uri, m->flags, &m->base.ex); + } + + static void +-get_folder_got (struct _mail_msg *mm) ++get_folder_done (struct _get_folder_msg *m) + { +- struct _get_folder_msg *m = (struct _get_folder_msg *)mm; +- + if (m->done) + m->done (m->uri, m->folder, m->data); + } + + static void +-get_folder_free (struct _mail_msg *mm) ++get_folder_free (struct _get_folder_msg *m) + { +- struct _get_folder_msg *m = (struct _get_folder_msg *)mm; +- + g_free (m->uri); + if (m->folder) + camel_object_unref (m->folder); + } + +-static struct _mail_msg_op get_folder_op = { +- get_folder_desc, +- get_folder_get, +- get_folder_got, +- get_folder_free, ++static MailMsgInfo get_folder_info = { ++ sizeof (struct _get_folder_msg), ++ (MailMsgDescFunc) get_folder_desc, ++ (MailMsgExecFunc) get_folder_exec, ++ (MailMsgDoneFunc) get_folder_done, ++ (MailMsgFreeFunc) get_folder_free + }; + + int + mail_get_folder (const char *uri, guint32 flags, + void (*done)(char *uri, CamelFolder *folder, void *data), +- void *data, EThread *thread) ++ void *data, MailMsgDispatchFunc dispatch) + { + struct _get_folder_msg *m; + int id; + +- m = mail_msg_new(&get_folder_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&get_folder_info); + m->uri = g_strdup (uri); + m->flags = flags; + m->data = data; + m->done = done; + +- id = m->msg.seq; +- e_thread_put(thread, (EMsg *)m); ++ id = m->base.seq; ++ dispatch (m); + return id; + } + + /* ** GET STORE ******************************************************* */ + + struct _get_store_msg { +- struct _mail_msg msg; ++ MailMsg base; + + char *uri; + CamelStore *store; +@@ -1277,50 +1244,43 @@ + void *data; + }; + +-static char * +-get_store_desc (struct _mail_msg *mm, int done) ++static gchar * ++get_store_desc (struct _get_store_msg *m) + { +- struct _get_store_msg *m = (struct _get_store_msg *)mm; +- + return g_strdup_printf(_("Opening store %s"), m->uri); + } + + static void +-get_store_get (struct _mail_msg *mm) ++get_store_exec (struct _get_store_msg *m) + { +- struct _get_store_msg *m = (struct _get_store_msg *)mm; +- + /*camel_session_get_store connects us, which we don't want to do on startup. */ + + m->store = (CamelStore *) camel_session_get_service (session, m->uri, + CAMEL_PROVIDER_STORE, +- &mm->ex); ++ &m->base.ex); + } + + static void +-get_store_got (struct _mail_msg *mm) ++get_store_done (struct _get_store_msg *m) + { +- struct _get_store_msg *m = (struct _get_store_msg *)mm; +- + if (m->done) + m->done (m->uri, m->store, m->data); + } + + static void +-get_store_free (struct _mail_msg *mm) ++get_store_free (struct _get_store_msg *m) + { +- struct _get_store_msg *m = (struct _get_store_msg *)mm; +- + g_free (m->uri); + if (m->store) + camel_object_unref (m->store); + } + +-static struct _mail_msg_op get_store_op = { +- get_store_desc, +- get_store_get, +- get_store_got, +- get_store_free, ++static MailMsgInfo get_store_info = { ++ sizeof (struct _get_store_msg), ++ (MailMsgDescFunc) get_store_desc, ++ (MailMsgExecFunc) get_store_exec, ++ (MailMsgDoneFunc) get_store_done, ++ (MailMsgFreeFunc) get_store_free + }; + + int +@@ -1329,25 +1289,25 @@ + struct _get_store_msg *m; + int id; + +- m = mail_msg_new (&get_store_op, NULL, sizeof (*m)); ++ m = mail_msg_new (&get_store_info); + if (op) { +- camel_operation_unref(m->msg.cancel); +- m->msg.cancel = op; ++ camel_operation_unref(m->base.cancel); ++ m->base.cancel = op; + camel_operation_ref(op); + } + m->uri = g_strdup (uri); + m->data = data; + m->done = done; + +- id = m->msg.seq; +- e_thread_put (mail_thread_new, (EMsg *)m); ++ id = m->base.seq; ++ mail_msg_unordered_push (m); + return id; + } + + /* ** REMOVE FOLDER ******************************************************* */ + + struct _remove_folder_msg { +- struct _mail_msg msg; ++ MailMsg base; + + char *uri; + gboolean removed; +@@ -1355,18 +1315,15 @@ + void *data; + }; + +-static char * +-remove_folder_desc (struct _mail_msg *mm, int done) ++static gchar * ++remove_folder_desc (struct _remove_folder_msg *m) + { +- struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm; +- + return g_strdup_printf (_("Removing folder %s"), m->uri); + } + + static void +-remove_folder_get (struct _mail_msg *mm) ++remove_folder_exec (struct _remove_folder_msg *m) + { +- struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm; + CamelStore *store; + CamelFolder *folder; + GPtrArray *uids; +@@ -1374,7 +1331,7 @@ + + m->removed = FALSE; + +- folder = mail_tool_uri_to_folder (m->uri, 0, &mm->ex); ++ folder = mail_tool_uri_to_folder (m->uri, 0, &m->base.ex); + if (!folder) + return; + +@@ -1394,16 +1351,14 @@ + camel_store_unsubscribe_folder (store, folder->full_name, NULL); + + /* Then delete the folder from the store */ +- camel_store_delete_folder (store, folder->full_name, &mm->ex); +- m->removed = !camel_exception_is_set (&mm->ex); ++ camel_store_delete_folder (store, folder->full_name, &m->base.ex); ++ m->removed = !camel_exception_is_set (&m->base.ex); + camel_object_unref (folder); + } + + static void +-remove_folder_got (struct _mail_msg *mm) ++remove_folder_done (struct _remove_folder_msg *m) + { +- struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm; +- + if (m->removed) { + /* FIXME: Remove this folder from the folder cache ??? */ + } +@@ -1413,18 +1368,17 @@ + } + + static void +-remove_folder_free (struct _mail_msg *mm) ++remove_folder_free (struct _remove_folder_msg *m) + { +- struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm; +- + g_free (m->uri); + } + +-static struct _mail_msg_op remove_folder_op = { +- remove_folder_desc, +- remove_folder_get, +- remove_folder_got, +- remove_folder_free, ++static MailMsgInfo remove_folder_info = { ++ sizeof (struct _remove_folder_msg), ++ (MailMsgDescFunc) remove_folder_desc, ++ (MailMsgExecFunc) remove_folder_exec, ++ (MailMsgDoneFunc) remove_folder_done, ++ (MailMsgFreeFunc) remove_folder_free + }; + + void +@@ -1432,59 +1386,56 @@ + { + struct _remove_folder_msg *m; + +- m = mail_msg_new (&remove_folder_op, NULL, sizeof (*m)); ++ m = mail_msg_new (&remove_folder_info); + m->uri = g_strdup (uri); + m->data = data; + m->done = done; + +- e_thread_put (mail_thread_new, (EMsg *)m); ++ mail_msg_unordered_push (m); + } + + /* ** SYNC FOLDER ********************************************************* */ + + struct _sync_folder_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelFolder *folder; + void (*done) (CamelFolder *folder, void *data); + void *data; + }; + +-static char *sync_folder_desc(struct _mail_msg *mm, int done) ++static gchar * ++sync_folder_desc (struct _sync_folder_msg *m) + { +- struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; +- + return g_strdup_printf (_("Storing folder \'%s\'"), + camel_folder_get_full_name (m->folder)); + } + +-static void sync_folder_sync(struct _mail_msg *mm) ++static void ++sync_folder_exec (struct _sync_folder_msg *m) + { +- struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; +- +- camel_folder_sync(m->folder, FALSE, &mm->ex); ++ camel_folder_sync(m->folder, FALSE, &m->base.ex); + } + +-static void sync_folder_synced(struct _mail_msg *mm) ++static void ++sync_folder_done (struct _sync_folder_msg *m) + { +- struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; +- + if (m->done) + m->done(m->folder, m->data); + } + +-static void sync_folder_free(struct _mail_msg *mm) ++static void ++sync_folder_free (struct _sync_folder_msg *m) + { +- struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; +- + camel_object_unref((CamelObject *)m->folder); + } + +-static struct _mail_msg_op sync_folder_op = { +- sync_folder_desc, +- sync_folder_sync, +- sync_folder_synced, +- sync_folder_free, ++static MailMsgInfo sync_folder_info = { ++ sizeof (struct _sync_folder_msg), ++ (MailMsgDescFunc) sync_folder_desc, ++ (MailMsgExecFunc) sync_folder_exec, ++ (MailMsgDoneFunc) sync_folder_done, ++ (MailMsgFreeFunc) sync_folder_free + }; + + void +@@ -1492,19 +1443,19 @@ + { + struct _sync_folder_msg *m; + +- m = mail_msg_new(&sync_folder_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&sync_folder_info); + m->folder = folder; + camel_object_ref(folder); + m->data = data; + m->done = done; + +- e_thread_put(mail_thread_queued_slow, (EMsg *)m); ++ mail_msg_slow_ordered_push (m); + } + + /* ** SYNC STORE ********************************************************* */ + + struct _sync_store_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelStore *store; + int expunge; +@@ -1512,9 +1463,9 @@ + void *data; + }; + +-static char *sync_store_desc(struct _mail_msg *mm, int done) ++static gchar * ++sync_store_desc (struct _sync_store_msg *m) + { +- 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); +@@ -1527,33 +1478,31 @@ + return res; + } + +-static void sync_store_sync(struct _mail_msg *mm) ++static void ++sync_store_exec (struct _sync_store_msg *m) + { +- struct _sync_store_msg *m = (struct _sync_store_msg *)mm; +- +- camel_store_sync(m->store, m->expunge, &mm->ex); ++ camel_store_sync(m->store, m->expunge, &m->base.ex); + } + +-static void sync_store_synced(struct _mail_msg *mm) ++static void ++sync_store_done (struct _sync_store_msg *m) + { +- 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) ++static void ++sync_store_free (struct _sync_store_msg *m) + { +- 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, ++static MailMsgInfo sync_store_info = { ++ sizeof (struct _sync_store_msg), ++ (MailMsgDescFunc) sync_store_desc, ++ (MailMsgExecFunc) sync_store_exec, ++ (MailMsgDoneFunc) sync_store_done, ++ (MailMsgFreeFunc) sync_store_free + }; + + void +@@ -1561,36 +1510,37 @@ + { + struct _sync_store_msg *m; + +- m = mail_msg_new(&sync_store_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&sync_store_info); + 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); ++ mail_msg_slow_ordered_push (m); + } + + /* ******************************************************************************** */ + +-static char *refresh_folder_desc(struct _mail_msg *mm, int done) ++static gchar * ++refresh_folder_desc (struct _sync_folder_msg *m) + { + return g_strdup(_("Refreshing folder")); + } + +-static void refresh_folder_refresh(struct _mail_msg *mm) ++static void ++refresh_folder_exec (struct _sync_folder_msg *m) + { +- struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; +- +- camel_folder_refresh_info(m->folder, &mm->ex); ++ camel_folder_refresh_info(m->folder, &m->base.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, ++static MailMsgInfo refresh_folder_info = { ++ sizeof (struct _sync_folder_msg), ++ (MailMsgDescFunc) refresh_folder_desc, ++ (MailMsgExecFunc) refresh_folder_exec, ++ (MailMsgDoneFunc) sync_folder_done, ++ (MailMsgFreeFunc) sync_folder_free + }; + + void +@@ -1598,35 +1548,36 @@ + { + struct _sync_folder_msg *m; + +- m = mail_msg_new(&refresh_folder_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&refresh_folder_info); + m->folder = folder; + camel_object_ref(folder); + m->data = data; + m->done = done; + +- e_thread_put(mail_thread_queued_slow, (EMsg *)m); ++ mail_msg_slow_ordered_push (m); + } + + /* ******************************************************************************** */ + +-static char *expunge_folder_desc(struct _mail_msg *mm, int done) ++static gchar * ++expunge_folder_desc (struct _sync_folder_msg *m) + { + return g_strdup(_("Expunging folder")); + } + +-static void expunge_folder_expunge(struct _mail_msg *mm) ++static void ++expunge_folder_exec (struct _sync_folder_msg *m) + { +- struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; +- +- camel_folder_expunge(m->folder, &mm->ex); ++ camel_folder_expunge(m->folder, &m->base.ex); + } + + /* we just use the sync stuff where we can, since it would be the same */ +-static struct _mail_msg_op expunge_folder_op = { +- expunge_folder_desc, +- expunge_folder_expunge, +- sync_folder_synced, +- sync_folder_free, ++static MailMsgInfo expunge_folder_info = { ++ sizeof (struct _sync_folder_msg), ++ (MailMsgDescFunc) expunge_folder_desc, ++ (MailMsgExecFunc) expunge_folder_exec, ++ (MailMsgDoneFunc) sync_folder_done, ++ (MailMsgFreeFunc) sync_folder_free + }; + + void +@@ -1634,31 +1585,30 @@ + { + struct _sync_folder_msg *m; + +- m = mail_msg_new(&expunge_folder_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&expunge_folder_info); + m->folder = folder; + camel_object_ref(folder); + m->data = data; + m->done = done; + +- e_thread_put(mail_thread_queued_slow, (EMsg *)m); ++ mail_msg_slow_ordered_push (m); + } + + /* ******************************************************************************** */ + + struct _empty_trash_msg { +- struct _mail_msg msg; ++ MailMsg base; + + EAccount *account; + void (*done) (EAccount *account, void *data); + void *data; + }; + +-static char *empty_trash_desc(struct _mail_msg *mm, int done) ++static gchar * ++empty_trash_desc (struct _empty_trash_msg *m) + { + /* FIXME after 1.4 is out and we're not in string freeze any more. */ + #if 0 +- struct _empty_trash_msg *m = (struct _empty_trash_msg *)mm; +- + return g_strdup_printf (_("Emptying trash in \'%s\'"), + m->account ? m->account->name : _("Local Folders")); + #else +@@ -1666,49 +1616,48 @@ + #endif + } + +-static void empty_trash_empty(struct _mail_msg *mm) ++static void ++empty_trash_exec (struct _empty_trash_msg *m) + { +- struct _empty_trash_msg *m = (struct _empty_trash_msg *)mm; + const char *evolution_dir; + CamelFolder *trash; + char *uri; + + if (m->account) { +- trash = mail_tool_get_trash (m->account->source->url, FALSE, &mm->ex); ++ trash = mail_tool_get_trash (m->account->source->url, FALSE, &m->base.ex); + } else { + evolution_dir = mail_component_peek_base_directory (mail_component_peek ()); + uri = g_strdup_printf ("mbox:%s/mail/local", evolution_dir); +- trash = mail_tool_get_trash (uri, TRUE, &mm->ex); ++ trash = mail_tool_get_trash (uri, TRUE, &m->base.ex); + g_free (uri); + } + + if (trash) +- camel_folder_expunge (trash, &mm->ex); ++ camel_folder_expunge (trash, &m->base.ex); + + camel_object_unref (trash); + } + +-static void empty_trash_emptied(struct _mail_msg *mm) ++static void ++empty_trash_done (struct _empty_trash_msg *m) + { +- struct _empty_trash_msg *m = (struct _empty_trash_msg *)mm; +- + if (m->done) + m->done(m->account, m->data); + } + +-static void empty_trash_free(struct _mail_msg *mm) ++static void ++empty_trash_free (struct _empty_trash_msg *m) + { +- struct _empty_trash_msg *m = (struct _empty_trash_msg *)mm; +- + if (m->account) + g_object_unref(m->account); + } + +-static struct _mail_msg_op empty_trash_op = { +- empty_trash_desc, +- empty_trash_empty, +- empty_trash_emptied, +- empty_trash_free, ++static MailMsgInfo empty_trash_info = { ++ sizeof (struct _empty_trash_msg), ++ (MailMsgDescFunc) empty_trash_desc, ++ (MailMsgExecFunc) empty_trash_exec, ++ (MailMsgDoneFunc) empty_trash_done, ++ (MailMsgFreeFunc) empty_trash_free + }; + + void +@@ -1716,20 +1665,20 @@ + { + struct _empty_trash_msg *m; + +- m = mail_msg_new(&empty_trash_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&empty_trash_info); + m->account = account; + if (account) + g_object_ref(account); + m->data = data; + m->done = done; + +- e_thread_put(mail_thread_queued_slow, (EMsg *)m); ++ mail_msg_slow_ordered_push (m); + } + + /* ** GET MESSAGE(s) ***************************************************** */ + + struct _get_message_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelFolder *folder; + char *uid; +@@ -1739,32 +1688,28 @@ + CamelOperation *cancel; + }; + +-static char *get_message_desc(struct _mail_msg *mm, int done) ++static gchar * ++get_message_desc (struct _get_message_msg *m) + { +- struct _get_message_msg *m = (struct _get_message_msg *)mm; +- + return g_strdup_printf(_("Retrieving message %s"), m->uid); + } + +-static void get_message_get(struct _mail_msg *mm) ++static void ++get_message_exec (struct _get_message_msg *m) + { +- struct _get_message_msg *m = (struct _get_message_msg *)mm; +- +- m->message = camel_folder_get_message(m->folder, m->uid, &mm->ex); ++ m->message = camel_folder_get_message(m->folder, m->uid, &m->base.ex); + } + +-static void get_message_got(struct _mail_msg *mm) ++static void ++get_message_done (struct _get_message_msg *m) + { +- struct _get_message_msg *m = (struct _get_message_msg *)mm; +- + if (m->done) + m->done(m->folder, m->uid, m->message, m->data); + } + +-static void get_message_free(struct _mail_msg *mm) ++static void ++get_message_free (struct _get_message_msg *m) + { +- struct _get_message_msg *m = (struct _get_message_msg *)mm; +- + g_free (m->uid); + camel_object_unref (m->folder); + camel_operation_unref (m->cancel); +@@ -1773,21 +1718,22 @@ + camel_object_unref (m->message); + } + +-static struct _mail_msg_op get_message_op = { +- get_message_desc, +- get_message_get, +- get_message_got, +- get_message_free, ++static MailMsgInfo get_message_info = { ++ sizeof (struct _get_message_msg), ++ (MailMsgDescFunc) get_message_desc, ++ (MailMsgExecFunc) get_message_exec, ++ (MailMsgDoneFunc) get_message_done, ++ (MailMsgFreeFunc) get_message_free + }; + + void + mail_get_message(CamelFolder *folder, const char *uid, void (*done) (CamelFolder *folder, const char *uid, + CamelMimeMessage *msg, void *data), +- void *data, EThread *thread) ++ void *data, MailMsgDispatchFunc dispatch) + { + struct _get_message_msg *m; + +- m = mail_msg_new(&get_message_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&get_message_info); + m->folder = folder; + camel_object_ref(folder); + m->uid = g_strdup(uid); +@@ -1795,37 +1741,37 @@ + m->done = done; + m->cancel = camel_operation_new(NULL, NULL); + +- e_thread_put(thread, (EMsg *)m); ++ dispatch (m); + } + + typedef void (*get_done)(CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data, CamelException *); + +-static void get_messagex_got(struct _mail_msg *mm) ++static void ++get_messagex_done (struct _get_message_msg *m) + { +- struct _get_message_msg *m = (struct _get_message_msg *)mm; +- + if (m->done) { + get_done done = (get_done)m->done; +- done(m->folder, m->uid, m->message, m->data, &mm->ex); ++ done(m->folder, m->uid, m->message, m->data, &m->base.ex); + } + } + +-static struct _mail_msg_op get_messagex_op = { +- get_message_desc, +- get_message_get, +- get_messagex_got, +- get_message_free, ++static MailMsgInfo get_messagex_info = { ++ sizeof (struct _get_message_msg), ++ (MailMsgDescFunc) get_message_desc, ++ (MailMsgExecFunc) get_message_exec, ++ (MailMsgDoneFunc) get_messagex_done, ++ (MailMsgFreeFunc) get_message_free + }; + + /* This is temporary, to avoid having to rewrite everything that uses + mail_get_message; it adds an exception argument to the callback */ + void + mail_get_messagex(CamelFolder *folder, const char *uid, void (*done) (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data, CamelException *), +- void *data, EThread *thread) ++ void *data, MailMsgDispatchFunc dispatch) + { + struct _get_message_msg *m; + +- m = mail_msg_new(&get_messagex_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&get_messagex_info); + m->folder = folder; + camel_object_ref(folder); + m->uid = g_strdup(uid); +@@ -1833,13 +1779,13 @@ + m->done = done; + m->cancel = camel_operation_new(NULL, NULL); + +- e_thread_put(thread, (EMsg *)m); ++ dispatch (m); + } + + /* ********************************************************************** */ + + struct _get_messages_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelFolder *folder; + GPtrArray *uids; +@@ -1849,26 +1795,25 @@ + void *data; + }; + +-static char * get_messages_desc(struct _mail_msg *mm, int done) ++static gchar * ++get_messages_desc (struct _get_messages_msg *m) + { +- struct _get_messages_msg *m = (struct _get_messages_msg *)mm; +- + return g_strdup_printf(ngettext("Retrieving %d message", + "Retrieving %d messages", m->uids->len), + m->uids->len); + } + +-static void get_messages_get(struct _mail_msg *mm) ++static void ++get_messages_exec (struct _get_messages_msg *m) + { +- struct _get_messages_msg *m = (struct _get_messages_msg *)mm; + int i; + CamelMimeMessage *message; + + for (i=0; iuids->len; i++) { + int pc = ((i+1) * 100) / m->uids->len; + +- message = camel_folder_get_message(m->folder, m->uids->pdata[i], &mm->ex); +- camel_operation_progress(mm->cancel, pc); ++ message = camel_folder_get_message(m->folder, m->uids->pdata[i], &m->base.ex); ++ camel_operation_progress(m->base.cancel, pc); + if (message == NULL) + break; + +@@ -1876,17 +1821,16 @@ + } + } + +-static void get_messages_got(struct _mail_msg *mm) ++static void ++get_messages_done (struct _get_messages_msg *m) + { +- struct _get_messages_msg *m = (struct _get_messages_msg *)mm; +- + if (m->done) + m->done(m->folder, m->uids, m->messages, m->data); + } + +-static void get_messages_free(struct _mail_msg *mm) ++static void ++get_messages_free (struct _get_messages_msg *m) + { +- struct _get_messages_msg *m = (struct _get_messages_msg *)mm; + int i; + + em_utils_uids_free (m->uids); +@@ -1898,11 +1842,12 @@ + camel_object_unref(m->folder); + } + +-static struct _mail_msg_op get_messages_op = { +- get_messages_desc, +- get_messages_get, +- get_messages_got, +- get_messages_free, ++static MailMsgInfo get_messages_info = { ++ sizeof (struct _get_messages_msg), ++ (MailMsgDescFunc) get_messages_desc, ++ (MailMsgExecFunc) get_messages_exec, ++ (MailMsgDoneFunc) get_messages_done, ++ (MailMsgFreeFunc) get_messages_free + }; + + void +@@ -1912,7 +1857,7 @@ + { + struct _get_messages_msg *m; + +- m = mail_msg_new(&get_messages_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&get_messages_info); + m->folder = folder; + camel_object_ref(folder); + m->uids = uids; +@@ -1920,13 +1865,13 @@ + m->data = data; + m->done = done; + +- e_thread_put(mail_thread_new, (EMsg *)m); ++ mail_msg_unordered_push (m); + } + + /* ** SAVE MESSAGES ******************************************************* */ + + struct _save_messages_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelFolder *folder; + GPtrArray *uids; +@@ -1935,10 +1880,9 @@ + void *data; + }; + +-static char *save_messages_desc(struct _mail_msg *mm, int done) ++static gchar * ++save_messages_desc (struct _save_messages_msg *m) + { +- struct _save_messages_msg *m = (struct _save_messages_msg *)mm; +- + return g_strdup_printf(ngettext("Saving %d message", + "Saving %d messsages", m->uids->len), + m->uids->len); +@@ -1977,9 +1921,8 @@ + } + + static void +-save_messages_save (struct _mail_msg *mm) ++save_messages_exec (struct _save_messages_msg *m) + { +- struct _save_messages_msg *m = (struct _save_messages_msg *)mm; + CamelStreamFilter *filtered_stream; + CamelMimeFilterFrom *from_filter; + CamelStream *stream; +@@ -1996,8 +1939,8 @@ + CamelMimeMessage *message; + int pc = ((i+1) * 100) / m->uids->len; + +- message = camel_folder_get_message(m->folder, m->uids->pdata[i], &mm->ex); +- camel_operation_progress(mm->cancel, pc); ++ message = camel_folder_get_message(m->folder, m->uids->pdata[i], &m->base.ex); ++ camel_operation_progress(m->base.cancel, pc); + if (message == NULL) + break; + +@@ -2009,7 +1952,7 @@ + || camel_stream_flush(stream) == -1 + || camel_data_wrapper_write_to_stream((CamelDataWrapper *)message, (CamelStream *)filtered_stream) == -1 + || camel_stream_flush((CamelStream *)filtered_stream) == -1) { +- camel_exception_setv(&mm->ex, CAMEL_EXCEPTION_SYSTEM, ++ camel_exception_setv(&m->base.ex, CAMEL_EXCEPTION_SYSTEM, + _("Error saving messages to: %s:\n %s"), m->path, strerror(errno)); + g_free(from); + camel_object_unref((CamelObject *)message); +@@ -2023,28 +1966,27 @@ + camel_object_unref(stream); + } + +-static void save_messages_saved(struct _mail_msg *mm) ++static void ++save_messages_done (struct _save_messages_msg *m) + { +- struct _save_messages_msg *m = (struct _save_messages_msg *)mm; +- + if (m->done) + m->done(m->folder, m->uids, m->path, m->data); + } + +-static void save_messages_free(struct _mail_msg *mm) ++static void ++save_messages_free (struct _save_messages_msg *m) + { +- struct _save_messages_msg *m = (struct _save_messages_msg *)mm; +- + em_utils_uids_free (m->uids); + camel_object_unref(m->folder); + g_free(m->path); + } + +-static struct _mail_msg_op save_messages_op = { +- save_messages_desc, +- save_messages_save, +- save_messages_saved, +- save_messages_free, ++static MailMsgInfo save_messages_info = { ++ sizeof (struct _save_messages_msg), ++ (MailMsgDescFunc) save_messages_desc, ++ (MailMsgExecFunc) save_messages_exec, ++ (MailMsgDoneFunc) save_messages_done, ++ (MailMsgFreeFunc) save_messages_free + }; + + int +@@ -2054,7 +1996,7 @@ + struct _save_messages_msg *m; + int id; + +- m = mail_msg_new(&save_messages_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&save_messages_info); + m->folder = folder; + camel_object_ref(folder); + m->uids = uids; +@@ -2062,8 +2004,8 @@ + m->data = data; + m->done = done; + +- id = m->msg.seq; +- e_thread_put(mail_thread_new, (EMsg *)m); ++ id = m->base.seq; ++ mail_msg_unordered_push (m); + + return id; + } +@@ -2071,7 +2013,7 @@ + /* ** SAVE PART ******************************************************* */ + + struct _save_part_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelMimePart *part; + char *path; +@@ -2080,27 +2022,27 @@ + gboolean readonly; + }; + +-static char *save_part_desc(struct _mail_msg *mm, int done) ++static gchar * ++save_part_desc (struct _save_part_msg *m) + { + return g_strdup(_("Saving attachment")); + } + + static void +-save_part_save (struct _mail_msg *mm) ++save_part_exec (struct _save_part_msg *m) + { +- struct _save_part_msg *m = (struct _save_part_msg *)mm; + CamelDataWrapper *content; + CamelStream *stream; + + if(!m->readonly){ + if (!(stream = camel_stream_vfs_new_with_uri (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0644))) { +- camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM, ++ camel_exception_setv (&m->base.ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot create output file: %s:\n %s"), + m->path, g_strerror (errno)); + return; + } + } else if (!(stream = camel_stream_vfs_new_with_uri (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0444))) { +- camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM, ++ camel_exception_setv (&m->base.ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot create output file: %s:\n %s"), + m->path, g_strerror (errno)); + return; +@@ -2110,7 +2052,7 @@ + + if (camel_data_wrapper_decode_to_stream (content, stream) == -1 + || camel_stream_flush (stream) == -1) +- camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM, ++ camel_exception_setv (&m->base.ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not write data: %s"), + g_strerror (errno)); + +@@ -2118,27 +2060,25 @@ + } + + static void +-save_part_saved (struct _mail_msg *mm) ++save_part_done (struct _save_part_msg *m) + { +- struct _save_part_msg *m = (struct _save_part_msg *)mm; +- + if (m->done) +- m->done (m->part, m->path, !camel_exception_is_set (&mm->ex), m->data); ++ m->done (m->part, m->path, !camel_exception_is_set (&m->base.ex), m->data); + } + + static void +-save_part_free (struct _mail_msg *mm) ++save_part_free (struct _save_part_msg *m) + { +- struct _save_part_msg *m = (struct _save_part_msg *)mm; + camel_object_unref (m->part); + g_free (m->path); + } + +-static struct _mail_msg_op save_part_op = { +- save_part_desc, +- save_part_save, +- save_part_saved, +- save_part_free, ++static MailMsgInfo save_part_info = { ++ sizeof (struct _save_part_msg), ++ (MailMsgDescFunc) save_part_desc, ++ (MailMsgExecFunc) save_part_exec, ++ (MailMsgDoneFunc) save_part_done, ++ (MailMsgFreeFunc) save_part_free + }; + + int +@@ -2147,7 +2087,7 @@ + { + struct _save_part_msg *m; + int id; +- m = mail_msg_new (&save_part_op, NULL, sizeof (*m)); ++ m = mail_msg_new (&save_part_info); + m->part = part; + camel_object_ref (part); + m->path = g_strdup (path); +@@ -2155,8 +2095,8 @@ + m->done = done; + m->readonly = readonly; + +- id = m->msg.seq; +- e_thread_put (mail_thread_new, (EMsg *)m); ++ id = m->base.seq; ++ mail_msg_unordered_push (m); + + return id; + } +@@ -2165,7 +2105,7 @@ + /* ** PREPARE OFFLINE ***************************************************** */ + + struct _prep_offline_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelOperation *cancel; + char *uri; +@@ -2173,22 +2113,22 @@ + void *data; + }; + +-static void prep_offline_do(struct _mail_msg *mm) ++static void ++prep_offline_exec (struct _prep_offline_msg *m) + { +- struct _prep_offline_msg *m = (struct _prep_offline_msg *)mm; + CamelFolder *folder; + + if (m->cancel) + camel_operation_register(m->cancel); + +- folder = mail_tool_uri_to_folder(m->uri, 0, &mm->ex); ++ folder = mail_tool_uri_to_folder(m->uri, 0, &m->base.ex); + if (folder) { + if (CAMEL_IS_DISCO_FOLDER(folder)) { + camel_disco_folder_prepare_for_offline((CamelDiscoFolder *)folder, + "(match-all)", +- &mm->ex); ++ &m->base.ex); + } else if (CAMEL_IS_OFFLINE_FOLDER (folder)) { +- camel_offline_folder_downsync ((CamelOfflineFolder *) folder, "(match-all)", &mm->ex); ++ camel_offline_folder_downsync ((CamelOfflineFolder *) folder, "(match-all)", &m->base.ex); + } + /* prepare_for_offline should do this? */ + /* of course it should all be atomic, but ... */ +@@ -2200,28 +2140,27 @@ + camel_operation_unregister(m->cancel); + } + +-static void prep_offline_done(struct _mail_msg *mm) ++static void ++prep_offline_done (struct _prep_offline_msg *m) + { +- struct _prep_offline_msg *m = (struct _prep_offline_msg *)mm; +- + if (m->done) + m->done(m->uri, m->data); + } + +-static void prep_offline_free(struct _mail_msg *mm) ++static void ++prep_offline_free (struct _prep_offline_msg *m) + { +- struct _prep_offline_msg *m = (struct _prep_offline_msg *)mm; +- + if (m->cancel) + camel_operation_unref(m->cancel); + g_free(m->uri); + } + +-static struct _mail_msg_op prep_offline_op = { +- NULL, /* DO NOT CHANGE THIS, IT MUST BE NULL FOR CANCELLATION TO WORK */ +- prep_offline_do, +- prep_offline_done, +- prep_offline_free, ++static MailMsgInfo prep_offline_info = { ++ sizeof (struct _prep_offline_msg), ++ (MailMsgDescFunc) NULL, /* DO NOT CHANGE THIS, IT MUST BE NULL FOR CANCELLATION TO WORK */ ++ (MailMsgExecFunc) prep_offline_exec, ++ (MailMsgDoneFunc) prep_offline_done, ++ (MailMsgFreeFunc) prep_offline_free + }; + + void +@@ -2232,7 +2171,7 @@ + { + struct _prep_offline_msg *m; + +- m = mail_msg_new(&prep_offline_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&prep_offline_info); + m->cancel = cancel; + if (cancel) + camel_operation_ref(cancel); +@@ -2240,13 +2179,13 @@ + m->data = data; + m->done = done; + +- e_thread_put(mail_thread_queued_slow, (EMsg *)m); ++ mail_msg_slow_ordered_push (m); + } + + /* ** GO OFFLINE ***************************************************** */ + + struct _set_offline_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelStore *store; + gboolean offline; +@@ -2254,9 +2193,9 @@ + void *data; + }; + +-static char *set_offline_desc(struct _mail_msg *mm, int done) ++static gchar * ++set_offline_desc (struct _set_offline_msg *m) + { +- struct _set_offline_msg *m = (struct _set_offline_msg *)mm; + char *service_name = camel_service_get_name (CAMEL_SERVICE (m->store), TRUE); + char *msg; + +@@ -2266,61 +2205,59 @@ + return msg; + } + +-static void set_offline_do(struct _mail_msg *mm) ++static void ++set_offline_exec (struct _set_offline_msg *m) + { +- struct _set_offline_msg *m = (struct _set_offline_msg *)mm; +- + if (CAMEL_IS_DISCO_STORE (m->store)) { + if (!m->offline) { + camel_disco_store_set_status (CAMEL_DISCO_STORE (m->store), + CAMEL_DISCO_STORE_ONLINE, +- &mm->ex); ++ &m->base.ex); + return; + } else if (camel_disco_store_can_work_offline (CAMEL_DISCO_STORE (m->store))) { + camel_disco_store_set_status (CAMEL_DISCO_STORE (m->store), + CAMEL_DISCO_STORE_OFFLINE, +- &mm->ex); ++ &m->base.ex); + return; + } + } else if (CAMEL_IS_OFFLINE_STORE (m->store)) { + if (!m->offline) { + camel_offline_store_set_network_state (CAMEL_OFFLINE_STORE (m->store), + CAMEL_OFFLINE_STORE_NETWORK_AVAIL, +- &mm->ex); ++ &m->base.ex); + return; + } else { + camel_offline_store_set_network_state (CAMEL_OFFLINE_STORE (m->store), + CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL, +- &mm->ex); ++ &m->base.ex); + return; + } + } + + if (m->offline) + camel_service_disconnect (CAMEL_SERVICE (m->store), +- TRUE, &mm->ex); ++ TRUE, &m->base.ex); + } + +-static void set_offline_done(struct _mail_msg *mm) ++static void ++set_offline_done (struct _set_offline_msg *m) + { +- struct _set_offline_msg *m = (struct _set_offline_msg *)mm; +- + if (m->done) + m->done(m->store, m->data); + } + +-static void set_offline_free(struct _mail_msg *mm) ++static void ++set_offline_free (struct _set_offline_msg *m) + { +- struct _set_offline_msg *m = (struct _set_offline_msg *)mm; +- + camel_object_unref(m->store); + } + +-static struct _mail_msg_op set_offline_op = { +- set_offline_desc, +- set_offline_do, +- set_offline_done, +- set_offline_free, ++static MailMsgInfo set_offline_info = { ++ sizeof (struct _set_offline_msg), ++ (MailMsgDescFunc) set_offline_desc, ++ (MailMsgExecFunc) set_offline_exec, ++ (MailMsgDoneFunc) set_offline_done, ++ (MailMsgFreeFunc) set_offline_free + }; + + int +@@ -2337,15 +2274,15 @@ + if (offline) + camel_service_cancel_connect (CAMEL_SERVICE (store)); + +- m = mail_msg_new(&set_offline_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&set_offline_info); + m->store = store; + camel_object_ref(store); + m->offline = offline; + m->data = data; + m->done = done; + +- id = m->msg.seq; +- e_thread_put(mail_thread_new, (EMsg *)m); ++ id = m->base.seq; ++ mail_msg_unordered_push (m); + + return id; + } +@@ -2363,7 +2300,7 @@ + + /* Async service-checking/authtype-lookup code. */ + struct _check_msg { +- struct _mail_msg msg; ++ MailMsg base; + + char *url; + CamelProviderType type; +@@ -2373,51 +2310,47 @@ + void *data; + }; + +-static char * +-check_service_describe(struct _mail_msg *mm, int complete) ++static gchar * ++check_service_desc (struct _check_msg *m) + { + return g_strdup(_("Checking Service")); + } + + static void +-check_service_check(struct _mail_msg *mm) ++check_service_exec (struct _check_msg *m) + { +- struct _check_msg *m = (struct _check_msg *)mm; + CamelService *service; + +- service = camel_session_get_service(session, m->url, m->type, &mm->ex); ++ service = camel_session_get_service(session, m->url, m->type, &m->base.ex); + if (!service) { +- camel_operation_unregister(mm->cancel); ++ camel_operation_unregister(m->base.cancel); + return; + } + +- m->authtypes = camel_service_query_auth_types(service, &mm->ex); ++ m->authtypes = camel_service_query_auth_types(service, &m->base.ex); + camel_object_unref(service); + } + + static void +-check_service_done(struct _mail_msg *mm) ++check_service_done (struct _check_msg *m) + { +- struct _check_msg *m = (struct _check_msg *)mm; +- + if (m->done) + m->done(m->url, m->type, m->authtypes, m->data); + } + + static void +-check_service_free(struct _mail_msg *mm) ++check_service_free (struct _check_msg *m) + { +- struct _check_msg *m = (struct _check_msg *)mm; +- + g_free(m->url); + g_list_free(m->authtypes); + } + +-static struct _mail_msg_op check_service_op = { +- check_service_describe, +- check_service_check, +- check_service_done, +- check_service_free, ++static MailMsgInfo check_service_info = { ++ sizeof (struct _check_msg), ++ (MailMsgDescFunc) check_service_desc, ++ (MailMsgExecFunc) check_service_exec, ++ (MailMsgDoneFunc) check_service_done, ++ (MailMsgFreeFunc) check_service_free + }; + + int +@@ -2426,14 +2359,14 @@ + struct _check_msg *m; + int id; + +- m = mail_msg_new (&check_service_op, NULL, sizeof(*m)); ++ m = mail_msg_new (&check_service_info); + m->url = g_strdup(url); + m->type = type; + m->done = done; + m->data = data; + +- id = m->msg.seq; +- e_thread_put(mail_thread_new, (EMsg *)m); ++ id = m->base.seq; ++ mail_msg_unordered_push (m); + + return id; + } +--- evolution-2.10.1/mail/em-folder-utils.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 ++++ evolution-2.10.1/mail/em-folder-utils.c 2007-05-16 16:17:38.000000000 -0400 +@@ -84,7 +84,7 @@ + } + + struct _EMCopyFolders { +- struct _mail_msg msg; ++ MailMsg base; + + /* input data */ + CamelStore *fromstore; +@@ -96,18 +96,15 @@ + int delete; + }; + +-static char * +-emft_copy_folders__desc (struct _mail_msg *mm, int complete) ++static gchar * ++emft_copy_folders__desc (struct _EMCopyFolders *m, gint complete) + { +- struct _EMCopyFolders *m = (struct _EMCopyFolders *) mm; +- + return g_strdup_printf (_("Copying `%s' to `%s'"), m->frombase, m->tobase); + } + + static void +-emft_copy_folders__copy (struct _mail_msg *mm) ++emft_copy_folders__exec (struct _EMCopyFolders *m) + { +- struct _EMCopyFolders *m = (struct _EMCopyFolders *) mm; + guint32 flags = CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; + GList *pending = NULL, *deleting = NULL, *l; + GString *fromname, *toname; +@@ -115,7 +112,7 @@ + const char *tmp; + int fromlen; + +- if (!(fi = camel_store_get_folder_info (m->fromstore, m->frombase, flags, &mm->ex))) ++ if (!(fi = camel_store_get_folder_info (m->fromstore, m->frombase, flags, &m->base.ex))) + return; + + pending = g_list_append (pending, fi); +@@ -155,8 +152,8 @@ + if ((info->flags & CAMEL_FOLDER_NOSELECT) == 0) { + d(printf ("this folder is selectable\n")); + if (m->tostore == m->fromstore && m->delete) { +- camel_store_rename_folder (m->fromstore, info->full_name, toname->str, &mm->ex); +- if (camel_exception_is_set (&mm->ex)) ++ camel_store_rename_folder (m->fromstore, info->full_name, toname->str, &m->base.ex); ++ if (camel_exception_is_set (&m->base.ex)) + goto exception; + + /* this folder no longer exists, unsubscribe it */ +@@ -165,16 +162,16 @@ + + deleted = 1; + } else { +- if (!(fromfolder = camel_store_get_folder (m->fromstore, info->full_name, 0, &mm->ex))) ++ if (!(fromfolder = camel_store_get_folder (m->fromstore, info->full_name, 0, &m->base.ex))) + goto exception; + +- if (!(tofolder = camel_store_get_folder (m->tostore, toname->str, CAMEL_STORE_FOLDER_CREATE, &mm->ex))) { ++ if (!(tofolder = camel_store_get_folder (m->tostore, toname->str, CAMEL_STORE_FOLDER_CREATE, &m->base.ex))) { + camel_object_unref (fromfolder); + goto exception; + } + + uids = camel_folder_get_uids (fromfolder); +- camel_folder_transfer_messages_to (fromfolder, uids, tofolder, NULL, m->delete, &mm->ex); ++ camel_folder_transfer_messages_to (fromfolder, uids, tofolder, NULL, m->delete, &m->base.ex); + camel_folder_free_uids (fromfolder, uids); + + if (m->delete) +@@ -185,7 +182,7 @@ + } + } + +- if (camel_exception_is_set (&mm->ex)) ++ if (camel_exception_is_set (&m->base.ex)) + goto exception; + else if (m->delete && !deleted) + deleting = g_list_prepend (deleting, info); +@@ -226,10 +223,8 @@ + } + + static void +-emft_copy_folders__free (struct _mail_msg *mm) ++emft_copy_folders__free (struct _EMCopyFolders *m) + { +- struct _EMCopyFolders *m = (struct _EMCopyFolders *) mm; +- + camel_object_unref (m->fromstore); + camel_object_unref (m->tostore); + +@@ -237,11 +232,12 @@ + g_free (m->tobase); + } + +-static struct _mail_msg_op copy_folders_op = { +- emft_copy_folders__desc, +- emft_copy_folders__copy, +- NULL, +- emft_copy_folders__free, ++static MailMsgInfo copy_folders_info = { ++ sizeof (struct _EMCopyFolders), ++ (MailMsgDescFunc) emft_copy_folders__desc, ++ (MailMsgExecFunc) emft_copy_folders__exec, ++ (MailMsgDoneFunc) NULL, ++ (MailMsgFreeFunc) emft_copy_folders__free + }; + + int +@@ -250,7 +246,7 @@ + struct _EMCopyFolders *m; + int seq; + +- m = mail_msg_new (©_folders_op, NULL, sizeof (struct _EMCopyFolders)); ++ m = mail_msg_new (©_folders_info); + camel_object_ref (fromstore); + m->fromstore = fromstore; + camel_object_ref (tostore); +@@ -258,9 +254,9 @@ + m->frombase = g_strdup (frombase); + m->tobase = g_strdup (tobase); + m->delete = delete; +- seq = m->msg.seq; ++ seq = m->base.seq; + +- e_thread_put (mail_thread_new, (EMsg *) m); ++ mail_msg_unordered_push (m); + + return seq; + } +@@ -557,7 +553,7 @@ + } + + struct _EMCreateFolder { +- struct _mail_msg msg; ++ MailMsg base; + + /* input data */ + CamelStore *store; +@@ -573,41 +569,33 @@ + void *user_data; + }; + +-static char * +-emfu_create_folder__desc (struct _mail_msg *mm, int done) ++static gchar * ++emfu_create_folder__desc (struct _EMCreateFolder *m) + { +- struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; +- + return g_strdup_printf (_("Creating folder `%s'"), m->full_name); + } + + static void +-emfu_create_folder__create (struct _mail_msg *mm) ++emfu_create_folder__exec (struct _EMCreateFolder *m) + { +- struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; +- + d(printf ("creating folder parent='%s' name='%s' full_name='%s'\n", m->parent, m->name, m->full_name)); + +- if ((m->fi = camel_store_create_folder (m->store, m->parent, m->name, &mm->ex))) { ++ if ((m->fi = camel_store_create_folder (m->store, m->parent, m->name, &m->base.ex))) { + if (camel_store_supports_subscriptions (m->store)) +- camel_store_subscribe_folder (m->store, m->full_name, &mm->ex); ++ camel_store_subscribe_folder (m->store, m->full_name, &m->base.ex); + } + } + + static void +-emfu_create_folder__created (struct _mail_msg *mm) ++emfu_create_folder__done (struct _EMCreateFolder *m) + { +- struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; +- + if (m->done) + m->done (m->fi, m->user_data); + } + + static void +-emfu_create_folder__free (struct _mail_msg *mm) ++emfu_create_folder__free (struct _EMCreateFolder *m) + { +- struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; +- + camel_store_free_folder_info (m->store, m->fi); + camel_object_unref (m->store); + g_free (m->full_name); +@@ -615,11 +603,12 @@ + g_free (m->name); + } + +-static struct _mail_msg_op create_folder_op = { +- emfu_create_folder__desc, +- emfu_create_folder__create, +- emfu_create_folder__created, +- emfu_create_folder__free, ++static MailMsgInfo create_folder_info = { ++ sizeof (struct _EMCreateFolder), ++ (MailMsgDescFunc) emfu_create_folder__desc, ++ (MailMsgExecFunc) emfu_create_folder__exec, ++ (MailMsgDoneFunc) emfu_create_folder__done, ++ (MailMsgFreeFunc) emfu_create_folder__free + }; + + +@@ -640,7 +629,7 @@ + parent = namebuf; + } + +- m = mail_msg_new (&create_folder_op, NULL, sizeof (struct _EMCreateFolder)); ++ m = mail_msg_new (&create_folder_info); + camel_object_ref (store); + m->store = store; + m->full_name = g_strdup (full_name); +@@ -651,8 +640,8 @@ + + g_free (namebuf); + +- id = m->msg.seq; +- e_thread_put (mail_thread_new, (EMsg *) m); ++ id = m->base.seq; ++ mail_msg_unordered_push (m); + + return id; + } +--- evolution-2.10.1/mail/importers/elm-importer.c.kill-ethread 2007-04-09 09:09:26.000000000 -0400 ++++ evolution-2.10.1/mail/importers/elm-importer.c 2007-05-16 16:17:38.000000000 -0400 +@@ -51,7 +51,7 @@ + #define d(x) x + + struct _elm_import_msg { +- struct _mail_msg msg; ++ MailMsg base; + + EImport *import; + EImportTargetHome *target; +@@ -186,8 +186,8 @@ + return mailexists; + } + +-static char * +-elm_import_describe (struct _mail_msg *mm, int complete) ++static gchar * ++elm_import_desc (struct _elm_import_msg *m) + { + return g_strdup (_("Importing Elm data")); + } +@@ -198,9 +198,8 @@ + }; + + static void +-elm_import_import(struct _mail_msg *mm) ++elm_import_exec (struct _elm_import_msg *m) + { +- struct _elm_import_msg *m = (struct _elm_import_msg *) mm; + const char *maildir; + char *elmdir; + +@@ -218,13 +217,11 @@ + } + + static void +-elm_import_imported(struct _mail_msg *mm) ++elm_import_done(struct _elm_import_msg *m) + { +- struct _elm_import_msg *m = (struct _elm_import_msg *)mm; +- + printf("importing complete\n"); + +- if (!camel_exception_is_set(&mm->ex)) { ++ if (!camel_exception_is_set(&m->base.ex)) { + GConfClient *gconf; + + gconf = gconf_client_get_default(); +@@ -236,10 +233,8 @@ + } + + static void +-elm_import_free(struct _mail_msg *mm) ++elm_import_free(struct _elm_import_msg *m) + { +- struct _elm_import_msg *m = (struct _elm_import_msg *)mm; +- + camel_operation_unref(m->status); + + g_free(m->status_what); +@@ -288,11 +283,12 @@ + return TRUE; + } + +-static struct _mail_msg_op elm_import_op = { +- elm_import_describe, +- elm_import_import, +- elm_import_imported, +- elm_import_free, ++static MailMsgInfo elm_import_info = { ++ sizeof (struct _elm_import_msg), ++ (MailMsgDescFunc) elm_import_desc, ++ (MailMsgExecFunc) elm_import_exec, ++ (MailMsgDoneFunc) elm_import_done, ++ (MailMsgFreeFunc) elm_import_free + }; + + static int +@@ -301,7 +297,7 @@ + struct _elm_import_msg *m; + int id; + +- m = mail_msg_new(&elm_import_op, NULL, sizeof (*m)); ++ m = mail_msg_new(&elm_import_info); + g_datalist_set_data(&target->data, "elm-msg", m); + m->import = ei; + g_object_ref(m->import); +@@ -310,9 +306,9 @@ + m->status_lock = g_mutex_new(); + m->status = camel_operation_new(elm_status, m); + +- id = m->msg.seq; ++ id = m->base.seq; + +- e_thread_put(mail_thread_queued, (EMsg *)m); ++ mail_msg_fast_ordered_push (m); + + return id; + } +--- evolution-2.10.1/mail/importers/mail-importer.c.kill-ethread 2007-04-09 09:09:26.000000000 -0400 ++++ evolution-2.10.1/mail/importers/mail-importer.c 2007-05-16 16:17:38.000000000 -0400 +@@ -132,7 +132,7 @@ + } + + struct _import_mbox_msg { +- struct _mail_msg msg; ++ MailMsg base; + + char *path; + char *uri; +@@ -142,8 +142,8 @@ + void *done_data; + }; + +-static char * +-import_mbox_describe(struct _mail_msg *mm, int complete) ++static gchar * ++import_mbox_desc (struct _import_mbox_msg *m) + { + return g_strdup (_("Importing mailbox")); + } +@@ -190,9 +190,8 @@ + } + + static void +-import_mbox_import(struct _mail_msg *mm) ++import_mbox_exec (struct _import_mbox_msg *m) + { +- struct _import_mbox_msg *m = (struct _import_mbox_msg *) mm; + CamelFolder *folder; + CamelMimeParser *mp = NULL; + struct stat st; +@@ -207,7 +206,7 @@ + if (m->uri == NULL || m->uri[0] == 0) + folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_INBOX); + else +- folder = mail_tool_uri_to_folder(m->uri, CAMEL_STORE_FOLDER_CREATE, &mm->ex); ++ folder = mail_tool_uri_to_folder(m->uri, CAMEL_STORE_FOLDER_CREATE, &m->base.ex); + + if (folder == NULL) + return; +@@ -262,11 +261,11 @@ + flags |= decode_status(tmp); + + camel_message_info_set_flags(info, flags, ~0); +- camel_folder_append_message(folder, msg, info, NULL, &mm->ex); ++ camel_folder_append_message(folder, msg, info, NULL, &m->base.ex); + camel_message_info_free(info); + camel_object_unref(msg); + +- if (camel_exception_is_set(&mm->ex)) ++ if (camel_exception_is_set(&m->base.ex)) + break; + + camel_mime_parser_step(mp, 0, 0); +@@ -286,30 +285,27 @@ + } + + static void +-import_mbox_done(struct _mail_msg *mm) ++import_mbox_done (struct _import_mbox_msg *m) + { +- struct _import_mbox_msg *m = (struct _import_mbox_msg *)mm; +- + if (m->done) +- m->done(m->done_data, &mm->ex); ++ m->done(m->done_data, &m->base.ex); + } + + static void +-import_mbox_free (struct _mail_msg *mm) ++import_mbox_free (struct _import_mbox_msg *m) + { +- struct _import_mbox_msg *m = (struct _import_mbox_msg *)mm; +- + if (m->cancel) + camel_operation_unref(m->cancel); + g_free(m->uri); + g_free(m->path); + } + +-static struct _mail_msg_op import_mbox_op = { +- import_mbox_describe, +- import_mbox_import, +- import_mbox_done, +- import_mbox_free, ++static MailMsgInfo import_mbox_info = { ++ sizeof (struct _import_mbox_msg), ++ (MailMsgDescFunc) import_mbox_desc, ++ (MailMsgExecFunc) import_mbox_exec, ++ (MailMsgDoneFunc) import_mbox_done, ++ (MailMsgFreeFunc) import_mbox_free + }; + + int +@@ -318,7 +314,7 @@ + struct _import_mbox_msg *m; + int id; + +- m = mail_msg_new(&import_mbox_op, NULL, sizeof (*m)); ++ m = mail_msg_new(&import_mbox_info); + m->path = g_strdup(path); + m->uri = g_strdup(folderuri); + m->done = done; +@@ -328,8 +324,8 @@ + camel_operation_ref(cancel); + } + +- id = m->msg.seq; +- e_thread_put(mail_thread_queued, (EMsg *)m); ++ id = m->base.seq; ++ mail_msg_fast_ordered_push (m); + + return id; + } +@@ -339,7 +335,7 @@ + { + struct _import_mbox_msg *m; + +- m = mail_msg_new(&import_mbox_op, NULL, sizeof (*m)); ++ m = mail_msg_new(&import_mbox_info); + m->path = g_strdup(path); + m->uri = g_strdup(folderuri); + if (cancel) { +@@ -347,9 +343,9 @@ + camel_operation_ref(cancel); + } + +- import_mbox_import(&m->msg); +- import_mbox_done(&m->msg); +- mail_msg_free(&m->msg); ++ import_mbox_exec(&m->base); ++ import_mbox_done(&m->base); ++ mail_msg_unref(m); + } + + struct _import_folders_data { +--- evolution-2.10.1/mail/importers/pine-importer.c.kill-ethread 2007-04-09 09:09:26.000000000 -0400 ++++ evolution-2.10.1/mail/importers/pine-importer.c 2007-05-16 16:17:38.000000000 -0400 +@@ -56,7 +56,7 @@ + #define d(x) x + + struct _pine_import_msg { +- struct _mail_msg msg; ++ MailMsg base; + + EImport *import; + EImportTarget *target; +@@ -223,8 +223,8 @@ + g_object_unref(book); + } + +-static char * +-pine_import_describe (struct _mail_msg *mm, int complete) ++static gchar * ++pine_import_desc (struct _pine_import_msg *m) + { + return g_strdup (_("Importing Pine data")); + } +@@ -236,10 +236,8 @@ + }; + + static void +-pine_import_import(struct _mail_msg *mm) ++pine_import_exec(struct _pine_import_msg *m) + { +- struct _pine_import_msg *m = (struct _pine_import_msg *) mm; +- + if (GPOINTER_TO_INT(g_datalist_get_data(&m->target->data, "pine-do-addr"))) + import_contacts(); + +@@ -253,13 +251,11 @@ + } + + static void +-pine_import_imported(struct _mail_msg *mm) ++pine_import_done(struct _pine_import_msg *m) + { +- struct _pine_import_msg *m = (struct _pine_import_msg *)mm; +- + printf("importing complete\n"); + +- if (!camel_exception_is_set(&mm->ex)) { ++ if (!camel_exception_is_set(&m->base.ex)) { + GConfClient *gconf; + + gconf = gconf_client_get_default(); +@@ -274,10 +270,8 @@ + } + + static void +-pine_import_free(struct _mail_msg *mm) ++pine_import_free(struct _pine_import_msg *m) + { +- struct _pine_import_msg *m = (struct _pine_import_msg *)mm; +- + camel_operation_unref(m->status); + + g_free(m->status_what); +@@ -326,11 +320,12 @@ + return TRUE; + } + +-static struct _mail_msg_op pine_import_op = { +- pine_import_describe, +- pine_import_import, +- pine_import_imported, +- pine_import_free, ++static MailMsgInfo pine_import_info = { ++ sizeof (struct _pine_import_msg), ++ (MailMsgDescFunc) pine_import_desc, ++ (MailMsgExecFunc) pine_import_exec, ++ (MailMsgDoneFunc) pine_import_done, ++ (MailMsgFreeFunc) pine_import_free + }; + + static int +@@ -339,7 +334,7 @@ + struct _pine_import_msg *m; + int id; + +- m = mail_msg_new(&pine_import_op, NULL, sizeof (*m)); ++ m = mail_msg_new(&pine_import_info); + g_datalist_set_data(&target->data, "pine-msg", m); + m->import = ei; + g_object_ref(m->import); +@@ -348,9 +343,9 @@ + m->status_lock = g_mutex_new(); + m->status = camel_operation_new(pine_status, m); + +- id = m->msg.seq; ++ id = m->base.seq; - id = m->msg.seq; -- e_thread_put (mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); +- e_thread_put(mail_thread_queued, (EMsg *)m); ++ mail_msg_fast_ordered_push (m); + + return id; + } +--- evolution-2.10.1/mail/mail-vfolder.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 ++++ evolution-2.10.1/mail/mail-vfolder.c 2007-05-16 16:17:38.000000000 -0400 +@@ -21,7 +21,7 @@ + */ + + #include +- ++#include + #include + + #include +@@ -75,7 +75,7 @@ + /* ********************************************************************** */ + + struct _setup_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelFolder *folder; + char *query; +@@ -83,18 +83,15 @@ + GList *sources_folder; + }; + +-static char * +-vfolder_setup_desc(struct _mail_msg *mm, int done) ++static gchar * ++vfolder_setup_desc (struct _setup_msg *m) + { +- struct _setup_msg *m = (struct _setup_msg *)mm; +- + return g_strdup_printf(_("Setting up Search Folder: %s"), m->folder->full_name); + } + + static void +-vfolder_setup_do(struct _mail_msg *mm) ++vfolder_setup_exec (struct _setup_msg *m) + { +- struct _setup_msg *m = (struct _setup_msg *)mm; + GList *l, *list = NULL; + CamelFolder *folder; + +@@ -105,12 +102,12 @@ + l = m->sources_uri; + while (l && !shutdown) { + d(printf(" Adding uri: %s\n", (char *)l->data)); +- folder = mail_tool_uri_to_folder (l->data, 0, &mm->ex); ++ folder = mail_tool_uri_to_folder (l->data, 0, &m->base.ex); + if (folder) { + list = g_list_append(list, folder); + } else { + g_warning("Could not open vfolder source: %s", (char *)l->data); +- camel_exception_clear(&mm->ex); ++ camel_exception_clear(&m->base.ex); + } + l = l->next; + } +@@ -135,17 +132,13 @@ + } + + static void +-vfolder_setup_done(struct _mail_msg *mm) ++vfolder_setup_done (struct _setup_msg *m) + { +- struct _setup_msg *m = (struct _setup_msg *)mm; +- +- m = m; + } + + static void +-vfolder_setup_free (struct _mail_msg *mm) ++vfolder_setup_free (struct _setup_msg *m) + { +- struct _setup_msg *m = (struct _setup_msg *)mm; + GList *l; + + camel_object_unref(m->folder); +@@ -166,11 +159,12 @@ + g_list_free(m->sources_folder); + } + +-static struct _mail_msg_op vfolder_setup_op = { +- vfolder_setup_desc, +- vfolder_setup_do, +- vfolder_setup_done, +- vfolder_setup_free, ++static MailMsgInfo vfolder_setup_info = { ++ sizeof (struct _setup_msg), ++ (MailMsgDescFunc) vfolder_setup_desc, ++ (MailMsgExecFunc) vfolder_setup_exec, ++ (MailMsgDoneFunc) vfolder_setup_done, ++ (MailMsgFreeFunc) vfolder_setup_free + }; + + /* sources_uri should be camel uri's */ +@@ -180,15 +174,15 @@ + struct _setup_msg *m; + int id; + +- m = mail_msg_new(&vfolder_setup_op, NULL, sizeof (*m)); ++ m = mail_msg_new(&vfolder_setup_info); + m->folder = folder; + camel_object_ref(folder); + m->query = g_strdup(query); + m->sources_uri = sources_uri; + m->sources_folder = sources_folder; + +- id = m->msg.seq; +- e_thread_put(mail_thread_queued_slow, (EMsg *)m); ++ id = m->base.seq; ++ mail_msg_slow_ordered_push (m); + + return id; + } +@@ -196,17 +190,16 @@ + /* ********************************************************************** */ + + struct _adduri_msg { +- struct _mail_msg msg; ++ MailMsg base; + + char *uri; + GList *folders; + int remove; + }; + +-static char * +-vfolder_adduri_desc(struct _mail_msg *mm, int done) ++static gchar * ++vfolder_adduri_desc (struct _adduri_msg *m) + { +- struct _adduri_msg *m = (struct _adduri_msg *)mm; + char *euri, *desc = NULL; + + /* Yuck yuck. Lookup the account name and use that to describe the path */ +@@ -250,9 +243,8 @@ + } + + static void +-vfolder_adduri_do(struct _mail_msg *mm) ++vfolder_adduri_exec (struct _adduri_msg *m) + { +- struct _adduri_msg *m = (struct _adduri_msg *)mm; + GList *l; + CamelFolder *folder = NULL; + +@@ -269,7 +261,7 @@ + } + + if (folder == NULL) +- folder = mail_tool_uri_to_folder (m->uri, 0, &mm->ex); ++ folder = mail_tool_uri_to_folder (m->uri, 0, &m->base.ex); + + if (folder != NULL) { + l = m->folders; +@@ -285,28 +277,24 @@ + } + + static void +-vfolder_adduri_done(struct _mail_msg *mm) ++vfolder_adduri_done(struct _adduri_msg *m) + { +- struct _adduri_msg *m = (struct _adduri_msg *)mm; +- +- m = m; + } + + static void +-vfolder_adduri_free (struct _mail_msg *mm) ++vfolder_adduri_free (struct _adduri_msg *m) + { +- struct _adduri_msg *m = (struct _adduri_msg *)mm; +- + g_list_foreach(m->folders, (GFunc)camel_object_unref, NULL); + g_list_free(m->folders); + g_free(m->uri); + } + +-static struct _mail_msg_op vfolder_adduri_op = { +- vfolder_adduri_desc, +- vfolder_adduri_do, +- vfolder_adduri_done, +- vfolder_adduri_free, ++static MailMsgInfo vfolder_adduri_info = { ++ sizeof (struct _adduri_msg), ++ (MailMsgDescFunc) vfolder_adduri_desc, ++ (MailMsgExecFunc) vfolder_adduri_exec, ++ (MailMsgDoneFunc) vfolder_adduri_done, ++ (MailMsgFreeFunc) vfolder_adduri_free + }; + + +@@ -317,13 +305,13 @@ + struct _adduri_msg *m; + int id; + +- m = mail_msg_new(&vfolder_adduri_op, NULL, sizeof (*m)); ++ m = mail_msg_new(&vfolder_adduri_info); + m->folders = folders; + m->uri = g_strdup(uri); + m->remove = remove; +- id = m->msg.seq; +- e_thread_put(mail_thread_queued_slow, (EMsg *)m); ++ id = m->base.seq; ++ mail_msg_slow_ordered_push (m); + return id; } -@@ -2240,7 +2240,7 @@ - m->data = data; - m->done = done; +@@ -447,7 +435,7 @@ + return; + } + +- g_assert(pthread_equal(pthread_self(), mail_gui_thread)); ++ g_assert(mail_in_main_thread()); + + is_ignore = uri_is_ignore(store, curi); + +@@ -540,7 +528,7 @@ + + d(printf ("Deleting uri to check: %s\n", uri)); + +- g_assert (pthread_equal(pthread_self(), mail_gui_thread)); ++ g_assert (mail_in_main_thread()); + + changed = g_string_new (""); + +@@ -615,7 +603,7 @@ + if (context == NULL || uri_is_spethal(store, cfrom) || uri_is_spethal(store, cto)) + return; + +- g_assert(pthread_equal(pthread_self(), mail_gui_thread)); ++ g_assert(mail_in_main_thread()); + + from = em_uri_from_camel(cfrom); + to = em_uri_from_camel(cto); +--- evolution-2.10.1/mail/em-format-html.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 ++++ evolution-2.10.1/mail/em-format-html.c 2007-05-16 16:17:38.000000000 -0400 +@@ -166,7 +166,7 @@ + if (efh->priv->format_timeout_id != 0) { + g_source_remove(efh->priv->format_timeout_id); + efh->priv->format_timeout_id = 0; +- mail_msg_free(efh->priv->format_timeout_msg); ++ mail_msg_unref(efh->priv->format_timeout_msg); + efh->priv->format_timeout_msg = NULL; + } + +@@ -1180,7 +1180,7 @@ + + /* Sigh, this is so we have a cancellable, async rendering thread */ + struct _format_msg { +- struct _mail_msg msg; ++ MailMsg base; + + EMFormatHTML *format; + EMFormat *format_source; +@@ -1190,14 +1190,15 @@ + CamelMimeMessage *message; + }; + +-static char *efh_format_desc(struct _mail_msg *mm, int done) ++static gchar * ++efh_format_desc (struct _format_msg *m) + { + return g_strdup(_("Formatting message")); + } + +-static void efh_format_do(struct _mail_msg *mm) ++static void ++efh_format_exec (struct _format_msg *m) + { +- struct _format_msg *m = (struct _format_msg *)mm; + struct _EMFormatHTMLJob *job; + struct _EMFormatPURITree *puri_level; + int cancelled = FALSE; +@@ -1282,10 +1283,9 @@ + ((EMFormat *)m->format)->pending_uri_level = puri_level; + } + +-static void efh_format_done(struct _mail_msg *mm) ++static void ++efh_format_done (struct _format_msg *m) + { +- struct _format_msg *m = (struct _format_msg *)mm; +- + d(printf("formatting finished\n")); + + m->format->load_http_now = FALSE; +@@ -1293,10 +1293,9 @@ + g_signal_emit_by_name(m->format, "complete"); + } + +-static void efh_format_free(struct _mail_msg *mm) ++static void ++efh_format_free (struct _format_msg *m) + { +- struct _format_msg *m = (struct _format_msg *)mm; +- + d(printf("formatter freed\n")); + g_object_unref(m->format); + if (m->estream) { +@@ -1312,11 +1311,12 @@ + g_object_unref(m->format_source); + } + +-static struct _mail_msg_op efh_format_op = { +- efh_format_desc, +- efh_format_do, +- efh_format_done, +- efh_format_free, ++static MailMsgInfo efh_format_info = { ++ sizeof (struct _format_msg), ++ (MailMsgDescFunc) efh_format_desc, ++ (MailMsgExecFunc) efh_format_exec, ++ (MailMsgDoneFunc) efh_format_done, ++ (MailMsgFreeFunc) efh_format_free + }; + + static gboolean +@@ -1327,7 +1327,7 @@ + struct _EMFormatHTMLPrivate *p = efh->priv; + + if (m->format->html == NULL) { +- mail_msg_free(m); ++ mail_msg_unref(m); + return FALSE; + } + +@@ -1355,7 +1355,7 @@ + if (m->message == NULL) { + hstream = gtk_html_begin(efh->html); + gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK); +- mail_msg_free(m); ++ mail_msg_unref(m); + p->last_part = NULL; + } else { + hstream = NULL; +@@ -1374,8 +1374,8 @@ + p->last_part = m->message; + } + +- efh->priv->format_id = m->msg.seq; +- e_thread_put(mail_thread_new, (EMsg *)m); ++ efh->priv->format_id = m->base.seq; ++ mail_msg_unordered_push (m); + } + + efh->priv->format_timeout_id = 0; +@@ -1399,11 +1399,11 @@ + d(printf(" timeout for last still active, removing ...\n")); + g_source_remove(efh->priv->format_timeout_id); + efh->priv->format_timeout_id = 0; +- mail_msg_free(efh->priv->format_timeout_msg); ++ mail_msg_unref(efh->priv->format_timeout_msg); + efh->priv->format_timeout_msg = NULL; + } + +- m = mail_msg_new(&efh_format_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&efh_format_info); + m->format = (EMFormatHTML *)emf; + g_object_ref(emf); + m->format_source = emfsource; +--- evolution-2.10.1/mail/em-folder-properties.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 ++++ evolution-2.10.1/mail/em-folder-properties.c 2007-05-16 16:17:38.000000000 -0400 +@@ -386,7 +386,7 @@ + } + + if (folder == NULL) +- mail_get_folder(uri, 0, emfp_dialog_got_folder, NULL, mail_thread_new); ++ mail_get_folder(uri, 0, emfp_dialog_got_folder, NULL, mail_msg_unordered_push); + else + emfp_dialog_got_folder((char *)uri, folder, NULL); + } +--- evolution-2.10.1/mail/em-folder-tree.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 ++++ evolution-2.10.1/mail/em-folder-tree.c 2007-05-16 16:17:38.000000000 -0400 +@@ -834,7 +834,7 @@ + /* TODO: Merge the drop handling code/menu's into one spot using a popup target for details */ + /* Drop handling */ + struct _DragDataReceivedAsync { +- struct _mail_msg msg; ++ MailMsg base; + + /* input data */ + GdkDragContext *context; +@@ -859,17 +859,16 @@ + + d(printf(" * Drop folder '%s' onto '%s'\n", m->selection->data, m->full_name)); + +- if (!(src = mail_tool_uri_to_folder(m->selection->data, 0, &m->msg.ex))) ++ if (!(src = mail_tool_uri_to_folder(m->selection->data, 0, &m->base.ex))) + return; + + em_folder_utils_copy_folders(src->parent_store, src->full_name, m->store, m->full_name?m->full_name:"", m->move); + camel_object_unref(src); + } + +-static char * +-emft_drop_async_desc (struct _mail_msg *mm, int done) ++static gchar * ++emft_drop_async__desc (struct _DragDataReceivedAsync *m) + { +- struct _DragDataReceivedAsync *m = (struct _DragDataReceivedAsync *) mm; + CamelURL *url; + char *buf; + +@@ -893,9 +892,8 @@ + } + + static void +-emft_drop_async_drop (struct _mail_msg *mm) ++emft_drop_async__exec (struct _DragDataReceivedAsync *m) + { +- struct _DragDataReceivedAsync *m = (struct _DragDataReceivedAsync *) mm; + CamelFolder *folder; + + /* for types other than folder, we can't drop to the root path */ +@@ -903,14 +901,14 @@ + /* copy or move (aka rename) a folder */ + emft_drop_folder(m); + } else if (m->full_name == NULL) { +- camel_exception_set (&mm->ex, CAMEL_EXCEPTION_SYSTEM, ++ camel_exception_set (&m->base.ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot drop message(s) into toplevel store")); +- } else if ((folder = camel_store_get_folder (m->store, m->full_name, 0, &mm->ex))) { ++ } else if ((folder = camel_store_get_folder (m->store, m->full_name, 0, &m->base.ex))) { + switch (m->info) { + case DND_DROP_TYPE_UID_LIST: + /* import a list of uids from another evo folder */ +- em_utils_selection_get_uidlist(m->selection, folder, m->move, &mm->ex); +- m->moved = m->move && !camel_exception_is_set(&mm->ex); ++ em_utils_selection_get_uidlist(m->selection, folder, m->move, &m->base.ex); ++ m->moved = m->move && !camel_exception_is_set(&m->base.ex); + break; + case DND_DROP_TYPE_MESSAGE_RFC822: + /* import a message/rfc822 stream */ +@@ -928,9 +926,8 @@ + } + + static void +-emft_drop_async_done (struct _mail_msg *mm) ++emft_drop_async__done (struct _DragDataReceivedAsync *m) + { +- struct _DragDataReceivedAsync *m = (struct _DragDataReceivedAsync *) mm; + gboolean success, delete; + + /* ?? */ +@@ -938,7 +935,7 @@ + success = FALSE; + delete = FALSE; + } else { +- success = !camel_exception_is_set (&mm->ex); ++ success = !camel_exception_is_set (&m->base.ex); + delete = success && m->move && !m->moved; + } + +@@ -946,10 +943,8 @@ + } + + static void +-emft_drop_async_free (struct _mail_msg *mm) ++emft_drop_async__free (struct _DragDataReceivedAsync *m) + { +- struct _DragDataReceivedAsync *m = (struct _DragDataReceivedAsync *) mm; +- + g_object_unref(m->context); + camel_object_unref(m->store); + g_free(m->full_name); +@@ -958,18 +953,19 @@ + g_free(m->selection); + } + +-static struct _mail_msg_op emft_drop_async_op = { +- emft_drop_async_desc, +- emft_drop_async_drop, +- emft_drop_async_done, +- emft_drop_async_free, ++static MailMsgInfo emft_drop_async_info = { ++ sizeof (struct _DragDataReceivedAsync), ++ (MailMsgDescFunc) emft_drop_async__desc, ++ (MailMsgExecFunc) emft_drop_async__exec, ++ (MailMsgDoneFunc) emft_drop_async__done, ++ (MailMsgFreeFunc) emft_drop_async__free + }; + + static void + tree_drag_data_action(struct _DragDataReceivedAsync *m) + { + m->move = m->action == GDK_ACTION_MOVE; +- e_thread_put (mail_thread_new, (EMsg *) m); ++ mail_msg_unordered_push (m); + } + + static void +@@ -996,7 +992,7 @@ + struct _DragDataReceivedAsync *m = data; + + m->aborted = TRUE; +- mail_msg_free(&m->msg); ++ mail_msg_unref(m); + } + + static EPopupItem emft_drop_popup_menu[] = { +@@ -1052,7 +1048,7 @@ + return; + } + +- m = mail_msg_new (&emft_drop_async_op, NULL, sizeof (struct _DragDataReceivedAsync)); ++ m = mail_msg_new (&emft_drop_async_info); + m->context = context; + g_object_ref(context); + m->store = store; +@@ -1686,7 +1682,7 @@ + #endif + + struct _EMFolderTreeGetFolderInfo { +- struct _mail_msg msg; ++ MailMsg base; + + /* input data */ + GtkTreeRowReference *root; +@@ -1699,10 +1695,9 @@ + CamelFolderInfo *fi; + }; + +-static char * +-emft_get_folder_info__desc(struct _mail_msg *mm, int done) ++static gchar * ++emft_get_folder_info__desc (struct _EMFolderTreeGetFolderInfo *m) + { +- struct _EMFolderTreeGetFolderInfo *m = (struct _EMFolderTreeGetFolderInfo *)mm; + char *ret, *name; + + name = camel_service_get_name((CamelService *)m->store, TRUE); +@@ -1712,18 +1707,16 @@ + } + + static void +-emft_get_folder_info__get (struct _mail_msg *mm) ++emft_get_folder_info__exec (struct _EMFolderTreeGetFolderInfo *m) + { +- struct _EMFolderTreeGetFolderInfo *m = (struct _EMFolderTreeGetFolderInfo *) mm; + guint32 flags = m->flags | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; + +- m->fi = camel_store_get_folder_info (m->store, m->top, flags, &mm->ex); ++ m->fi = camel_store_get_folder_info (m->store, m->top, flags, &m->base.ex); + } + + static void +-emft_get_folder_info__got (struct _mail_msg *mm) ++emft_get_folder_info__done (struct _EMFolderTreeGetFolderInfo *m) + { +- struct _EMFolderTreeGetFolderInfo *m = (struct _EMFolderTreeGetFolderInfo *) mm; + struct _EMFolderTreePrivate *priv = m->emft->priv; + struct _EMFolderTreeModelStoreInfo *si; + GtkTreeIter root, iter; +@@ -1751,7 +1744,7 @@ + gtk_tree_model_get_iter ((GtkTreeModel *) model, &root, path); + + /* if we had an error, then we need to re-set the load subdirs state and collapse the node */ +- if (!m->fi && camel_exception_is_set(&mm->ex)) { ++ if (!m->fi && camel_exception_is_set(&m->base.ex)) { + gtk_tree_store_set(model, &root, COL_BOOL_LOAD_SUBDIRS, TRUE, -1); + gtk_tree_view_collapse_row (priv->treeview, path); + gtk_tree_path_free (path); +@@ -1806,10 +1799,8 @@ + } + + static void +-emft_get_folder_info__free (struct _mail_msg *mm) ++emft_get_folder_info__free (struct _EMFolderTreeGetFolderInfo *m) + { +- struct _EMFolderTreeGetFolderInfo *m = (struct _EMFolderTreeGetFolderInfo *) mm; +- + camel_store_free_folder_info (m->store, m->fi); + + gtk_tree_row_reference_free (m->root); +@@ -1818,11 +1809,12 @@ + g_free (m->top); + } + +-static struct _mail_msg_op get_folder_info_op = { +- emft_get_folder_info__desc, +- emft_get_folder_info__get, +- emft_get_folder_info__got, +- emft_get_folder_info__free, ++static MailMsgInfo get_folder_info_info = { ++ sizeof (struct _EMFolderTreeGetFolderInfo), ++ (MailMsgDescFunc) emft_get_folder_info__desc, ++ (MailMsgExecFunc) emft_get_folder_info__exec, ++ (MailMsgDoneFunc) emft_get_folder_info__done, ++ (MailMsgFreeFunc) emft_get_folder_info__free + }; + + static void +@@ -1906,7 +1898,7 @@ + + gtk_tree_store_set((GtkTreeStore *)model, root, COL_BOOL_LOAD_SUBDIRS, FALSE, -1); + +- m = mail_msg_new (&get_folder_info_op, NULL, sizeof (struct _EMFolderTreeGetFolderInfo)); ++ m = mail_msg_new (&get_folder_info_info); + m->root = gtk_tree_row_reference_new (model, tree_path); + camel_object_ref (store); + m->store = store; +@@ -1915,7 +1907,7 @@ + m->top = full_name; + m->flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST; + +- e_thread_put (mail_thread_new, (EMsg *) m); ++ mail_msg_unordered_push (m); + } + + static gboolean +--- evolution-2.10.1/mail/em-folder-browser.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 ++++ evolution-2.10.1/mail/em-folder-browser.c 2007-05-16 16:17:38.000000000 -0400 +@@ -838,7 +838,7 @@ + + + struct _setup_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelFolder *folder; + char *query; +@@ -846,16 +846,15 @@ + GList *sources_folder; + }; + +-static char * +-vfolder_setup_desc(struct _mail_msg *mm, int done) ++static gchar * ++vfolder_setup_desc(struct _setup_msg *m) + { + return g_strdup(_("Searching")); + } -- e_thread_put(mail_thread_queued_slow, (EMsg *)m); -+ mail_msg_slow_ordered_push ((mail_msg_t *) m); + static void +-vfolder_setup_do(struct _mail_msg *mm) ++vfolder_setup_exec(struct _setup_msg *m) + { +- struct _setup_msg *m = (struct _setup_msg *)mm; + GList *l, *list = NULL; + CamelFolder *folder; + +@@ -866,12 +865,12 @@ + l = m->sources_uri; + while (l) { + d(printf(" Adding uri: %s\n", (char *)l->data)); +- folder = mail_tool_uri_to_folder (l->data, 0, &mm->ex); ++ folder = mail_tool_uri_to_folder (l->data, 0, &m->base.ex); + if (folder) { + list = g_list_append(list, folder); + } else { + g_warning("Could not open vfolder source: %s", (char *)l->data); +- camel_exception_clear(&mm->ex); ++ camel_exception_clear(&m->base.ex); + } + l = l->next; + } +@@ -895,17 +894,13 @@ } - /* ** GO OFFLINE ***************************************************** */ -@@ -2345,7 +2345,7 @@ - m->done = done; + static void +-vfolder_setup_done(struct _mail_msg *mm) ++vfolder_setup_done(struct _setup_msg *m) + { +- struct _setup_msg *m = (struct _setup_msg *)mm; +- +- m = m; + } - id = m->msg.seq; -- e_thread_put(mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); + static void +-vfolder_setup_free (struct _mail_msg *mm) ++vfolder_setup_free (struct _setup_msg *m) + { +- struct _setup_msg *m = (struct _setup_msg *)mm; + GList *l; - return id; + camel_object_unref(m->folder); +@@ -926,11 +921,12 @@ + g_list_free(m->sources_folder); } -@@ -2433,7 +2433,7 @@ - m->data = data; + +-static struct _mail_msg_op vfolder_setup_op = { +- vfolder_setup_desc, +- vfolder_setup_do, +- vfolder_setup_done, +- vfolder_setup_free, ++static MailMsgInfo vfolder_setup_info = { ++ sizeof (struct _setup_msg), ++ (MailMsgDescFunc) vfolder_setup_desc, ++ (MailMsgExecFunc) vfolder_setup_exec, ++ (MailMsgDoneFunc) vfolder_setup_done, ++ (MailMsgFreeFunc) vfolder_setup_free + }; + + /* sources_uri should be camel uri's */ +@@ -940,15 +936,15 @@ + struct _setup_msg *m; + int id; - id = m->msg.seq; -- e_thread_put(mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); +- m = mail_msg_new(&vfolder_setup_op, NULL, sizeof (*m)); ++ m = mail_msg_new(&vfolder_setup_info); + m->folder = folder; + camel_object_ref(folder); + m->query = g_strdup(query); + m->sources_uri = sources_uri; + m->sources_folder = sources_folder; + +- id = m->msg.seq; +- e_thread_put(mail_thread_queued_slow, (EMsg *)m); ++ id = m->base.seq; ++ mail_msg_slow_ordered_push (m); return id; } ---- evolution-2.10.1/mail/em-folder-utils.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/em-folder-utils.c 2007-04-10 22:37:49.000000000 -0400 -@@ -260,7 +260,7 @@ - m->delete = delete; - seq = m->msg.seq; +--- evolution-2.10.1/mail/message-list.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 ++++ evolution-2.10.1/mail/message-list.c 2007-05-16 16:17:38.000000000 -0400 +@@ -1802,7 +1802,7 @@ + /* TODO: merge this with the folder tree stuff via empopup targets */ + /* Drop handling */ + struct _drop_msg { +- struct _mail_msg msg; ++ MailMsg base; + + GdkDragContext *context; -- e_thread_put (mail_thread_new, (EMsg *) m); -+ mail_msg_unordered_push ((mail_msg_t *) m); +@@ -1819,11 +1819,9 @@ + unsigned int aborted:1; + }; - return seq; +-static char * +-ml_drop_async_desc (struct _mail_msg *mm, int done) ++static gchar * ++ml_drop_async_desc (struct _drop_msg *m) + { +- struct _drop_msg *m = (struct _drop_msg *) mm; +- + if (m->move) + return g_strdup_printf(_("Moving messages into folder %s"), m->folder->full_name); + else +@@ -1831,13 +1829,11 @@ } -@@ -652,7 +652,7 @@ - g_free (namebuf); - - id = m->msg.seq; -- e_thread_put (mail_thread_new, (EMsg *) m); -+ mail_msg_unordered_push ((mail_msg_t *) m); - - return id; + + static void +-ml_drop_async_drop(struct _mail_msg *mm) ++ml_drop_async_exec (struct _drop_msg *m) + { +- struct _drop_msg *m = (struct _drop_msg *)mm; +- + switch (m->info) { + case DND_X_UID_LIST: +- em_utils_selection_get_uidlist(m->selection, m->folder, m->action == GDK_ACTION_MOVE, &mm->ex); ++ em_utils_selection_get_uidlist(m->selection, m->folder, m->action == GDK_ACTION_MOVE, &m->base.ex); + break; + case DND_MESSAGE_RFC822: + em_utils_selection_get_message(m->selection, m->folder); +@@ -1849,9 +1845,8 @@ } ---- evolution-2.10.1/mail/importers/elm-importer.c.kill-ethread 2007-04-09 09:09:26.000000000 -0400 -+++ evolution-2.10.1/mail/importers/elm-importer.c 2007-04-10 22:37:49.000000000 -0400 -@@ -312,7 +312,7 @@ - id = m->msg.seq; + static void +-ml_drop_async_done(struct _mail_msg *mm) ++ml_drop_async_done (struct _drop_msg *m) + { +- struct _drop_msg *m = (struct _drop_msg *)mm; + gboolean success, delete; -- e_thread_put(mail_thread_queued, (EMsg *)m); -+ mail_msg_fast_ordered_push ((mail_msg_t *) m); + /* ?? */ +@@ -1859,7 +1854,7 @@ + success = FALSE; + delete = FALSE; + } else { +- success = !camel_exception_is_set (&mm->ex); ++ success = !camel_exception_is_set (&m->base.ex); + delete = success && m->move && !m->moved; + } - return id; +@@ -1867,10 +1862,8 @@ } ---- evolution-2.10.1/mail/importers/mail-importer.c.kill-ethread 2007-04-09 09:09:26.000000000 -0400 -+++ evolution-2.10.1/mail/importers/mail-importer.c 2007-04-10 22:37:49.000000000 -0400 -@@ -329,7 +329,7 @@ - } - id = m->msg.seq; -- e_thread_put(mail_thread_queued, (EMsg *)m); -+ mail_msg_fast_ordered_push ((mail_msg_t *) m); + static void +-ml_drop_async_free(struct _mail_msg *mm) ++ml_drop_async_free (struct _drop_msg *m) + { +- struct _drop_msg *m = (struct _drop_msg *)mm; +- + g_object_unref(m->context); + camel_object_unref(m->folder); - return id; +@@ -1878,18 +1871,19 @@ + g_free(m->selection); } ---- evolution-2.10.1/mail/importers/pine-importer.c.kill-ethread 2007-04-09 09:09:26.000000000 -0400 -+++ evolution-2.10.1/mail/importers/pine-importer.c 2007-04-10 22:37:49.000000000 -0400 -@@ -350,7 +350,7 @@ - id = m->msg.seq; - -- e_thread_put(mail_thread_queued, (EMsg *)m); -+ mail_msg_fast_ordered_push ((mail_msg_t *) m); +-static struct _mail_msg_op ml_drop_async_op = { +- ml_drop_async_desc, +- ml_drop_async_drop, +- ml_drop_async_done, +- ml_drop_async_free, ++static MailMsgInfo ml_drop_async_info = { ++ sizeof (struct _drop_msg), ++ (MailMsgDescFunc) ml_drop_async_desc, ++ (MailMsgExecFunc) ml_drop_async_exec, ++ (MailMsgDoneFunc) ml_drop_async_done, ++ (MailMsgFreeFunc) ml_drop_async_free + }; - return id; + static void + ml_drop_action(struct _drop_msg *m) + { + m->move = m->action == GDK_ACTION_MOVE; +- e_thread_put (mail_thread_new, (EMsg *) m); ++ mail_msg_unordered_push (m); } ---- evolution-2.10.1/mail/mail-vfolder.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/mail-vfolder.c 2007-04-10 22:37:49.000000000 -0400 -@@ -188,7 +188,7 @@ - m->sources_folder = sources_folder; - - id = m->msg.seq; -- e_thread_put(mail_thread_queued_slow, (EMsg *)m); -+ mail_msg_slow_ordered_push ((mail_msg_t *) m); - return id; - } -@@ -323,7 +323,7 @@ - m->remove = remove; - - id = m->msg.seq; -- e_thread_put(mail_thread_queued_slow, (EMsg *)m); -+ mail_msg_slow_ordered_push ((mail_msg_t *) m); + static void +@@ -1916,7 +1910,7 @@ + struct _drop_msg *m = data; - return id; + m->aborted = TRUE; +- mail_msg_free(&m->msg); ++ mail_msg_unref(m); } -@@ -447,7 +447,7 @@ - return; - } - -- g_assert(pthread_equal(pthread_self(), mail_gui_thread)); -+ g_assert(mail_in_main_thread()); - is_ignore = uri_is_ignore(store, curi); + static EPopupItem ml_drop_popup_menu[] = { +@@ -1946,7 +1940,7 @@ + if (data->data == NULL || data->length == -1) + return; -@@ -540,7 +540,7 @@ +- m = mail_msg_new(&ml_drop_async_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&ml_drop_async_info); + m->context = context; + g_object_ref(context); + m->folder = ml->folder; +@@ -3676,7 +3670,7 @@ - d(printf ("Deleting uri to check: %s\n", uri)); - -- g_assert (pthread_equal(pthread_self(), mail_gui_thread)); -+ g_assert (mail_in_main_thread()); - - changed = g_string_new (""); - -@@ -615,7 +615,7 @@ - if (context == NULL || uri_is_spethal(store, cfrom) || uri_is_spethal(store, cto)) - return; + /* ** REGENERATE MESSAGELIST ********************************************** */ + struct _regen_list_msg { +- struct _mail_msg msg; ++ MailMsg base; -- g_assert(pthread_equal(pthread_self(), mail_gui_thread)); -+ g_assert(mail_in_main_thread()); + int complete; - from = em_uri_from_camel(cfrom); - to = em_uri_from_camel(cto); ---- evolution-2.10.1/mail/em-format-html.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/em-format-html.c 2007-04-10 22:37:49.000000000 -0400 -@@ -1375,7 +1375,7 @@ - } - - efh->priv->format_id = m->msg.seq; -- e_thread_put(mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); - } +@@ -3704,16 +3698,15 @@ - efh->priv->format_timeout_id = 0; ---- evolution-2.10.1/mail/em-folder-properties.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/em-folder-properties.c 2007-04-10 22:37:49.000000000 -0400 -@@ -386,7 +386,7 @@ - } + */ - if (folder == NULL) -- mail_get_folder(uri, 0, emfp_dialog_got_folder, NULL, mail_thread_new); -+ mail_get_folder(uri, 0, emfp_dialog_got_folder, NULL, mail_msg_unordered_push); - else - emfp_dialog_got_folder((char *)uri, folder, NULL); - } ---- evolution-2.10.1/mail/em-folder-tree.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/em-folder-tree.c 2007-04-10 22:37:49.000000000 -0400 -@@ -969,7 +969,7 @@ - tree_drag_data_action(struct _DragDataReceivedAsync *m) +-static char * +-regen_list_describe (struct _mail_msg *mm, gint complete) ++static gchar * ++regen_list_desc (struct _regen_list_msg *m) { - m->move = m->action == GDK_ACTION_MOVE; -- e_thread_put (mail_thread_new, (EMsg *) m); -+ mail_msg_unordered_push ((mail_msg_t *) m); + return g_strdup (_("Generating message list")); } static void -@@ -1915,7 +1915,7 @@ - m->top = full_name; - m->flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST; +-regen_list_regen (struct _mail_msg *mm) ++regen_list_exec (struct _regen_list_msg *m) + { +- struct _regen_list_msg *m = (struct _regen_list_msg *)mm; + GPtrArray *uids, *uidnew, *showuids, *searchuids = NULL; + CamelMessageInfo *info; + int i; +@@ -3743,7 +3736,7 @@ + } else + expr = "(match-all (not (system-flag \"deleted\")))"; + } +- searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &mm->ex); ++ searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &m->base.ex); + } else { + char *expr; + +@@ -3753,23 +3746,23 @@ + sprintf(expr, "(and (match-all (not (system-flag \"junk\")))\n %s)", m->search); + } else + expr = "(match-all (not (system-flag \"junk\")))"; +- searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &mm->ex); ++ searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &m->base.ex); + } else { + if (m->search) +- searchuids = uids = camel_folder_search_by_expression (m->folder, m->search, &mm->ex); ++ searchuids = uids = camel_folder_search_by_expression (m->folder, m->search, &m->base.ex); + else + uids = camel_folder_get_uids (m->folder); + } + } -- e_thread_put (mail_thread_new, (EMsg *) m); -+ mail_msg_unordered_push ((mail_msg_t *) m); +- if (camel_exception_is_set (&mm->ex)) ++ if (camel_exception_is_set (&m->base.ex)) + return; + + /* perform hiding */ + if (m->hideexpr && camel_folder_has_search_capability(m->folder)) { +- uidnew = camel_folder_search_by_expression (m->ml->folder, m->hideexpr, &mm->ex); ++ uidnew = camel_folder_search_by_expression (m->ml->folder, m->hideexpr, &m->base.ex); + /* well, lets not abort just because this faileld ... */ +- camel_exception_clear (&mm->ex); ++ camel_exception_clear (&m->base.ex); + + if (uidnew) { + MESSAGE_LIST_LOCK(m->ml, hide_lock); +@@ -3844,7 +3837,7 @@ + + e_profile_event_emit("list.threaduids", m->folder->full_name, 0); + +- if (!camel_operation_cancel_check(mm->cancel)) { ++ if (!camel_operation_cancel_check(m->base.cancel)) { + /* update/build a new tree */ + if (m->dotree) { + if (m->tree) +@@ -3873,17 +3866,15 @@ } - static gboolean ---- evolution-2.10.1/mail/em-folder-browser.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/em-folder-browser.c 2007-04-10 22:37:49.000000000 -0400 -@@ -948,7 +948,7 @@ - m->sources_folder = sources_folder; + static void +-regen_list_regened (struct _mail_msg *mm) ++regen_list_done (struct _regen_list_msg *m) + { +- struct _regen_list_msg *m = (struct _regen_list_msg *)mm; +- + if (m->ml->priv->destroyed) + return; - id = m->msg.seq; -- e_thread_put(mail_thread_queued_slow, (EMsg *)m); -+ mail_msg_slow_ordered_push ((mail_msg_t *) m); + if (!m->complete) + return; + +- if (camel_operation_cancel_check(mm->cancel)) ++ if (camel_operation_cancel_check(m->base.cancel)) + return; - return id; + if (m->ml->folder != m->folder) +@@ -3934,9 +3925,8 @@ } ---- evolution-2.10.1/mail/message-list.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/message-list.c 2007-04-10 22:37:49.000000000 -0400 -@@ -1889,7 +1889,7 @@ - ml_drop_action(struct _drop_msg *m) + + static void +-regen_list_free (struct _mail_msg *mm) ++regen_list_free (struct _regen_list_msg *m) { - m->move = m->action == GDK_ACTION_MOVE; -- e_thread_put (mail_thread_new, (EMsg *) m); -+ mail_msg_unordered_push ((mail_msg_t *) m); +- struct _regen_list_msg *m = (struct _regen_list_msg *)mm; + int i; + + e_profile_event_emit("list.regenerated", m->folder->full_name, 0); +@@ -3964,11 +3954,12 @@ + g_object_unref(m->ml); } - static void -@@ -3978,7 +3978,7 @@ +-static struct _mail_msg_op regen_list_op = { +- regen_list_describe, +- regen_list_regen, +- regen_list_regened, +- regen_list_free, ++static MailMsgInfo regen_list_info = { ++ sizeof (struct _regen_list_msg), ++ (MailMsgDescFunc) regen_list_desc, ++ (MailMsgExecFunc) regen_list_exec, ++ (MailMsgDoneFunc) regen_list_done, ++ (MailMsgFreeFunc) regen_list_free + }; + + static gboolean +@@ -3978,7 +3969,7 @@ m->ml->regen = g_list_prepend(m->ml->regen, m); /* TODO: we should manage our own thread stuff, would make cancelling outstanding stuff easier */ - e_thread_put (mail_thread_queued, (EMsg *)m); -+ mail_msg_fast_ordered_push ((mail_msg_t *) m); ++ mail_msg_fast_ordered_push (m); m->ml->regen_timeout_msg = NULL; m->ml->regen_timeout_id = 0; +@@ -3994,7 +3985,7 @@ + GList *l = ml->regen; + + while (l) { +- struct _mail_msg *mm = l->data; ++ MailMsg *mm = l->data; + + if (mm->cancel) + camel_operation_cancel(mm->cancel); +@@ -4006,7 +3997,7 @@ + if (ml->regen_timeout_id) { + g_source_remove(ml->regen_timeout_id); + ml->regen_timeout_id = 0; +- mail_msg_free((struct _mail_msg *)ml->regen_timeout_msg); ++ mail_msg_unref(ml->regen_timeout_msg); + ml->regen_timeout_msg = NULL; + } + } +@@ -4041,7 +4032,7 @@ + } + #endif + +- m = mail_msg_new (®en_list_op, NULL, sizeof (*m)); ++ m = mail_msg_new (®en_list_info); + m->ml = ml; + m->search = g_strdup (search); + m->hideexpr = g_strdup (hideexpr); --- evolution-2.10.1/mail/em-sync-stream.h.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/em-sync-stream.h 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/mail/em-sync-stream.h 2007-05-16 16:17:38.000000000 -0400 @@ -29,41 +29,45 @@ #ifndef EM_SYNC_STREAM_H #define EM_SYNC_STREAM_H @@ -499,7 +3782,7 @@ #endif /* EM_SYNC_STREAM_H */ --- evolution-2.10.1/mail/em-format-html-print.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/em-format-html-print.c 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/mail/em-format-html-print.c 2007-05-16 16:17:38.000000000 -0400 @@ -262,7 +262,7 @@ g_object_ref(source); g_object_ref(efhp); @@ -510,7 +3793,7 @@ return 0; /* damn async ... */ } --- evolution-2.10.1/mail/em-sync-stream.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/em-sync-stream.c 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/mail/em-sync-stream.c 2007-05-16 16:17:38.000000000 -0400 @@ -25,42 +25,17 @@ #include #endif @@ -564,7 +3847,7 @@ struct _write_msg { - EMsg msg; + EMSyncStream *emss; -+ EFlag *processed; ++ EFlag *done; enum _write_msg_t op; @@ -706,7 +3989,7 @@ - p->data_port = e_msgport_new(); - p->reply_port = e_msgport_new(); -+ e_flag_set (msg->processed); ++ e_flag_set (msg->done); -#ifndef G_OS_WIN32 - p->gui_channel = g_io_channel_unix_new(e_msgport_fd(p->data_port)); @@ -745,7 +4028,7 @@ - this prevents overflow from banked up data */ - - msg.msg.reply_port = p->reply_port; -+ msg.processed = e_flag_new (); ++ msg.done = e_flag_new (); + msg.emss = emss; msg.op = op; - msg.data = data; @@ -779,8 +4062,8 @@ + g_idle_add ((GSourceFunc) emss_process_message, &msg); - g_free(p->buf_data); -+ e_flag_wait (msg.processed); -+ e_flag_free (msg.processed); ++ e_flag_wait (msg.done); ++ e_flag_free (msg.done); -#ifdef LOG_STREAM - if (p->logfd) @@ -937,55 +4220,276 @@ + emss->buffer = g_string_sized_new (size); } --- evolution-2.10.1/mail/em-subscribe-editor.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/em-subscribe-editor.c 2007-04-10 22:37:49.000000000 -0400 -@@ -229,7 +229,7 @@ ++++ evolution-2.10.1/mail/em-subscribe-editor.c 2007-05-16 16:17:38.000000000 -0400 +@@ -175,7 +175,7 @@ + /* ** Subscribe folder operation **************************************** */ + + struct _zsubscribe_msg { +- struct _mail_msg msg; ++ MailMsg base; + + EMSubscribe *sub; + EMSubscribeNode *node; +@@ -184,20 +184,18 @@ + }; + + static void +-sub_folder_subscribe (struct _mail_msg *mm) ++sub_folder_exec (struct _zsubscribe_msg *m) + { +- struct _zsubscribe_msg *m = (struct _zsubscribe_msg *) mm; +- + if (m->subscribe) +- camel_store_subscribe_folder (m->sub->store, m->node->info->full_name, &mm->ex); ++ camel_store_subscribe_folder (m->sub->store, m->node->info->full_name, &m->base.ex); + else +- camel_store_unsubscribe_folder (m->sub->store, m->node->info->full_name, &mm->ex); ++ camel_store_unsubscribe_folder (m->sub->store, m->node->info->full_name, &m->base.ex); + } + + static void +-sub_folder_subscribed (struct _mail_msg *mm) ++sub_folder_done (struct _zsubscribe_msg *m) + { +- struct _zsubscribe_msg *m = (struct _zsubscribe_msg *)mm, *next; ++ struct _zsubscribe_msg *next; + GtkTreeIter iter; + GtkTreeModel *model; + EMSubscribeNode *node; +@@ -207,7 +205,7 @@ + if (m->sub->cancel) + return; + +- if (!camel_exception_is_set(&mm->ex)) { ++ if (!camel_exception_is_set(&m->base.ex)) { + if (m->subscribe) + m->node->info->flags |= CAMEL_FOLDER_SUBSCRIBED; + else +@@ -228,8 +226,8 @@ + /* queue any further ones, or if out, update the ui */ next = (struct _zsubscribe_msg *)e_dlist_remhead(&m->sub->subscribe); if (next) { - next->sub->subscribe_id = next->msg.seq; +- next->sub->subscribe_id = next->msg.seq; - e_thread_put(mail_thread_new, (EMsg *)next); -+ mail_msg_unordered_push ((mail_msg_t *) next); ++ next->sub->subscribe_id = next->base.seq; ++ mail_msg_unordered_push (next); } else { /* should it go off the model instead? */ sub_selection_changed(gtk_tree_view_get_selection(m->sub->tree), m->sub); -@@ -270,7 +270,7 @@ +@@ -237,19 +235,18 @@ + } + + static void +-sub_folder_free (struct _mail_msg *mm) ++sub_folder_free (struct _zsubscribe_msg *m) + { +- struct _zsubscribe_msg *m = (struct _zsubscribe_msg *) mm; +- + g_free(m->path); + sub_unref(m->sub); + } + +-static struct _mail_msg_op sub_subscribe_folder_op = { +- NULL, /*subscribe_folder_desc,*/ +- sub_folder_subscribe, +- sub_folder_subscribed, +- sub_folder_free, ++static MailMsgInfo sub_subscribe_folder_info = { ++ sizeof (struct _zsubscribe_msg), ++ (MailMsgDescFunc) NULL, ++ (MailMsgExecFunc) sub_folder_exec, ++ (MailMsgDoneFunc) sub_folder_done, ++ (MailMsgFreeFunc) sub_folder_free + }; + + /* spath is tree path in string form */ +@@ -259,18 +256,18 @@ + struct _zsubscribe_msg *m; + int id; + +- m = mail_msg_new (&sub_subscribe_folder_op, NULL, sizeof(*m)); ++ m = mail_msg_new (&sub_subscribe_folder_info); + m->sub = sub; + sub_ref(sub); + m->node = node; + m->subscribe = state; + m->path = g_strdup(spath); + +- id = m->msg.seq; ++ id = m->base.seq; if (sub->subscribe_id == -1) { sub->subscribe_id = id; d(printf("running subscribe folder '%s'\n", spath)); - e_thread_put (mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); ++ mail_msg_unordered_push (m); } else { d(printf("queueing subscribe folder '%s'\n", spath)); e_dlist_addtail(&sub->subscribe, (EDListNode *)m); -@@ -443,7 +443,7 @@ +@@ -341,7 +338,7 @@ + /* async query of folderinfo */ + + struct _emse_folderinfo_msg { +- struct _mail_msg msg; ++ MailMsg base; - id = m->msg.seq; + int seq; + +@@ -351,31 +348,29 @@ + }; + + static void +-sub_folderinfo_get (struct _mail_msg *mm) ++sub_folderinfo_exec (struct _emse_folderinfo_msg *m) + { +- struct _emse_folderinfo_msg *m = (struct _emse_folderinfo_msg *) mm; + char *pub_full_name=NULL; + + if (m->seq == m->sub->seq) { +- camel_operation_register(mm->cancel); +- m->info = camel_store_get_folder_info(m->sub->store, m->node?m->node->info->full_name:pub_full_name, CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL, &mm->ex); +- camel_operation_unregister(mm->cancel); ++ camel_operation_register(m->base.cancel); ++ m->info = camel_store_get_folder_info(m->sub->store, m->node?m->node->info->full_name:pub_full_name, CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL, &m->base.ex); ++ camel_operation_unregister(m->base.cancel); + } + } + + static void +-sub_folderinfo_got(struct _mail_msg *mm) ++sub_folderinfo_done (struct _emse_folderinfo_msg *m) + { +- struct _emse_folderinfo_msg *m = (struct _emse_folderinfo_msg *) mm; + EMSubscribeNode *node; + + m->sub->pending_id = -1; + if (m->sub->cancel || m->seq != m->sub->seq) + return; + +- if (camel_exception_is_set (&mm->ex)) { ++ if (camel_exception_is_set (&m->base.ex)) { + g_warning ("Error getting folder info from store: %s", +- camel_exception_get_description (&mm->ex)); ++ camel_exception_get_description (&m->base.ex)); + } + + if (m->info) { +@@ -396,10 +391,8 @@ + } + + static void +-sub_folderinfo_free(struct _mail_msg *mm) ++sub_folderinfo_free (struct _emse_folderinfo_msg *m) + { +- struct _emse_folderinfo_msg *m = (struct _emse_folderinfo_msg *) mm; +- + if (m->info) + m->sub->info_list = g_slist_prepend(m->sub->info_list, m->info); + +@@ -415,11 +408,12 @@ + sub_unref(m->sub); + } + +-static struct _mail_msg_op sub_folderinfo_op = { +- NULL, /*sub_folderinfo_desc, we do our own progress reporting/cancellation */ +- sub_folderinfo_get, +- sub_folderinfo_got, +- sub_folderinfo_free, ++static MailMsgInfo sub_folderinfo_info = { ++ sizeof (struct _emse_folderinfo_msg), ++ (MailMsgDescFunc) NULL, ++ (MailMsgExecFunc) sub_folderinfo_exec, ++ (MailMsgDoneFunc) sub_folderinfo_done, ++ (MailMsgFreeFunc) sub_folderinfo_free + }; + + static int +@@ -431,19 +425,19 @@ + d(printf("%s:%d:%s: Starting get folderinfo of '%s'\n", __FILE__, __LINE__, __GNUC_PRETTY_FUNCTION__, + node?node->info->full_name:"")); + +- m = mail_msg_new (&sub_folderinfo_op, NULL, sizeof(*m)); ++ m = mail_msg_new (&sub_folderinfo_info); + sub_ref(sub); + m->sub = sub; + m->node = node; + m->seq = sub->seq; + +- sub->pending_id = m->msg.seq; ++ sub->pending_id = m->base.seq; + + sub_editor_busy(sub->editor, 1); + +- id = m->msg.seq; ++ id = m->base.seq; - e_thread_put (mail_thread_new, (EMsg *)m); -+ mail_msg_unordered_push ((mail_msg_t *) m); ++ mail_msg_unordered_push (m); return id; } +@@ -573,7 +567,7 @@ + mail_msg_cancel(sub->subscribe_id); + + while ( (m = (struct _zsubscribe_msg *)e_dlist_remhead(&sub->subscribe)) ) +- mail_msg_free(m); ++ mail_msg_unref(m); + + sub_unref(sub); + } --- evolution-2.10.1/mail/mail-mt.h.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/mail-mt.h 2007-04-10 22:37:49.000000000 -0400 -@@ -25,14 +25,15 @@ ++++ evolution-2.10.1/mail/mail-mt.h 2007-05-16 16:17:38.000000000 -0400 +@@ -23,43 +23,60 @@ + #ifndef _MAIL_MT + #define _MAIL_MT - #include +-#include #include "camel/camel-exception.h" -#include "libedataserver/e-msgport.h" -+#include "libedataserver/e-flag.h" #include "camel/camel-object.h" #include "camel/camel-operation.h" - typedef struct _mail_msg { +-typedef struct _mail_msg { - EMsg msg; /* parent type */ -+ EFlag *processed; /* optional */ - struct _mail_msg_op *ops; /* operation functions */ +- struct _mail_msg_op *ops; /* operation functions */ ++typedef struct _MailMsg MailMsg; ++typedef struct _MailMsgInfo MailMsgInfo; ++typedef struct _MailMsgPrivate MailMsgPrivate; ++ ++typedef gchar * (*MailMsgDescFunc) (MailMsg *msg); ++typedef void (*MailMsgExecFunc) (MailMsg *msg); ++typedef void (*MailMsgDoneFunc) (MailMsg *msg); ++typedef void (*MailMsgFreeFunc) (MailMsg *msg); ++typedef void (*MailMsgDispatchFunc) (gpointer msg); ++ ++struct _MailMsg { ++ MailMsgInfo *info; ++ volatile gint ref_count; unsigned int seq; /* seq number for synchronisation */ + gint priority; /* priority (default = 0) */ CamelOperation *cancel; /* a cancellation/status handle */ CamelException ex; /* an initialised camel exception, upto the caller to use this */ - struct _mail_msg_priv *priv; /* private for internal use */ -@@ -51,8 +52,10 @@ +- struct _mail_msg_priv *priv; /* private for internal use */ +-} mail_msg_t; ++ MailMsgPrivate *priv; ++}; + +-/* callback functions for thread message */ +-typedef struct _mail_msg_op { +- char *(*describe_msg)(struct _mail_msg *msg, int complete); +- +- void (*receive_msg)(struct _mail_msg *msg); /* message received */ +- void (*reply_msg)(struct _mail_msg *msg); /* message replied */ +- void (*destroy_msg)(struct _mail_msg *msg); /* finalise message */ +-} mail_msg_op_t; ++struct _MailMsgInfo { ++ gsize size; ++ MailMsgDescFunc desc; ++ MailMsgExecFunc exec; ++ MailMsgDoneFunc done; ++ MailMsgFreeFunc free; ++}; + + /* setup ports */ void mail_msg_init(void); void mail_msg_cleanup (void); @@ -993,26 +4497,27 @@ + /* allocate a new message */ -void *mail_msg_new(mail_msg_op_t *ops, EMsgPort *reply_port, size_t size); -+void *mail_msg_new(mail_msg_op_t *ops, EFlag *processed, size_t size); - void mail_msg_free(void *msg); - void mail_msg_check_error(void *msg); +-void mail_msg_free(void *msg); +-void mail_msg_check_error(void *msg); ++gpointer mail_msg_new (MailMsgInfo *info); ++gpointer mail_msg_ref (gpointer msg); ++void mail_msg_unref (gpointer msg); ++void mail_msg_check_error (gpointer msg); void mail_msg_cancel(unsigned int msgid); -@@ -60,6 +63,14 @@ + void mail_msg_wait(unsigned int msgid); void mail_msg_wait_all(void); int mail_msg_active(unsigned int msgid); +/* dispatch a message */ -+void mail_msg_main_loop_push (mail_msg_t *msg); -+void mail_msg_unordered_push (mail_msg_t *msg); -+void mail_msg_fast_ordered_push (mail_msg_t *msg); -+void mail_msg_slow_ordered_push (mail_msg_t *msg); -+ -+typedef void (*MailMsgDispatchFunc) (mail_msg_t *msg); ++void mail_msg_main_loop_push (gpointer msg); ++void mail_msg_unordered_push (gpointer msg); ++void mail_msg_fast_ordered_push (gpointer msg); ++void mail_msg_slow_ordered_push (gpointer msg); + /* To implement the stop button */ void *mail_cancel_hook_add(GDestroyNotify func, void *data); void mail_cancel_hook_remove(void *handle); -@@ -112,24 +123,6 @@ +@@ -112,24 +129,6 @@ void mail_enable_stop(void); void mail_disable_stop(void); @@ -1038,7 +4543,7 @@ /* Note that almost all objects care about the lifecycle of their events, so this cannot be used */ extern MailAsyncEvent *mail_async_event; --- evolution-2.10.1/mail/mail-ops.h.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/mail-ops.h 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/mail/mail-ops.h 2007-05-16 16:17:38.000000000 -0400 @@ -30,13 +30,14 @@ #pragma } #endif /* __cplusplus */ @@ -1080,7 +4585,7 @@ /* and for a store */ int mail_get_store (const char *uri, CamelOperation *op, --- evolution-2.10.1/mail/em-composer-utils.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/em-composer-utils.c 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/mail/em-composer-utils.c 2007-05-16 16:17:38.000000000 -0400 @@ -534,7 +534,7 @@ strcmp (account->drafts_folder_uri, default_drafts_folder_uri) != 0) { int id; @@ -1125,17 +4630,84 @@ + mail_get_message (folder, uid, post_reply_to_message, NULL, mail_msg_unordered_push); } --- evolution-2.10.1/mail/mail-folder-cache.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/mail-folder-cache.c 2007-04-10 22:37:49.000000000 -0400 -@@ -907,7 +907,7 @@ ++++ evolution-2.10.1/mail/mail-folder-cache.c 2007-05-16 16:17:38.000000000 -0400 +@@ -843,15 +843,14 @@ + + + struct _ping_store_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelStore *store; + }; + +-static char * +-ping_store_desc (struct _mail_msg *mm, int done) ++static gchar * ++ping_store_desc (struct _ping_store_msg *m) + { +- struct _ping_store_msg *m = (struct _ping_store_msg *) mm; + char *service_name = camel_service_get_name (CAMEL_SERVICE (m->store), TRUE); + char *msg; + +@@ -862,10 +861,9 @@ + } + + static void +-ping_store_ping (struct _mail_msg *mm) ++ping_store_exec (struct _ping_store_msg *m) + { + gboolean online = FALSE; +- struct _ping_store_msg *m = (struct _ping_store_msg *) mm; + + if (CAMEL_SERVICE (m->store)->status == CAMEL_SERVICE_CONNECTED) { + if (CAMEL_IS_DISCO_STORE (m->store) && +@@ -876,22 +874,21 @@ + online = TRUE; + } + if (online) +- camel_store_noop (m->store, &mm->ex); ++ camel_store_noop (m->store, &m->base.ex); + } + + static void +-ping_store_free (struct _mail_msg *mm) ++ping_store_free (struct _ping_store_msg *m) + { +- struct _ping_store_msg *m = (struct _ping_store_msg *) mm; +- + camel_object_unref (m->store); + } + +-static struct _mail_msg_op ping_store_op = { +- ping_store_desc, +- ping_store_ping, +- NULL, +- ping_store_free ++static MailMsgInfo ping_store_info = { ++ sizeof (struct _ping_store_msg), ++ (MailMsgDescFunc) ping_store_desc, ++ (MailMsgExecFunc) ping_store_exec, ++ (MailMsgDoneFunc) NULL, ++ (MailMsgFreeFunc) ping_store_free + }; + + static void +@@ -903,11 +900,11 @@ + if (CAMEL_SERVICE (store)->status != CAMEL_SERVICE_CONNECTED) + return; + +- m = mail_msg_new (&ping_store_op, NULL, sizeof (struct _ping_store_msg)); ++ m = mail_msg_new (&ping_store_info); m->store = store; camel_object_ref (store); - e_thread_put (mail_thread_queued_slow, (EMsg *) m); -+ mail_msg_slow_ordered_push ((mail_msg_t *) m); ++ mail_msg_slow_ordered_push (m); } static gboolean -@@ -952,7 +952,7 @@ +@@ -952,7 +949,7 @@ int hook = 0; g_assert(CAMEL_IS_STORE(store)); @@ -1145,7 +4717,7 @@ LOCK(info_lock); --- evolution-2.10.1/mail/em-folder-view.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/em-folder-view.c 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/mail/em-folder-view.c 2007-05-16 16:17:38.000000000 -0400 @@ -68,6 +68,7 @@ #include @@ -1191,7 +4763,7 @@ e_profile_event_emit("goto.empty", "", 0); g_free(emfv->priv->selected_uid); --- evolution-2.10.1/mail/mail-session.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/mail-session.c 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/mail/mail-session.c 2007-05-16 16:17:38.000000000 -0400 @@ -35,7 +35,7 @@ #include @@ -1201,49 +4773,82 @@ #include /* FIXME: this is where camel_init is defined, it shouldn't include everything else */ #include -@@ -256,7 +256,7 @@ +@@ -256,21 +256,22 @@ /* ********************************************************************** */ -static GtkDialog *message_dialog; -+static gpointer message_dialog; - static EDList message_list = E_DLIST_INITIALISER(message_list); +-static EDList message_list = E_DLIST_INITIALISER(message_list); ++static gpointer user_message_dialog; ++static GQueue user_message_queue = { NULL, NULL, 0 }; struct _user_message_msg { -@@ -283,7 +283,7 @@ +- struct _mail_msg msg; ++ MailMsg base; + + CamelSessionAlertType type; + char *prompt; ++ EFlag *done; + + unsigned int allow_cancel:1; + unsigned int result:1; + unsigned int ismain:1; + }; + +-static void do_user_message (struct _mail_msg *mm); ++static void user_message_exec (struct _user_message_msg *m); + + /* clicked, send back the reply */ + static void +@@ -278,122 +279,116 @@ + { + gtk_widget_destroy ((GtkWidget *) dialog); + +- message_dialog = NULL; ++ user_message_dialog = NULL; + /* if !allow_cancel, then we've already replied */ if (m->allow_cancel) { m->result = button == GTK_RESPONSE_OK; - e_msgport_reply((EMsg *)m); -+ e_flag_set (m->msg.processed); ++ e_flag_set (m->done); } /* check for pendings */ -@@ -292,22 +292,10 @@ - } - - static void +- if ((m = (struct _user_message_msg *)e_dlist_remhead(&message_list))) +- do_user_message((struct _mail_msg *)m); +-} +- +-static void -user_message_destroy_notify (struct _user_message_msg *m, GObject *deadbeef) -{ - message_dialog = NULL; --} -- ++ if (!g_queue_is_empty (&user_message_queue)) { ++ m = g_queue_pop_head (&user_message_queue); ++ user_message_exec (m); ++ mail_msg_unref (m); ++ } + } + -/* This is kinda ugly/inefficient, but oh well, it works */ -static const char *error_type[] = { - "mail:session-message-info", "mail:session-message-warning", "mail:session-message-error", - "mail:session-message-info-cancel", "mail:session-message-warning-cancel", "mail:session-message-error-cancel" -}; - --static void - do_user_message (struct _mail_msg *mm) + static void +-do_user_message (struct _mail_msg *mm) ++user_message_exec (struct _user_message_msg *m) { - struct _user_message_msg *m = (struct _user_message_msg *)mm; +- struct _user_message_msg *m = (struct _user_message_msg *)mm; - int type; + const gchar *error_type; - if (!m->ismain && message_dialog != NULL) { - e_dlist_addtail (&message_list, (EDListNode *)m); -@@ -315,24 +303,27 @@ +- if (!m->ismain && message_dialog != NULL) { +- e_dlist_addtail (&message_list, (EDListNode *)m); ++ if (!m->ismain && user_message_dialog != NULL) { ++ g_queue_push_tail (&user_message_queue, mail_msg_ref (m)); + return; } switch (m->type) { @@ -1282,36 +4887,58 @@ - - message_dialog = (GtkDialog *)e_error_new(NULL, error_type[type], m->prompt, NULL); - g_object_set ((GObject *) message_dialog, "allow_shrink", TRUE, "allow_grow", TRUE, NULL); -+ message_dialog = e_error_new(NULL, error_type, m->prompt, NULL); -+ g_object_set (message_dialog, "allow_shrink", TRUE, "allow_grow", TRUE, NULL); ++ user_message_dialog = e_error_new(NULL, error_type, m->prompt, NULL); ++ g_object_set (user_message_dialog, "allow_shrink", TRUE, "allow_grow", TRUE, NULL); /* We only need to wait for the result if we allow cancel otherwise show but send result back instantly */ if (m->allow_cancel) { -@@ -340,12 +331,13 @@ - user_message_response(message_dialog, gtk_dialog_run (message_dialog), m); + if (m->ismain) { +- user_message_response(message_dialog, gtk_dialog_run (message_dialog), m); ++ user_message_response(user_message_dialog, gtk_dialog_run (user_message_dialog), m); } else { - g_signal_connect (message_dialog, "response", G_CALLBACK (user_message_response), m); +- g_signal_connect (message_dialog, "response", G_CALLBACK (user_message_response), m); - gtk_widget_show ((GtkWidget *) message_dialog); -+ gtk_widget_show (message_dialog); ++ g_signal_connect (user_message_dialog, "response", G_CALLBACK (user_message_response), m); ++ gtk_widget_show (user_message_dialog); } } else { - g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_widget_destroy), message_dialog); +- g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_widget_destroy), message_dialog); - g_object_weak_ref ((GObject *) message_dialog, (GWeakNotify) user_message_destroy_notify, m); - gtk_widget_show ((GtkWidget *) message_dialog); -+ g_object_add_weak_pointer (message_dialog, &message_dialog); -+ gtk_widget_show (message_dialog); -+ e_flag_free (mm->processed); - mail_msg_free(m); +- mail_msg_free(m); ++ g_signal_connect (user_message_dialog, "response", G_CALLBACK (gtk_widget_destroy), user_message_dialog); ++ g_object_add_weak_pointer (user_message_dialog, &user_message_dialog); ++ gtk_widget_show (user_message_dialog); ++ mail_msg_unref(m); } } -@@ -364,17 +356,17 @@ + + static void +-free_user_message(struct _mail_msg *mm) ++user_message_free (struct _user_message_msg *m) + { +- struct _user_message_msg *m = (struct _user_message_msg *)mm; +- + g_free(m->prompt); ++ e_flag_free(m->done); + } + +-static struct _mail_msg_op user_message_op = { NULL, do_user_message, NULL, free_user_message }; ++static MailMsgInfo user_message_info = { ++ sizeof (struct _user_message_msg), ++ (MailMsgDescFunc) NULL, ++ (MailMsgExecFunc) user_message_exec, ++ (MailMsgDoneFunc) NULL, ++ (MailMsgFreeFunc) user_message_free ++}; + + static gboolean alert_user(CamelSession *session, CamelSessionAlertType type, const char *prompt, gboolean cancel) { MailSession *mail_session = MAIL_SESSION (session); - struct _user_message_msg *m, *r; - EMsgPort *user_message_reply = NULL; + struct _user_message_msg *m; -+ EFlag *processed = NULL; gboolean ret; if (!mail_session->interactive) @@ -1321,55 +4948,117 @@ - user_message_reply = e_msgport_new (); - m = mail_msg_new (&user_message_op, user_message_reply, sizeof (*m)); - m->ismain = pthread_equal(pthread_self(), mail_gui_thread); -+ processed = e_flag_new (); -+ -+ m = mail_msg_new (&user_message_op, processed, sizeof (*m)); ++ m = mail_msg_new (&user_message_info); + m->ismain = mail_in_main_thread(); m->type = type; m->prompt = g_strdup(prompt); ++ m->done = e_flag_new (); m->allow_cancel = cancel; -@@ -382,18 +374,14 @@ + ++ if (cancel) ++ mail_msg_ref (m); ++ if (m->ismain) - do_user_message((struct _mail_msg *)m); +- do_user_message((struct _mail_msg *)m); ++ user_message_exec(m); else { - extern EMsgPort *mail_gui_port2; - - e_msgport_put(mail_gui_port2, (EMsg *)m); -+ mail_msg_main_loop_push((mail_msg_t *) m); ++ mail_msg_main_loop_push(m); } if (cancel) { - r = (struct _user_message_msg *)e_msgport_wait(user_message_reply); - g_assert(m == r); - -+ e_flag_wait (processed); -+ e_flag_free (processed); ++ e_flag_wait (m->done); ret = m->result; - mail_msg_free(m); +- mail_msg_free(m); - e_msgport_destroy(user_message_reply); ++ mail_msg_unref(m); } else ret = TRUE; -@@ -687,7 +675,7 @@ +@@ -533,7 +528,7 @@ + /* TODO: This is very temporary, until we have a better way to do the progress reporting, + we just borrow a dummy mail-mt thread message and hook it onto out camel thread message */ + +-static mail_msg_op_t ms_thread_ops_dummy = { NULL }; ++static MailMsgInfo ms_thread_info_dummy = { sizeof (MailMsg) }; + + static void *ms_thread_msg_new(CamelSession *session, CamelSessionThreadOps *ops, unsigned int size) + { +@@ -542,7 +537,7 @@ + /* We create a dummy mail_msg, and then copy its cancellation port over to ours, so + we get cancellation and progress in common with hte existing mail code, for free */ + if (msg) { +- struct _mail_msg *m = mail_msg_new(&ms_thread_ops_dummy, NULL, sizeof(struct _mail_msg)); ++ MailMsg *m = mail_msg_new(&ms_thread_info_dummy); + + msg->data = m; + camel_operation_unref(msg->op); +@@ -555,7 +550,7 @@ + + static void ms_thread_msg_free(CamelSession *session, CamelSessionThreadMsg *m) + { +- mail_msg_free(m->data); ++ mail_msg_unref(m->data); + ms_parent_class->thread_msg_free(session, m); + } + +@@ -678,22 +673,23 @@ + MAIL_SESSION (session)->interactive = interactive; + + if (!interactive) { +- struct _user_message_msg *um; ++ struct _user_message_msg *msg; + + d(printf ("Gone non-interactive, checking for outstanding interactive tasks\n")); + + e_passwords_cancel(); + /* flush/cancel pending user messages */ - while ((um = (struct _user_message_msg *) e_dlist_remhead (&message_list))) { - d(printf ("Flusing message request: %s\n", um->prompt)); +- while ((um = (struct _user_message_msg *) e_dlist_remhead (&message_list))) { +- d(printf ("Flusing message request: %s\n", um->prompt)); - e_msgport_reply((EMsg *) um); -+ e_flag_set (um->msg.processed); ++ while (!g_queue_is_empty (&user_message_queue)) { ++ msg = g_queue_pop_head (&user_message_queue); ++ e_flag_set (msg->done); ++ mail_msg_unref (msg); } /* and the current */ +- if (message_dialog) { ++ if (user_message_dialog) { + d(printf("Destroying message dialogue\n")); +- gtk_widget_destroy ((GtkWidget *) message_dialog); ++ gtk_widget_destroy ((GtkWidget *) user_message_dialog); + } + } + } --- evolution-2.10.1/mail/mail-mt.c.kill-ethread 2007-04-09 09:09:27.000000000 -0400 -+++ evolution-2.10.1/mail/mail-mt.c 2007-04-10 22:37:49.000000000 -0400 -@@ -29,7 +29,6 @@ ++++ evolution-2.10.1/mail/mail-mt.c 2007-05-16 16:17:38.000000000 -0400 +@@ -29,8 +29,8 @@ #include #include -#include #include ++#include #include -@@ -82,13 +81,9 @@ + #include +@@ -63,7 +63,7 @@ + #endif + + /* background operation status stuff */ +-struct _mail_msg_priv { ++struct _MailMsgPrivate { + int activity_state; /* sigh sigh sigh, we need to keep track of the state external to the + pointer itself for locking/race conditions */ + int activity_id; +@@ -82,15 +82,12 @@ static pthread_mutex_t mail_msg_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t mail_msg_cond = PTHREAD_COND_INITIALIZER; @@ -1380,11 +5069,15 @@ -static void mail_msg_destroy(EThread *e, EMsg *msg, void *data); - -void *mail_msg_new(mail_msg_op_t *ops, EMsgPort *reply_port, size_t size) -+void *mail_msg_new(mail_msg_op_t *ops, EFlag *processed, size_t size) ++gpointer ++mail_msg_new (MailMsgInfo *info) { - struct _mail_msg *msg; +- struct _mail_msg *msg; ++ MailMsg *msg; + + MAIL_MT_LOCK(mail_msg_lock); -@@ -112,7 +107,6 @@ +@@ -112,7 +109,6 @@ fprintf(log, "Logging async operations\n"); if (log_locks) { @@ -1392,29 +5085,220 @@ fprintf(log, "%" G_GINT64_MODIFIER "x: lock mail_msg_lock\n", e_util_pthread_id(pthread_self())); } } else { -@@ -123,9 +117,9 @@ +@@ -122,13 +118,13 @@ + } } #endif - msg = g_malloc0(size); -+ msg->processed = processed; /* owned by caller */ - msg->ops = ops; +- msg = g_malloc0(size); +- msg->ops = ops; ++ msg = g_slice_alloc0 (info->size); ++ msg->info = info; ++ msg->ref_count = 1; msg->seq = mail_msg_seq++; - msg->msg.reply_port = reply_port; msg->cancel = camel_operation_new(mail_operation_status, GINT_TO_POINTER(msg->seq)); camel_exception_init(&msg->ex); - msg->priv = g_malloc0(sizeof(*msg->priv)); -@@ -308,9 +302,8 @@ +- msg->priv = g_malloc0(sizeof(*msg->priv)); ++ msg->priv = g_slice_new (MailMsgPrivate); + + g_hash_table_insert(mail_msg_active_table, GINT_TO_POINTER(msg->seq), msg); + +@@ -143,12 +139,15 @@ + return msg; + } + +- +-static void end_event_callback (CamelObject *o, void *event_data, void *data) ++static void ++end_event_callback (CamelObject *o, void *event_data, void *data) + { +- EActivityHandler *activity_handler = mail_component_peek_activity_handler (mail_component_peek ()); ++ MailComponent *component; ++ EActivityHandler *activity_handler; + guint activity_id = GPOINTER_TO_INT (event_data); + ++ component = mail_component_peek (); ++ activity_handler = mail_component_peek_activity_handler (component); + e_activity_handler_operation_finished (activity_handler, activity_id); + } + +@@ -177,58 +176,84 @@ + } + #endif + +-void mail_msg_free(void *msg) ++gpointer ++mail_msg_ref (gpointer msg) + { +- struct _mail_msg *m = msg; +- int activity_id; ++ MailMsg *mail_msg = msg; ++ ++ g_return_val_if_fail (mail_msg != NULL, msg); ++ g_return_val_if_fail (mail_msg->ref_count > 0, msg); ++ ++ g_atomic_int_add (&mail_msg->ref_count, 1); ++ return msg; ++} ++ ++void ++mail_msg_unref (gpointer msg) ++{ ++ MailMsg *mail_msg = msg; ++ gint activity_id; ++ ++ g_return_if_fail (mail_msg != NULL); ++ g_return_if_fail (mail_msg->ref_count > 0); ++ ++ if (g_atomic_int_exchange_and_add (&mail_msg->ref_count, -1) > 1) ++ return; + + #ifdef MALLOC_CHECK +- checkmem(m); +- checkmem(m->cancel); +- checkmem(m->priv); ++ checkmem(mail_msg); ++ checkmem(mail_msg->cancel); ++ checkmem(mail_msg->priv); + #endif + d(printf("Free message %p\n", msg)); + +- if (m->ops->destroy_msg) +- m->ops->destroy_msg(m); ++ if (mail_msg->info->free) ++ mail_msg->info->free(mail_msg); + + MAIL_MT_LOCK(mail_msg_lock); + + #ifdef LOG_OPS +- if (log_ops) +- fprintf(log, "%p: Free (exception `%s')\n", msg, +- camel_exception_get_description(&m->ex)?camel_exception_get_description(&m->ex):"None"); ++ if (log_ops) { ++ const gchar *description; ++ ++ description = camel_exception_get_description (&mail_msg->ex); ++ if (description == NULL) ++ description = "None"; ++ fprintf(log, "%p: Free (exception `%s')\n", msg, description); ++ } + #endif +- g_hash_table_remove(mail_msg_active_table, GINT_TO_POINTER(m->seq)); +- pthread_cond_broadcast(&mail_msg_cond); ++ g_hash_table_remove ( ++ mail_msg_active_table, GINT_TO_POINTER (mail_msg->seq)); ++ pthread_cond_broadcast (&mail_msg_cond); + + /* We need to make sure we dont lose a reference here YUCK YUCK */ + /* This is tightly integrated with the code in do_op_status, + as it closely relates to the CamelOperation setup in msg_new() above */ +- if (m->priv->activity_state == 1) { +- m->priv->activity_state = 3; /* tell the other thread +- * to free it itself (yuck yuck) */ ++ if (mail_msg->priv->activity_state == 1) { ++ /* tell the other to free it itself */ ++ mail_msg->priv->activity_state = 3; + MAIL_MT_UNLOCK(mail_msg_lock); + return; + } else { +- activity_id = m->priv->activity_id; ++ activity_id = mail_msg->priv->activity_id; + } + + MAIL_MT_UNLOCK(mail_msg_lock); + +- if (m->cancel) { +- camel_operation_mute(m->cancel); +- camel_operation_unref(m->cancel); ++ if (mail_msg->cancel) { ++ camel_operation_mute (mail_msg->cancel); ++ camel_operation_unref (mail_msg->cancel); + } + +- camel_exception_clear(&m->ex); +- /*g_free(m->priv->what);*/ +- g_free(m->priv); +- g_free(m); ++ camel_exception_clear (&mail_msg->ex); ++ g_slice_free (MailMsgPrivate, mail_msg->priv); ++ g_slice_free1 (mail_msg->info->size, mail_msg); + + if (activity_id != 0) +- mail_async_event_emit(mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) end_event_callback, +- NULL, GINT_TO_POINTER (activity_id), NULL); ++ mail_async_event_emit ( ++ mail_async_event, MAIL_ASYNC_GUI, ++ (MailAsyncFunc) end_event_callback, ++ NULL, GINT_TO_POINTER (activity_id), NULL); + } + + /* hash table of ops->dialogue of active errors */ +@@ -244,9 +269,10 @@ + gtk_widget_destroy((GtkWidget *)o); + } + +-void mail_msg_check_error(void *msg) ++void ++mail_msg_check_error (gpointer msg) + { +- struct _mail_msg *m = msg; ++ MailMsg *m = msg; + char *what; + GtkDialog *gd; + +@@ -271,27 +297,27 @@ + /* check to see if we have dialogue already running for this operation */ + /* we key on the operation pointer, which is at least accurate enough + for the operation type, although it could be on a different object. */ +- if (g_hash_table_lookup(active_errors, m->ops)) { ++ if (g_hash_table_lookup(active_errors, m->info)) { + g_warning("Error occurred while existing dialogue active:\n%s", camel_exception_get_description(&m->ex)); + return; + } + +- if (m->ops->describe_msg +- && (what = m->ops->describe_msg(m, FALSE))) { ++ if (m->info->desc ++ && (what = m->info->desc (m))) { + gd = (GtkDialog *)e_error_new(NULL, "mail:async-error", what, camel_exception_get_description(&m->ex), NULL); + g_free(what); + } else + gd = (GtkDialog *)e_error_new(NULL, "mail:async-error-nodescribe", camel_exception_get_description(&m->ex), NULL); + +- g_hash_table_insert(active_errors, m->ops, gd); +- g_signal_connect(gd, "response", G_CALLBACK(error_response), m->ops); +- g_signal_connect(gd, "destroy", G_CALLBACK(error_destroy), m->ops); ++ g_hash_table_insert(active_errors, m->info, gd); ++ g_signal_connect(gd, "response", G_CALLBACK(error_response), m->info); ++ g_signal_connect(gd, "destroy", G_CALLBACK(error_destroy), m->info); + gtk_widget_show((GtkWidget *)gd); + } + + void mail_msg_cancel(unsigned int msgid) + { +- struct _mail_msg *m; ++ MailMsg *m; + + MAIL_MT_LOCK(mail_msg_lock); + m = g_hash_table_lookup(mail_msg_active_table, GINT_TO_POINTER(msgid)); +@@ -304,13 +330,12 @@ + + + /* waits for a message to be finished processing (freed) +- the messageid is from struct _mail_msg->seq */ ++ the messageid is from MailMsg->seq */ void mail_msg_wait(unsigned int msgid) { - struct _mail_msg *m; +- struct _mail_msg *m; - int ismain = pthread_equal(pthread_self(), mail_gui_thread); ++ MailMsg *m; - if (ismain) { + if (mail_in_main_thread ()) { MAIL_MT_LOCK(mail_msg_lock); m = g_hash_table_lookup(mail_msg_active_table, GINT_TO_POINTER(msgid)); while (m) { -@@ -347,9 +340,7 @@ +@@ -347,9 +372,7 @@ void mail_msg_wait_all(void) { @@ -1425,7 +5309,7 @@ MAIL_MT_LOCK(mail_msg_lock); while (g_hash_table_size(mail_msg_active_table) > 0) { MAIL_MT_UNLOCK(mail_msg_lock); -@@ -420,241 +411,193 @@ +@@ -420,241 +443,183 @@ MAIL_MT_UNLOCK(mail_msg_lock); } @@ -1481,7 +5365,7 @@ { - EMsgPort *port = (EMsgPort *)d; - mail_msg_t *m; -+ mail_msg_t *msg; ++ MailMsg *msg; - while (( m = (mail_msg_t *)e_msgport_get(port))) { + g_assert (main_loop_queue != NULL); @@ -1498,35 +5382,26 @@ - fprintf(log, "%p: Replied to GUI thread (exception `%s'\n", m, - camel_exception_get_description(&m->ex)?camel_exception_get_description(&m->ex):"None"); -#endif -+ /* check the main loop queue */ -+ while ((msg = g_async_queue_try_pop (main_loop_queue)) != NULL) { -+ -+ /* If the message has a "processed" EFlag, it must also have -+ * a receive_msg() callback. The receive_msg() callback is -+ * responsible for setting the EFlag, and thread blocked on -+ * the EFlag is reponsible for freeing it. */ -+ if (msg->processed != NULL) { -+ g_assert (msg->ops->receive_msg != NULL); -+ msg->ops->receive_msg (msg); -+ } else { -+ if (msg->ops->receive_msg != NULL) -+ msg->ops->receive_msg (msg); -+ if (msg->ops->reply_msg != NULL) -+ msg->ops->reply_msg (msg); -+ mail_msg_free (msg); -+ } -+ } - +- - if (m->ops->reply_msg) - m->ops->reply_msg(m); - mail_msg_check_error(m); - mail_msg_free(m); ++ /* check the main loop queue */ ++ while ((msg = g_async_queue_try_pop (main_loop_queue)) != NULL) { ++ if (msg->info->exec != NULL) ++ msg->info->exec (msg); ++ if (msg->info->done != NULL) ++ msg->info->done (msg); ++ mail_msg_unref (msg); ++ } ++ + /* check the reply queue */ + while ((msg = g_async_queue_try_pop (msg_reply_queue)) != NULL) { -+ if (msg->ops->reply_msg != NULL) -+ msg->ops->reply_msg (msg); ++ if (msg->info->done != NULL) ++ msg->info->done (msg); + mail_msg_check_error (msg); -+ mail_msg_free (msg); ++ mail_msg_unref (msg); } return TRUE; @@ -1535,24 +5410,24 @@ -static gboolean -mail_msgport_received(GIOChannel *source, GIOCondition cond, void *d) +static void -+mail_msg_proxy (mail_msg_t *msg) ++mail_msg_proxy (MailMsg *msg) { - EMsgPort *port = (EMsgPort *)d; - mail_msg_t *m; -+ if (msg->ops->describe_msg != NULL) { -+ gchar *text = msg->ops->describe_msg (msg, FALSE); ++ if (msg->info->desc != NULL) { ++ gchar *text = msg->info->desc (msg); + camel_operation_register (msg->cancel); + camel_operation_start (msg->cancel, "%s", text); + g_free (text); + } + -+ if (msg->ops->receive_msg != NULL) { ++ if (msg->info->exec != NULL) { + mail_enable_stop (); -+ msg->ops->receive_msg (msg); ++ msg->info->exec (msg); + mail_disable_stop (); + } + -+ if (msg->ops->describe_msg != NULL) { ++ if (msg->info->desc != NULL) { + camel_operation_end (msg->cancel); + camel_operation_unregister (msg->cancel); + MAIL_MT_LOCK (mail_msg_lock); @@ -1638,7 +5513,7 @@ -static void -mail_msg_destroy(EThread *e, EMsg *msg, void *data) +static gint -+mail_msg_compare (const mail_msg_t *msg1, const mail_msg_t *msg2) ++mail_msg_compare (const MailMsg *msg1, const MailMsg *msg2) { - mail_msg_t *m = (mail_msg_t *)msg; + gint priority1 = msg1->priority; @@ -1686,7 +5561,7 @@ - fprintf(log, "%p: Received at thread %" G_GINT64_MODIFIER "x: '%s'\n", m, e_util_pthread_id(pthread_self()), text); -#endif +void -+mail_msg_main_loop_push (mail_msg_t *msg) ++mail_msg_main_loop_push (gpointer msg) +{ + g_async_queue_push_sorted (main_loop_queue, msg, + (GCompareDataFunc) mail_msg_compare, NULL); @@ -1703,7 +5578,7 @@ - fprintf(log, "%p: Received at thread %" G_GINT64_MODIFIER "x\n", m, e_util_pthread_id(pthread_self())); -#endif +void -+mail_msg_unordered_push (mail_msg_t *msg) ++mail_msg_unordered_push (gpointer msg) +{ + static GOnce once = G_ONCE_INIT; @@ -1727,7 +5602,7 @@ -void mail_msg_cleanup(void) +void -+mail_msg_fast_ordered_push (mail_msg_t *msg) ++mail_msg_fast_ordered_push (gpointer msg) { - mail_msg_wait_all(); - @@ -1748,7 +5623,7 @@ -static guint -em_channel_setup(EMsgPort **port, GIOChannel **channel, GIOFunc func) +void -+mail_msg_slow_ordered_push (mail_msg_t *msg) ++mail_msg_slow_ordered_push (gpointer msg) { - GSource *source; - guint id; @@ -1803,15 +5678,74 @@ } /* ********************************************************************** */ -@@ -723,7 +666,6 @@ +@@ -665,7 +630,8 @@ + /* ********************************************************************** */ + + struct _proxy_msg { +- struct _mail_msg msg; ++ MailMsg base; ++ + MailAsyncEvent *ea; + mail_async_event_t type; + +@@ -679,10 +645,8 @@ + }; + + static void +-do_async_event(struct _mail_msg *mm) ++do_async_event(struct _proxy_msg *m) + { +- struct _proxy_msg *m = (struct _proxy_msg *)mm; +- + m->thread = pthread_self(); + m->have_thread = TRUE; + m->func(m->o, m->event_data, m->data); +@@ -697,16 +661,17 @@ + idle_async_event(void *mm) + { + do_async_event(mm); +- mail_msg_free(mm); ++ mail_msg_unref(mm); + + return FALSE; + } + +-static struct _mail_msg_op async_event_op = { +- NULL, +- do_async_event, +- NULL, +- NULL, ++static MailMsgInfo async_event_info = { ++ sizeof (struct _proxy_msg), ++ (MailMsgDescFunc) NULL, ++ (MailMsgExecFunc) do_async_event, ++ (MailMsgDoneFunc) NULL, ++ (MailMsgFreeFunc) NULL + }; + + MailAsyncEvent *mail_async_event_new(void) +@@ -723,10 +688,9 @@ { struct _proxy_msg *m; int id; - int ismain = pthread_equal(pthread_self(), mail_gui_thread); /* we dont have a reply port for this, we dont care when/if it gets executed, just queue it */ - m = mail_msg_new(&async_event_op, NULL, sizeof(*m)); -@@ -743,12 +685,12 @@ +- m = mail_msg_new(&async_event_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&async_event_info); + m->func = func; + m->o = o; + m->event_data = event_data; +@@ -735,7 +699,7 @@ + m->type = type; + m->have_thread = FALSE; + +- id = m->msg.seq; ++ id = m->base.seq; + g_mutex_lock(ea->lock); + ea->tasks = g_slist_prepend(ea->tasks, m); + g_mutex_unlock(ea->lock); +@@ -743,12 +707,12 @@ /* We use an idle function instead of our own message port only because the gui message ports's notification buffer might overflow and deadlock us */ if (type == MAIL_ASYNC_GUI) { @@ -1820,40 +5754,83 @@ g_idle_add(idle_async_event, m); else - e_msgport_put(mail_gui_port, (EMsg *)m); -+ mail_msg_main_loop_push((mail_msg_t *) m); ++ mail_msg_main_loop_push(m); } else - e_thread_put(mail_thread_queued, (EMsg *)m); -+ mail_msg_fast_ordered_push ((mail_msg_t *) m); ++ mail_msg_fast_ordered_push (m); return id; } -@@ -842,6 +784,9 @@ +@@ -762,7 +726,7 @@ + g_mutex_lock(ea->lock); + while (ea->tasks) { + m = ea->tasks->data; +- id = m->msg.seq; ++ id = m->base.seq; + if (m->have_thread && pthread_equal(m->thread, thread)) { + g_warning("Destroying async event from inside an event, returning EDEADLK"); + g_mutex_unlock(ea->lock); +@@ -784,17 +748,18 @@ + /* ********************************************************************** */ + + struct _call_msg { +- struct _mail_msg msg; ++ MailMsg base; ++ + mail_call_t type; + MailMainFunc func; + void *ret; + va_list ap; ++ EFlag *done; + }; + + static void +-do_call(struct _mail_msg *mm) ++do_call(struct _call_msg *m) + { +- struct _call_msg *m = (struct _call_msg *)mm; + void *p1, *p2, *p3, *p4, *p5; + int i1; + va_list ap; +@@ -842,45 +807,48 @@ m->ret = m->func(p1, p2, i1, p3, p4, p5); break; } + -+ if (mm->processed != NULL) -+ e_flag_set (mm->processed); ++ if (m->done != NULL) ++ e_flag_set (m->done); } - static struct _mail_msg_op mail_call_op = { -@@ -856,23 +801,22 @@ +-static struct _mail_msg_op mail_call_op = { +- NULL, +- do_call, +- NULL, +- NULL, ++static MailMsgInfo mail_call_info = { ++ sizeof (struct _call_msg), ++ (MailMsgDescFunc) NULL, ++ (MailMsgExecFunc) do_call, ++ (MailMsgDoneFunc) NULL, ++ (MailMsgFreeFunc) NULL + }; + +-void *mail_call_main(mail_call_t type, MailMainFunc func, ...) ++void * ++mail_call_main (mail_call_t type, MailMainFunc func, ...) + { struct _call_msg *m; void *ret; va_list ap; - EMsgPort *reply = NULL; - int ismain = pthread_equal(pthread_self(), mail_gui_thread); -+ EFlag *processed = NULL; va_start(ap, func); - if (!ismain) - reply = e_msgport_new(); -+ if (!mail_in_main_thread ()) -+ processed = e_flag_new (); - +- - m = mail_msg_new(&mail_call_op, reply, sizeof(*m)); -+ m = mail_msg_new(&mail_call_op, processed, sizeof(*m)); ++ m = mail_msg_new (&mail_call_info); m->type = type; m->func = func; G_VA_COPY(m->ap, ap); @@ -1862,32 +5839,105 @@ - e_msgport_put(mail_gui_port, (EMsg *)m); - e_msgport_wait(reply); - e_msgport_destroy(reply); -+ if (processed != NULL) { -+ mail_msg_main_loop_push((mail_msg_t *) m); -+ e_flag_wait (processed); -+ e_flag_free (processed); - } else { - do_call(&m->msg); +- } else { +- do_call(&m->msg); ++ mail_msg_ref (m); ++ ++ if (mail_in_main_thread ()) ++ do_call (m); ++ else { ++ m->done = e_flag_new (); ++ mail_msg_main_loop_push (m); ++ e_flag_wait (m->done); ++ e_flag_free (m->done); } -@@ -909,7 +853,7 @@ + + va_end(ap); + + ret = m->ret; +- mail_msg_free(m); ++ mail_msg_unref (m); + + return ret; + } +@@ -889,40 +857,42 @@ + /* locked via status_lock */ + static int busy_state; + +-static void do_set_busy(struct _mail_msg *mm) ++static void ++do_set_busy(MailMsg *mm) + { + set_stop(busy_state > 0); + } + +-static struct _mail_msg_op set_busy_op = { +- NULL, +- do_set_busy, +- NULL, +- NULL, ++static MailMsgInfo set_busy_info = { ++ sizeof (MailMsg), ++ (MailMsgDescFunc) NULL, ++ (MailMsgExecFunc) do_set_busy, ++ (MailMsgDoneFunc) NULL, ++ (MailMsgFreeFunc) NULL + }; + + void mail_enable_stop(void) + { +- struct _mail_msg *m; ++ MailMsg *m; + + MAIL_MT_LOCK(status_lock); busy_state++; if (busy_state == 1) { - m = mail_msg_new(&set_busy_op, NULL, sizeof(*m)); +- m = mail_msg_new(&set_busy_op, NULL, sizeof(*m)); - e_msgport_put(mail_gui_port, (EMsg *)m); -+ mail_msg_main_loop_push((mail_msg_t *) m); ++ m = mail_msg_new(&set_busy_info); ++ mail_msg_main_loop_push(m); } MAIL_MT_UNLOCK(status_lock); } -@@ -922,7 +866,7 @@ + + void mail_disable_stop(void) + { +- struct _mail_msg *m; ++ MailMsg *m; + + MAIL_MT_LOCK(status_lock); busy_state--; if (busy_state == 0) { - m = mail_msg_new(&set_busy_op, NULL, sizeof(*m)); +- m = mail_msg_new(&set_busy_op, NULL, sizeof(*m)); - e_msgport_put(mail_gui_port, (EMsg *)m); -+ mail_msg_main_loop_push((mail_msg_t *) m); ++ m = mail_msg_new(&set_busy_info); ++ mail_msg_main_loop_push(m); } MAIL_MT_UNLOCK(status_lock); } -@@ -947,7 +891,7 @@ +@@ -930,7 +900,7 @@ + /* ******************************************************************************** */ + + struct _op_status_msg { +- struct _mail_msg msg; ++ MailMsg base; + + struct _CamelOperation *op; + char *what; +@@ -938,16 +908,16 @@ + void *data; + }; + +-static void do_op_status(struct _mail_msg *mm) ++static void ++op_status_exec (struct _op_status_msg *m) + { + EActivityHandler *activity_handler = mail_component_peek_activity_handler (mail_component_peek ()); +- struct _op_status_msg *m = (struct _op_status_msg *)mm; +- struct _mail_msg *msg; +- struct _mail_msg_priv *data; ++ MailMsg *msg; ++ MailMsgPrivate *data; char *out, *p, *o, c; int pc; @@ -1896,26 +5946,144 @@ MAIL_MT_LOCK (mail_msg_lock); -@@ -1055,7 +999,7 @@ +@@ -986,8 +956,8 @@ + progress_icon = e_icon_factory_get_icon ("stock_mail-unread", E_ICON_SIZE_MENU); + + MAIL_MT_UNLOCK (mail_msg_lock); +- if (msg->ops->describe_msg) +- what = msg->ops->describe_msg (msg, FALSE); ++ if (msg->info->desc) ++ what = msg->info->desc (msg); + /* uncommenting because message is not very useful for a user, see bug 271734*/ + else { + what = g_strdup(""); +@@ -1021,18 +991,17 @@ + } + + static void +-do_op_status_free (struct _mail_msg *mm) ++op_status_free (struct _op_status_msg *m) + { +- struct _op_status_msg *m = (struct _op_status_msg *)mm; +- + g_free (m->what); + } + +-static struct _mail_msg_op op_status_op = { +- NULL, +- do_op_status, +- NULL, +- do_op_status_free, ++static MailMsgInfo op_status_info = { ++ sizeof (struct _op_status_msg), ++ (MailMsgDescFunc) NULL, ++ (MailMsgExecFunc) op_status_exec, ++ (MailMsgDoneFunc) NULL, ++ (MailMsgFreeFunc) op_status_free + }; + + static void +@@ -1042,7 +1011,7 @@ + + d(printf("got operation statys: %s %d%%\n", what, pc)); + +- m = mail_msg_new(&op_status_op, NULL, sizeof(*m)); ++ m = mail_msg_new(&op_status_info); + m->op = op; + m->what = g_strdup(what); + switch (pc) { +@@ -1055,7 +1024,7 @@ } m->pc = pc; m->data = data; - e_msgport_put(mail_gui_port, (EMsg *)m); -+ mail_msg_main_loop_push((mail_msg_t *) m); ++ mail_msg_main_loop_push(m); } /* ******************** */ --- evolution-2.10.1/plugins/folder-unsubscribe/folder-unsubscribe.c.kill-ethread 2007-04-09 09:09:11.000000000 -0400 -+++ evolution-2.10.1/plugins/folder-unsubscribe/folder-unsubscribe.c 2007-04-10 22:37:49.000000000 -0400 -@@ -108,5 +108,5 @@ - unsub = mail_msg_new (&unsubscribe_op, NULL, sizeof (struct _folder_unsub_t)); ++++ evolution-2.10.1/plugins/folder-unsubscribe/folder-unsubscribe.c 2007-05-16 16:17:38.000000000 -0400 +@@ -44,32 +44,30 @@ + + + struct _folder_unsub_t { +- struct _mail_msg msg; ++ MailMsg base; + + char *uri; + }; + +-static char * +-folder_unsubscribe__desc (struct _mail_msg *mm, int done) ++static gchar * ++folder_unsubscribe_desc (struct _folder_unsub_t *msg) + { +- struct _folder_unsub_t *unsub = (struct _folder_unsub_t *) mm; +- +- return g_strdup_printf (_("Unsubscribing from folder \"%s\""), unsub->uri); ++ return g_strdup_printf ( ++ _("Unsubscribing from folder \"%s\""), msg->uri); + } + + static void +-folder_unsubscribe__unsub (struct _mail_msg *mm) ++folder_unsubscribe_exec (struct _folder_unsub_t *msg) + { +- struct _folder_unsub_t *unsub = (struct _folder_unsub_t *) mm; + extern CamelSession *session; + const char *path = NULL; + CamelStore *store; + CamelURL *url; + +- if (!(store = camel_session_get_store (session, unsub->uri, &mm->ex))) ++ if (!(store = camel_session_get_store (session, msg->uri, &mm->ex))) + return; + +- url = camel_url_new (unsub->uri, NULL); ++ url = camel_url_new (msg->uri, NULL); + if (((CamelService *) store)->provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) + path = url->fragment; + else if (url->path && url->path[0]) +@@ -82,18 +80,17 @@ + } + + static void +-folder_unsubscribe__free (struct _mail_msg *mm) ++folder_unsubscribe_free (struct _folder_unsub_t *msg) + { +- struct _folder_unsub_t *unsub = (struct _folder_unsub_t *) mm; +- +- g_free (unsub->uri); ++ g_free (msg->uri); + } + +-static struct _mail_msg_op unsubscribe_op = { +- folder_unsubscribe__desc, +- folder_unsubscribe__unsub, +- NULL, +- folder_unsubscribe__free, ++static MailMsgInfo unsubscribe_info = { ++ sizeof (struct _folder_unsub_t), ++ (MailMsgDescFunc) folder_unsubscribe_desc, ++ (MailMsgExecFunc) folder_unsubscribe_exec, ++ (MailMsgDoneFunc) NULL, ++ (MailMsgFreeFunc) folder_unsubscribe_free + }; + + +@@ -105,8 +102,8 @@ + if (target->uri == NULL) + return; + +- unsub = mail_msg_new (&unsubscribe_op, NULL, sizeof (struct _folder_unsub_t)); ++ unsub = mail_msg_new (&unsubscribe_info); unsub->uri = g_strdup (target->uri); - e_thread_put (mail_thread_new, (EMsg *) unsub); -+ mail_msg_unordered_push ((mail_msg_t *) unsub); ++ mail_msg_unordered_push (unsub); } --- evolution-2.10.1/plugins/mark-all-read/mark-all-read.c.kill-ethread 2007-04-09 09:09:14.000000000 -0400 -+++ evolution-2.10.1/plugins/mark-all-read/mark-all-read.c 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/plugins/mark-all-read/mark-all-read.c 2007-05-16 16:17:38.000000000 -0400 @@ -44,7 +44,7 @@ return; } @@ -1926,7 +6094,7 @@ static void --- evolution-2.10.1/plugins/exchange-operations/exchange-folder.c.kill-ethread 2007-04-09 09:09:13.000000000 -0400 -+++ evolution-2.10.1/plugins/exchange-operations/exchange-folder.c 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/plugins/exchange-operations/exchange-folder.c 2007-05-16 16:17:38.000000000 -0400 @@ -134,7 +134,7 @@ inbox_physical_uri = e_folder_get_physical_uri (inbox); @@ -1937,7 +6105,7 @@ } --- evolution-2.10.1/plugins/save-attachments/save-attachments.c.kill-ethread 2007-04-09 09:09:15.000000000 -0400 -+++ evolution-2.10.1/plugins/save-attachments/save-attachments.c 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/plugins/save-attachments/save-attachments.c 2007-05-16 16:17:38.000000000 -0400 @@ -407,5 +407,5 @@ camel_object_ref(data->folder); data->uid = g_strdup(target->uids->pdata[0]); @@ -1946,7 +6114,7 @@ + mail_get_message(data->folder, data->uid, save_got_message, data, mail_msg_unordered_push); } --- evolution-2.10.1/plugins/mailing-list-actions/mailing-list-actions.c.kill-ethread 2007-04-09 09:09:14.000000000 -0400 -+++ evolution-2.10.1/plugins/mailing-list-actions/mailing-list-actions.c 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/plugins/mailing-list-actions/mailing-list-actions.c 2007-05-16 16:17:38.000000000 -0400 @@ -89,7 +89,7 @@ data->uri = strdup (sel->uri); @@ -1957,18 +6125,106 @@ void emla_list_action_do (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data) --- evolution-2.10.1/plugins/groupwise-features/share-folder-common.c.kill-ethread 2007-04-09 09:09:12.000000000 -0400 -+++ evolution-2.10.1/plugins/groupwise-features/share-folder-common.c 2007-04-10 22:37:49.000000000 -0400 -@@ -239,7 +239,7 @@ ++++ evolution-2.10.1/plugins/groupwise-features/share-folder-common.c 2007-05-16 16:17:38.000000000 -0400 +@@ -121,7 +121,7 @@ + } + + struct _EMCreateFolder { +- struct _mail_msg msg; ++ MailMsg base; + + /* input data */ + CamelStore *store; +@@ -137,31 +137,26 @@ + void *user_data; + }; + +-static char * +-create_folder__desc (struct _mail_msg *mm, int done) ++static gchar * ++create_folder_desc (struct _EMCreateFolder *m) + { +- struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; +- + return g_strdup_printf (_("Creating folder `%s'"), m->full_name); + } + + static void +-create_folder__create (struct _mail_msg *mm) ++create_folder_exec (struct _EMCreateFolder *m) + { +- struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; +- + d(printf ("creating folder parent='%s' name='%s' full_name='%s'\n", m->parent, m->name, m->full_name)); + +- if ((m->fi = camel_store_create_folder (m->store, m->parent, m->name, &mm->ex))) { ++ if ((m->fi = camel_store_create_folder (m->store, m->parent, m->name, &m->base.ex))) { + if (camel_store_supports_subscriptions (m->store)) +- camel_store_subscribe_folder (m->store, m->full_name, &mm->ex); ++ camel_store_subscribe_folder (m->store, m->full_name, &m->base.ex); + } + } + + static void +-create_folder__created (struct _mail_msg *mm) ++create_folder_done (struct _EMCreateFolder *m) + { +- struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; + struct ShareInfo *ssi = (struct ShareInfo *) m->user_data; + CamelStore *store = CAMEL_STORE (m->store) ; + EGwConnection *ccnc; +@@ -180,10 +175,8 @@ + } + + static void +-create_folder__free (struct _mail_msg *mm) ++create_folder_free (struct _EMCreateFolder *m) + { +- struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; +- + camel_store_free_folder_info (m->store, m->fi); + camel_object_unref (m->store); + g_free (m->full_name); +@@ -191,11 +184,12 @@ + g_free (m->name); + } + +-static struct _mail_msg_op create_folder_op = { +- create_folder__desc, +- create_folder__create, +- create_folder__created, +- create_folder__free, ++static MailMsgInfo create_folder_info = { ++ sizeof (struct _EMCreateFolder), ++ (MailMsgDescFunc) create_folder_desc, ++ (MailMsgExecFunc) create_folder_exec, ++ (MailMsgDoneFunc) create_folder_done, ++ (MailMsgFreeFunc) create_folder_free + }; + + static void +@@ -229,7 +223,7 @@ + parent = namebuf; + } + +- m = mail_msg_new (&create_folder_op, NULL, sizeof (struct _EMCreateFolder)); ++ m = mail_msg_new (&create_folder_info); + camel_object_ref (store); + m->store = store; + m->full_name = g_strdup (full_name); +@@ -238,8 +232,8 @@ + m->user_data = (struct ShareInfo *) user_data; m->done = done; g_free (namebuf); - id = m->msg.seq; +- id = m->msg.seq; - e_thread_put (mail_thread_new, (EMsg *) m); -+ mail_msg_unordered_push ((mail_msg_t *) m); ++ id = m->base.seq; ++ mail_msg_unordered_push (m); return id; } --- evolution-2.10.1/calendar/gui/alarm-notify/alarm-notify.h.kill-ethread 2007-04-09 09:10:29.000000000 -0400 -+++ evolution-2.10.1/calendar/gui/alarm-notify/alarm-notify.h 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/calendar/gui/alarm-notify/alarm-notify.h 2007-05-16 16:17:38.000000000 -0400 @@ -39,19 +39,6 @@ typedef struct _AlarmNotifyPrivate AlarmNotifyPrivate; @@ -1990,7 +6246,7 @@ BonoboObject object; --- evolution-2.10.1/calendar/gui/alarm-notify/alarm-notify.c.kill-ethread 2007-04-09 09:10:29.000000000 -0400 -+++ evolution-2.10.1/calendar/gui/alarm-notify/alarm-notify.c 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/calendar/gui/alarm-notify/alarm-notify.c 2007-05-16 16:17:38.000000000 -0400 @@ -45,10 +45,6 @@ GMutex *mutex; }; @@ -2104,7 +6360,7 @@ static void --- evolution-2.10.1/calendar/gui/alarm-notify/alarm-queue.c.kill-ethread 2007-04-09 09:10:29.000000000 -0400 -+++ evolution-2.10.1/calendar/gui/alarm-notify/alarm-queue.c 2007-04-10 22:37:49.000000000 -0400 ++++ evolution-2.10.1/calendar/gui/alarm-notify/alarm-queue.c 2007-05-16 16:17:38.000000000 -0400 @@ -115,9 +115,6 @@ static int tray_blink_state = FALSE; static AlarmNotify *an; diff --git a/evolution.spec b/evolution.spec index afd9be9..982738c 100644 --- a/evolution.spec +++ b/evolution.spec @@ -47,7 +47,7 @@ Name: evolution Version: 2.10.1 -Release: 16%{?dist} +Release: 17%{?dist} License: GPL Group: Applications/Productivity Summary: GNOME's next-generation groupware suite @@ -759,6 +759,10 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/evolution/%{evo_major}/libmenus.so %changelog +* Wed May 16 2007 Matthew Barnes - 2.10.1-17.fc7 +- Revise patch for GNOME bug #362638 to fix RH bug #237206 + (certificate prompt causes crash, again). + * Tue May 15 2007 Matthew Barnes - 2.10.1-16.fc7 - Add patch for RH bug #240147 (Send/Receive dialog layout).