diff --git a/evolution-2.11.91-compilation-breakage.patch b/evolution-2.11.91-compilation-breakage.patch deleted file mode 100644 index 9c3e4f1..0000000 --- a/evolution-2.11.91-compilation-breakage.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- evolution-2.11.91/calendar/gui/e-cal-popup.c.compilation-breakage 2007-08-24 02:50:09.000000000 -0400 -+++ evolution-2.11.91/calendar/gui/e-cal-popup.c 2007-08-28 15:01:22.000000000 -0400 -@@ -693,7 +693,7 @@ - - source = e_source_selector_peek_primary_selection (selector); - uri = e_source_get_uri (source); -- if (!uri || (g_strncasecmp (uri, "file://", 7) && g_strncasecmp (uri, "contacts://", 11))) { -+ if (!uri || (g_ascii_strncasecmp (uri, "file://", 7) && g_ascii_strncasecmp (uri, "contacts://", 11))) { - /* check for e_target_selector's offline_status property here */ - offline = e_source_get_property (source, "offline"); - diff --git a/evolution-2.8.1-kill-ethread.patch b/evolution-2.8.1-kill-ethread.patch index c4efbc8..e77c44c 100644 --- a/evolution-2.8.1-kill-ethread.patch +++ b/evolution-2.8.1-kill-ethread.patch @@ -1,103 +1,1192 @@ -diff -up evolution-2.11.91/mail/mail-send-recv.c.kill-ethread evolution-2.11.91/mail/mail-send-recv.c ---- evolution-2.11.91/mail/mail-send-recv.c.kill-ethread 2007-07-28 17:08:12.000000000 -0400 -+++ evolution-2.11.91/mail/mail-send-recv.c 2007-08-29 17:39:34.000000000 -0400 -@@ -770,23 +770,22 @@ receive_get_folder(CamelFilterDriver *d, - /* ********************************************************************** */ +--- evolution-2.11.92/plugins/folder-unsubscribe/folder-unsubscribe.c.kill-ethread 2007-09-02 14:56:38.000000000 -0400 ++++ evolution-2.11.92/plugins/folder-unsubscribe/folder-unsubscribe.c 2007-09-04 00:19:08.000000000 -0400 +@@ -44,32 +44,30 @@ - struct _refresh_folders_msg { + + struct _folder_unsub_t { - struct _mail_msg msg; + MailMsg base; - - struct _send_info *info; - GPtrArray *folders; - CamelStore *store; + + char *uri; }; -static char * --refresh_folders_desc (struct _mail_msg *mm, int done) +-folder_unsubscribe__desc (struct _mail_msg *mm, int done) +static gchar * -+refresh_folders_desc (struct _refresh_folders_msg *m) ++folder_unsubscribe_desc (struct _folder_unsub_t *msg) { - return g_strdup_printf(_("Checking for new mail")); +- 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 --refresh_folders_get (struct _mail_msg *mm) -+refresh_folders_exec (struct _refresh_folders_msg *m) +-folder_unsubscribe__unsub (struct _mail_msg *mm) ++folder_unsubscribe_exec (struct _folder_unsub_t *msg) { -- struct _refresh_folders_msg *m = (struct _refresh_folders_msg *)mm; - int i; - CamelFolder *folder; - CamelException ex = CAMEL_EXCEPTION_INITIALISER; -@@ -808,17 +807,14 @@ refresh_folders_get (struct _mail_msg *m +- 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 --refresh_folders_got (struct _mail_msg *mm) -+refresh_folders_done (struct _refresh_folders_msg *m) +-folder_unsubscribe__free (struct _mail_msg *mm) ++folder_unsubscribe_free (struct _folder_unsub_t *msg) { -- struct _refresh_folders_msg *m = (struct _refresh_folders_msg *)mm; -- - receive_done("", m->info); +- 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 (unsub); + } +--- evolution-2.11.92/plugins/mark-all-read/mark-all-read.c.kill-ethread 2007-09-02 14:56:39.000000000 -0400 ++++ evolution-2.11.92/plugins/mark-all-read/mark-all-read.c 2007-09-04 00:19:08.000000000 -0400 +@@ -44,7 +44,7 @@ + return; + } + +- mail_get_folder(t->uri, 0, mar_got_folder, NULL, mail_thread_new); ++ mail_get_folder(t->uri, 0, mar_got_folder, NULL, mail_msg_unordered_push); } 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; +--- evolution-2.11.92/plugins/save-attachments/save-attachments.c.kill-ethread 2007-09-02 14:56:45.000000000 -0400 ++++ evolution-2.11.92/plugins/save-attachments/save-attachments.c 2007-09-04 00:19:08.000000000 -0400 +@@ -403,5 +403,5 @@ + camel_object_ref(data->folder); + data->uid = g_strdup(target->uids->pdata[0]); - for (i=0;ifolders->len;i++) -@@ -827,11 +823,12 @@ refresh_folders_free (struct _mail_msg * - camel_object_unref(m->store); +- mail_get_message(data->folder, data->uid, save_got_message, data, mail_thread_new); ++ mail_get_message(data->folder, data->uid, save_got_message, data, mail_msg_unordered_push); + } +--- evolution-2.11.92/plugins/groupwise-features/share-folder-common.c.kill-ethread 2007-09-02 14:56:38.000000000 -0400 ++++ evolution-2.11.92/plugins/groupwise-features/share-folder-common.c 2007-09-04 00:19:08.000000000 -0400 +@@ -121,7 +121,7 @@ } --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 + 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 -@@ -864,13 +861,13 @@ receive_update_got_folderinfo(CamelStore - - 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 (m); - } else { - receive_done ("", data); +@@ -229,7 +223,7 @@ + parent = namebuf; } -diff -up evolution-2.11.91/mail/mail-component.c.kill-ethread evolution-2.11.91/mail/mail-component.c ---- evolution-2.11.91/mail/mail-component.c.kill-ethread 2007-08-24 02:49:43.000000000 -0400 -+++ evolution-2.11.91/mail/mail-component.c 2007-08-29 17:39:34.000000000 -0400 -@@ -1005,7 +1005,7 @@ impl_handleURI (PortableServer_Servant s - if (camel_url_get_param(url, "uid") != NULL) { - char *curi = em_uri_to_camel(uri); + +- 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; +- e_thread_put (mail_thread_new, (EMsg *) m); ++ id = m->base.seq; ++ mail_msg_unordered_push (m); + + return id; + } +--- evolution-2.11.92/plugins/mailing-list-actions/mailing-list-actions.c.kill-ethread 2007-07-05 02:09:24.000000000 -0400 ++++ evolution-2.11.92/plugins/mailing-list-actions/mailing-list-actions.c 2007-09-04 00:19:08.000000000 -0400 +@@ -89,7 +89,7 @@ + data->uri = strdup (sel->uri); -- mail_get_folder(curi, 0, handleuri_got_folder, url, mail_thread_new); -+ mail_get_folder(curi, 0, handleuri_got_folder, url, mail_msg_unordered_push); - g_free(curi); - } else { - g_warning("email uri's must include a uid parameter"); -diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/mail-ops.c ---- evolution-2.11.91/mail/mail-ops.c.kill-ethread 2007-07-05 02:09:38.000000000 -0400 -+++ evolution-2.11.91/mail/mail-ops.c 2007-08-29 17:39:34.000000000 -0400 + mail_get_message (sel->folder, (const char*) g_ptr_array_index (sel->uids, 0), +- emla_list_action_do, data, mail_thread_new); ++ emla_list_action_do, data, mail_msg_unordered_push); + } + + void emla_list_action_do (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data) +--- evolution-2.11.92/plugins/exchange-operations/exchange-folder.c.kill-ethread 2007-09-02 14:56:39.000000000 -0400 ++++ evolution-2.11.92/plugins/exchange-operations/exchange-folder.c 2007-09-04 00:19:08.000000000 -0400 +@@ -140,7 +140,7 @@ + inbox_physical_uri = e_folder_get_physical_uri (inbox); + + /* To get the CamelStore/Folder */ +- mail_get_folder (inbox_physical_uri, 0, exchange_get_folder, target_uri, mail_thread_new); ++ mail_get_folder (inbox_physical_uri, 0, exchange_get_folder, target_uri, mail_msg_unordered_push); + + + } +--- evolution-2.11.92/calendar/gui/alarm-notify/alarm-notify.c.kill-ethread 2007-09-02 14:57:09.000000000 -0400 ++++ evolution-2.11.92/calendar/gui/alarm-notify/alarm-notify.c 2007-09-04 00:19:08.000000000 -0400 +@@ -45,10 +45,6 @@ + GMutex *mutex; + }; + +-EThread *alarm_operation_thread; /* for operations that can (or should) be queued */ +-EMsgPort *alarm_reply_port; +-static GIOChannel *alarm_reply_channel; +- + #define d(x) x + + +@@ -286,72 +282,12 @@ + g_mutex_free (priv->mutex); + g_free (priv); + +- e_thread_destroy(alarm_operation_thread); +- g_io_channel_unref(alarm_reply_channel); +- e_msgport_destroy(alarm_reply_port); + if (G_OBJECT_CLASS (parent_class)->finalize) + (* G_OBJECT_CLASS (parent_class)->finalize) (object); + } + + + +-static guint +-alarm_channel_setup(EMsgPort **port, GIOChannel **channel, GIOFunc func) +-{ +- GSource *source; +- guint id; +- +- d (printf("%s:%d (alarm_channel_setup) - Channel Setup\n ", __FILE__, __LINE__)); +- *port = e_msgport_new(); +-#ifndef G_OS_WIN32 +- *channel = g_io_channel_unix_new(e_msgport_fd(*port)); +-#else +- *channel = g_io_channel_win32_new_socket(e_msgport_fd(*port)); +-#endif +- source = g_io_create_watch(*channel, G_IO_IN); +- g_source_set_callback(source, (GSourceFunc)func, *port, NULL); +- g_source_set_can_recurse(source, FALSE); +- id = g_source_attach(source, NULL); +- g_source_unref(source); +- +- return id; +-} +- +-static void +-alarm_msg_destroy(EThread *e, EMsg *msg, void *data) +-{ +- AlarmMsg *m = (AlarmMsg *)msg; +- +- /* Free the private */ +- g_free (m->data); /* Mostly it is a structure allocated as a carrier*/ +- g_free (m); +-} +- +-static gboolean +-alarm_msgport_replied(GIOChannel *source, GIOCondition cond, void *d) +-{ +- EMsgPort *port = (EMsgPort *)d; +- EMsg *m; +- +- while (( m = e_msgport_get(port))) { +- d (printf("%s:%d (alarm_msgport_replied) - %p: Replied to GUI thread\n", __FILE__, __LINE__, m)); +- alarm_msg_destroy(NULL, m, NULL); +- } +- +- return TRUE; +-} +- +-static void +-alarm_msg_received(EThread *e, EMsg *msg, void *data) +-{ +- AlarmMsg *m = (AlarmMsg *)msg; +- +- d(printf("%s:%d (alarm_msg_received) - %p: Received at thread %" G_GINT64_MODIFIER "x\n", __FILE__, __LINE__, m, e_util_pthread_id(pthread_self()))); +- if (m->receive_msg) { +- m->receive_msg (e, m, data); +- } +-} +- + /** + * alarm_notify_new: + * +@@ -363,23 +299,10 @@ + AlarmNotify * + alarm_notify_new (void) + { +- AlarmNotify *an; +- +- d (printf("%s:%d (alarm_notify_new) - Alarm Notify New \n ", __FILE__, __LINE__)); +- +- /* Create a thread for alarm queue operation*/ +- alarm_channel_setup(&alarm_reply_port, &alarm_reply_channel, alarm_msgport_replied); +- +- alarm_operation_thread = e_thread_new(E_THREAD_QUEUE); +- e_thread_set_msg_destroy(alarm_operation_thread, alarm_msg_destroy, 0); +- e_thread_set_msg_received(alarm_operation_thread, alarm_msg_received, 0); +- e_thread_set_reply_port(alarm_operation_thread, alarm_reply_port); +- +- an = g_object_new (TYPE_ALARM_NOTIFY, +- "poa", bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL), +- NULL); +- +- return an; ++ return g_object_new (TYPE_ALARM_NOTIFY, ++ "poa", bonobo_poa_get_threaded ( ++ ORBIT_THREAD_HINT_PER_REQUEST, NULL), ++ NULL); + } + + static void +--- evolution-2.11.92/calendar/gui/alarm-notify/alarm-notify.h.kill-ethread 2007-09-02 14:57:09.000000000 -0400 ++++ evolution-2.11.92/calendar/gui/alarm-notify/alarm-notify.h 2007-09-04 00:19:08.000000000 -0400 +@@ -39,19 +39,6 @@ + + typedef struct _AlarmNotifyPrivate AlarmNotifyPrivate; + +-typedef struct _AlarmMsg AlarmMsg; +-typedef struct _AlarmMsgPrivate AlarmMsgPrivate; +- +-struct _AlarmMsg { +- EMsg msg; +- +- void (*receive_msg)(EThread *e, struct _AlarmMsg *msg, void *data); /* message received */ +- void *data; +- +- /* Private Usage */ +- struct _AlarmMsgPrivate *priv; +-}; +- + struct _AlarmNotify { + BonoboObject object; + +--- evolution-2.11.92/calendar/gui/alarm-notify/alarm-queue.c.kill-ethread 2007-09-02 14:57:09.000000000 -0400 ++++ evolution-2.11.92/calendar/gui/alarm-notify/alarm-queue.c 2007-09-04 00:19:08.000000000 -0400 +@@ -97,9 +97,6 @@ + static int tray_blink_state = FALSE; + static AlarmNotify *an; + +-/* Main Tasks thread for dealing with the global structures */ +-extern EThread *alarm_operation_thread; +- + /* Structure that stores a client we are monitoring */ + typedef struct { + /* Monitored client */ +@@ -181,6 +178,40 @@ + static void load_alarms_for_today (ClientAlarms *ca); + static void midnight_refresh_cb (gpointer alarm_id, time_t trigger, gpointer data); + ++/* Simple asynchronous message dispatcher */ ++ ++typedef struct _Message Message; ++typedef void (*MessageFunc) (Message *msg); ++ ++struct _Message { ++ MessageFunc func; ++}; ++ ++static void ++message_proxy (Message *msg) ++{ ++ g_return_if_fail (msg->func != NULL); ++ ++ msg->func (msg); ++} ++ ++static gpointer ++create_thread_pool (void) ++{ ++ /* once created, run forever */ ++ return g_thread_pool_new ((GFunc) message_proxy, NULL, 1, FALSE, NULL); ++} ++ ++static void ++message_push (Message *msg) ++{ ++ static GOnce once = G_ONCE_INIT; ++ ++ g_once (&once, (GThreadFunc) create_thread_pool, NULL); ++ ++ g_thread_pool_push ((GThreadPool *) once.retval, msg, NULL); ++} ++ + /* Queues an alarm trigger for midnight so that we can load the next day's worth + * of alarms. + */ +@@ -219,47 +250,41 @@ + } + + struct _midnight_refresh_msg { ++ Message header; + gboolean remove; + }; + + /* Loads the alarms for the new day every midnight */ + static void +-midnight_refresh_async (EThread *e, AlarmMsg *msg, void *data) ++midnight_refresh_async (struct _midnight_refresh_msg *msg) + { +- struct _midnight_refresh_msg *list = msg->data; +- + d(printf("%s:%d (midnight_refresh_async) \n",__FILE__, __LINE__)); + + /* Re-load the alarms for all clients */ + g_hash_table_foreach (client_alarms_hash, add_client_alarms_cb, NULL); + + /* Re-schedule the midnight update */ +- if (list->remove && midnight_refresh_id != NULL) { ++ if (msg->remove && midnight_refresh_id != NULL) { + d(printf("%s:%d (midnight_refresh_async) - Reschedule the midnight update \n",__FILE__, __LINE__)); + alarm_remove (midnight_refresh_id); + midnight_refresh_id = NULL; + } + + queue_midnight_refresh (); ++ ++ g_slice_free (struct _midnight_refresh_msg, msg); + } + + static void + midnight_refresh_cb (gpointer alarm_id, time_t trigger, gpointer data) + { +- AlarmMsg *msg; +- struct _midnight_refresh_msg *list; +- +- /* These two structures will be freed by the msg destroy function*/ +- msg = malloc (sizeof (AlarmMsg)); +- msg->receive_msg = midnight_refresh_async; +- +- list = malloc (sizeof (struct _midnight_refresh_msg)); ++ struct _midnight_refresh_msg *msg; + +- list->remove = TRUE; +- msg->data = list; ++ msg = g_slice_new (struct _midnight_refresh_msg); ++ msg->header.func = (MessageFunc) midnight_refresh_async; ++ msg->remove = TRUE; + +- d(printf("%s:%d (midnight_refresh_cb) - Invoking task for midnight refresh\n",__FILE__, __LINE__)); +- e_thread_put(alarm_operation_thread, (EMsg *)msg); ++ message_push ((Message *) msg); + } + + /* Looks up a client in the client alarms hash table */ +@@ -657,6 +682,7 @@ + * alarms. + */ + struct _query_msg { ++ Message header; + ECal *client; + GList *objects; + gpointer data; +@@ -690,7 +716,7 @@ + } + + static void +-query_objects_changed_async (EThread *e, AlarmMsg *msg, void *data) ++query_objects_changed_async (struct _query_msg *msg) + { + ClientAlarms *ca; + time_t from, day_end; +@@ -699,13 +725,12 @@ + icaltimezone *zone; + CompQueuedAlarms *cqa; + GList *l; +- struct _query_msg *list = msg->data; + ECal *client; + GList *objects; + +- client = list->client; +- ca = list->data; +- objects = list->objects; ++ client = msg->client; ++ ca = msg->data; ++ objects = msg->objects; + + from = config_data_get_last_notification_time (); + if (from == -1) +@@ -799,43 +824,38 @@ + comp = NULL; + } + g_list_free (objects); ++ ++ g_slice_free (struct _query_msg, msg); + } + + static void + query_objects_changed_cb (ECal *client, GList *objects, gpointer data) + { +- AlarmMsg *msg; +- struct _query_msg *list; ++ struct _query_msg *msg; + +- /* These two structures will be freed by the msg destroy function*/ +- msg = malloc (sizeof (AlarmMsg)); +- msg->receive_msg = query_objects_changed_async; +- list = malloc (sizeof (struct _query_msg)); +- list->client = client; +- list->objects = duplicate_ical (objects); +- list->data = data; +- msg->data = list; +- +- d(printf("%s:%d (query_objects_changed_cb) - Posting a task\n",__FILE__, __LINE__)); +- e_thread_put(alarm_operation_thread, (EMsg *)msg); ++ msg = g_slice_new (struct _query_msg); ++ msg->header.func = (MessageFunc) query_objects_changed_async; ++ msg->client = client; ++ msg->objects = duplicate_ical (objects); ++ msg->data = data; + ++ message_push ((Message *) msg); + } + + /* Called when a calendar component is removed; we must delete its corresponding + * alarms. + */ + static void +-query_objects_removed_async (EThread *e, AlarmMsg *msg, void *data) ++query_objects_removed_async (struct _query_msg *msg) + { + ClientAlarms *ca; + GList *l; +- struct _query_msg *list = msg->data; + ECal *client; + GList *objects; + +- client = list->client; +- ca = list->data; +- objects = list->objects; ++ client = msg->client; ++ ca = msg->data; ++ objects = msg->objects; + + d(printf("%s:%d (query_objects_removed_async) - Removing %d objects\n",__FILE__, __LINE__, g_list_length(objects))); + +@@ -848,27 +868,22 @@ + } + + g_list_free (objects); ++ ++ g_slice_free (struct _query_msg, msg); + } + + static void + query_objects_removed_cb (ECal *client, GList *objects, gpointer data) + { +- AlarmMsg *msg; +- struct _query_msg *list; +- +- /* These two structures will be freed by the msg destroy function*/ +- msg = malloc (sizeof (AlarmMsg)); +- msg->receive_msg = query_objects_removed_async; +- +- list = malloc (sizeof (struct _query_msg)); +- list->client = client; +- list->objects = duplicate_ecal (objects); +- list->data = data; +- msg->data = list; ++ struct _query_msg *msg; + +- d(printf("%s:%d (query_objects_removed_cb) - Posting a task\n",__FILE__, __LINE__)); +- e_thread_put(alarm_operation_thread, (EMsg *)msg); ++ msg = g_slice_new (struct _query_msg); ++ msg->header.func = (MessageFunc) query_objects_removed_async; ++ msg->client = client; ++ msg->objects = duplicate_ecal (objects); ++ msg->data = data; + ++ message_push ((Message *) msg); + } + + +@@ -1010,20 +1025,19 @@ + } + + static void +-on_dialog_objs_removed_async (EThread *e, AlarmMsg *msg, void *data) ++on_dialog_objs_removed_async (struct _query_msg *msg) + { + const char *our_uid; + GList *l; + TrayIconData *tray_data; +- struct _query_msg *list = msg->data; + ECal *client; + GList *objects; + + d(printf("%s:%d (on_dialog_objs_removed_async)\n",__FILE__, __LINE__)); + +- client = list->client; +- tray_data = list->data; +- objects = list->objects; ++ client = msg->client; ++ tray_data = msg->data; ++ objects = msg->objects; + + e_cal_component_get_uid (tray_data->comp, &our_uid); + g_return_if_fail (our_uid && *our_uid); +@@ -1041,37 +1055,33 @@ + tray_data = NULL; + } + } ++ ++ g_slice_free (struct _query_msg, msg); + } + + static void + on_dialog_objs_removed_cb (ECal *client, GList *objects, gpointer data) + { +- AlarmMsg *msg; +- struct _query_msg *list; ++ struct _query_msg *msg; + +- /* These two structures will be freed by the msg destroy function*/ +- msg = malloc (sizeof (AlarmMsg)); +- msg->receive_msg = on_dialog_objs_removed_async; +- +- list = malloc (sizeof (struct _query_msg)); +- list->client = client; +- list->objects = objects; +- list->data = data; +- msg->data = list; ++ msg = g_slice_new (struct _query_msg); ++ msg->header.func = (MessageFunc) on_dialog_objs_removed_async; ++ msg->client = client; ++ msg->objects = objects; ++ msg->data = data; + +- d(printf("%s:%d (on_dialog_objs_removed_cb) - Posting a task \n",__FILE__, __LINE__)); +- e_thread_put(alarm_operation_thread, (EMsg *)msg); ++ message_push ((Message *) msg); + } + + struct _tray_cqa_msg { ++ Message header; + CompQueuedAlarms *cqa; + }; + + static void +-tray_list_remove_cqa_async(EThread *e, AlarmMsg *msg, void *data) ++tray_list_remove_cqa_async (struct _tray_cqa_msg *msg) + { +- struct _tray_cqa_msg *tmsg = msg->data; +- CompQueuedAlarms *cqa = tmsg->cqa; ++ CompQueuedAlarms *cqa = msg->cqa; + GList *list = tray_icons_list; + + d(printf("%s:%d (tray_list_remove_cqa_async) - Removing CQA %p from tray list\n",__FILE__, __LINE__, cqa)); +@@ -1110,28 +1120,25 @@ + gtk_tree_selection_select_iter (sel, &iter); + } + } ++ ++ g_slice_free (struct _tray_cqa_msg, msg); + } + + static void + tray_list_remove_cqa (CompQueuedAlarms *cqa) + { +- AlarmMsg *msg; +- struct _tray_cqa_msg *list; +- /* These two structures will be freed by the msg destroy function*/ +- msg = malloc (sizeof (AlarmMsg)); +- msg->receive_msg = tray_list_remove_cqa_async; +- +- list = malloc (sizeof (struct _tray_cqa_msg)); +- list->cqa = cqa; +- msg->data = list; ++ struct _tray_cqa_msg *msg; ++ ++ msg = g_slice_new (struct _tray_cqa_msg); ++ msg->header.func = (MessageFunc) tray_list_remove_cqa_async; ++ msg->cqa = cqa; + +- d(printf("%s:%d (tray_list_remove_cqa) - Posting a task\n",__FILE__, __LINE__)); +- e_thread_put(alarm_operation_thread, (EMsg *)msg); ++ message_push ((Message *) msg); + } + + /* Callback used from the alarm notify dialog */ + static void +-tray_list_remove_async(EThread *e, AlarmMsg *msg, void *data) ++tray_list_remove_async (Message *msg) + { + GList *list = tray_icons_list; + +@@ -1161,55 +1168,50 @@ + } else + list = list->next; + } ++ ++ g_slice_free (Message, msg); + } + + static void +-tray_list_remove_icons () ++tray_list_remove_icons (void) + { +- AlarmMsg *msg; +- +- /* These two structures will be freed by the msg destroy function*/ +- msg = malloc (sizeof (AlarmMsg)); +- msg->receive_msg = tray_list_remove_async; ++ Message *msg; + +- msg->data = NULL; ++ msg = g_slice_new (Message); ++ msg->func = tray_list_remove_async; + +- d(printf("%s:%d (tray_list_remove_icons) - Posting a task\n",__FILE__, __LINE__)); +- e_thread_put(alarm_operation_thread, (EMsg *)msg); ++ message_push (msg); + } + + struct _tray_msg { ++ Message header; + TrayIconData *data; + }; + + static void +-tray_list_remove_data_async(EThread *e, AlarmMsg *msg, void *data) ++tray_list_remove_data_async (struct _tray_msg *msg) + { +- struct _tray_msg *tmsg = msg->data; +- TrayIconData *tray_data = tmsg->data; ++ TrayIconData *tray_data = msg->data; + + d(printf("%s:%d (tray_list_remove_data_async) - Removing %p from tray list\n",__FILE__, __LINE__, tray_data)); + + tray_icons_list = g_list_remove_all (tray_icons_list, tray_data); + free_tray_icon_data (tray_data); + tray_data = NULL; ++ ++ g_slice_free (struct _tray_msg, msg); + } + + static void + tray_list_remove_data (TrayIconData *data) + { +- AlarmMsg *msg; +- struct _tray_msg *list; +- /* These two structures will be freed by the msg destroy function*/ +- msg = malloc (sizeof (AlarmMsg)); +- msg->receive_msg = tray_list_remove_data_async; +- +- list = malloc (sizeof (struct _tray_msg)); +- list->data = data; +- msg->data = list; ++ struct _tray_msg *msg; ++ ++ msg = g_slice_new (struct _tray_msg); ++ msg->header.func = (MessageFunc) tray_list_remove_data_async; ++ msg->data = data; + +- d(printf("%s:%d (tray_list_remove_data) - Posting a task\n",__FILE__, __LINE__)); +- e_thread_put(alarm_operation_thread, (EMsg *)msg); ++ message_push ((Message *) msg); + } + + static void +@@ -1416,29 +1418,24 @@ + /* Add a new data to tray list */ + + static void +-tray_list_add_async (EThread *e, AlarmMsg *msg, void *data) ++tray_list_add_async (struct _tray_msg *msg) + { +- struct _tray_msg *list = msg->data; +- d(printf("%s:%d (tray_list_add_async) - Add %p\n",__FILE__, __LINE__, list->data)); +- tray_icons_list = g_list_prepend (tray_icons_list, list->data); ++ d(printf("%s:%d (tray_list_add_async) - Add %p\n",__FILE__, __LINE__, msg->data)); ++ tray_icons_list = g_list_prepend (tray_icons_list, msg->data); ++ ++ g_slice_free (struct _tray_msg, msg); + } + + static void + tray_list_add_new (TrayIconData *data) + { +- AlarmMsg *msg; +- struct _tray_msg *list; ++ struct _tray_msg *msg; + +- /* These two structures will be freed by the msg destroy function*/ +- msg = malloc (sizeof (AlarmMsg)); +- msg->receive_msg = tray_list_add_async; +- +- list = malloc (sizeof (struct _tray_msg)); +- list->data = data; +- msg->data = list; +- +- d(printf("%s:%d (tray_list_add_new) - Posting a task\n",__FILE__, __LINE__)); +- e_thread_put(alarm_operation_thread, (EMsg *)msg); ++ msg = g_slice_new (struct _tray_msg); ++ msg->header.func = (MessageFunc) tray_list_add_async; ++ msg->data = data; ++ ++ message_push ((Message *) msg); + } + + /* Performs notification of a display alarm */ +@@ -1835,21 +1832,13 @@ + new_midnight = time_day_end_with_zone (time (NULL), zone); + + if (new_midnight > midnight) { +- AlarmMsg *msg; +- struct _midnight_refresh_msg *list; +- +- /* These two structures will be freed by the msg destroy function*/ +- msg = malloc (sizeof (AlarmMsg)); +- msg->receive_msg = midnight_refresh_async; +- +- list = malloc (sizeof (struct _midnight_refresh_msg)); ++ struct _midnight_refresh_msg *msg; + +- list->remove = FALSE; +- /* We dont need it. So set it to NULL */ +- msg->data = list; ++ msg = g_slice_new (struct _midnight_refresh_msg); ++ msg->header.func = (MessageFunc) midnight_refresh_async; ++ msg->remove = FALSE; + +- d(printf("%s:%d (check_midnight_refresh) - Posting a task to refresh\n",__FILE__, __LINE__)); +- e_thread_put(alarm_operation_thread, (EMsg *)msg); ++ message_push ((Message *) msg); + } + + return TRUE; +@@ -1980,14 +1969,15 @@ + } + + struct _alarm_client_msg { ++ Message header; + ECal *client; + }; + +-static void alarm_queue_add_async (EThread *e, AlarmMsg *msg, void *data) ++static void ++alarm_queue_add_async (struct _alarm_client_msg *msg) + { + ClientAlarms *ca; +- struct _alarm_client_msg *list = msg->data; +- ECal *client = list->client; ++ ECal *client = msg->client; + + g_return_if_fail (alarm_queue_inited); + g_return_if_fail (client != NULL); +@@ -2018,6 +2008,8 @@ + G_CALLBACK (cal_opened_cb), + ca); + } ++ ++ g_slice_free (struct _alarm_client_msg, msg); + } + + /** +@@ -2037,20 +2029,13 @@ + void + alarm_queue_add_client (ECal *client) + { +- AlarmMsg *msg; +- struct _alarm_client_msg *list; ++ struct _alarm_client_msg *msg; + +- /* These two structures will be freed by the msg destroy function*/ +- msg = malloc (sizeof (AlarmMsg)); +- msg->receive_msg = alarm_queue_add_async; +- +- list = malloc (sizeof (struct _alarm_client_msg)); +- list->client = client; +- g_object_ref (client); +- msg->data = list; ++ msg = g_slice_new (struct _alarm_client_msg); ++ msg->header.func = (MessageFunc) alarm_queue_add_async; ++ msg->client = g_object_ref (client); + +- d(printf("%s:%d (alarm_queue_add_client) - Posting a task\n",__FILE__, __LINE__)); +- e_thread_put(alarm_operation_thread, (EMsg *)msg); ++ message_push ((Message *) msg); + } + + /* Removes a component an its alarms */ +@@ -2102,11 +2087,10 @@ + * Removes a calendar client from the alarm queueing system. + **/ + static void +-alarm_queue_remove_async (EThread *e, AlarmMsg *msg, void *data) ++alarm_queue_remove_async (struct _alarm_client_msg *msg) + { + ClientAlarms *ca; +- struct _alarm_client_msg *list = msg->data; +- ECal *client = list->client; ++ ECal *client = msg->client; + + g_return_if_fail (alarm_queue_inited); + g_return_if_fail (client != NULL); +@@ -2143,6 +2127,8 @@ + g_free (ca); + + g_hash_table_remove (client_alarms_hash, client); ++ ++ g_slice_free (struct _alarm_client_msg, msg); + } + + /** alarm_queue_remove_client +@@ -2155,22 +2141,16 @@ + void + alarm_queue_remove_client (ECal *client, gboolean immediately) + { +- AlarmMsg *msg; +- struct _alarm_client_msg *list; ++ struct _alarm_client_msg *msg; + +- /* These two structures will be freed by the msg destroy function*/ +- msg = malloc (sizeof (AlarmMsg)); +- msg->receive_msg = alarm_queue_remove_async; +- +- list = malloc (sizeof (struct _alarm_client_msg)); +- list->client = client; +- msg->data = list; ++ msg = g_slice_new (struct _alarm_client_msg); ++ msg->header.func = (MessageFunc) alarm_queue_remove_async; ++ msg->client = client; + +- d(printf("%s:%d (alarm_queue_remove_client) - Posting a task\n",__FILE__, __LINE__)); + if (immediately) +- alarm_queue_remove_async (NULL, msg, NULL); ++ alarm_queue_remove_async (msg); + else +- e_thread_put(alarm_operation_thread, (EMsg *)msg); ++ message_push ((Message *) msg); + } + + /* Update non-time related variables for various structures on modification of an existing component +--- evolution-2.11.92/mail/em-folder-utils.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/em-folder-utils.c 2007-09-04 00:19:08.000000000 -0400 +@@ -85,7 +85,7 @@ + } + + struct _EMCopyFolders { +- struct _mail_msg msg; ++ MailMsg base; + + /* input data */ + CamelStore *fromstore; +@@ -97,18 +97,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; +@@ -116,7 +113,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); +@@ -156,8 +153,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 */ +@@ -166,16 +163,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) +@@ -186,7 +183,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); +@@ -227,10 +224,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); + +@@ -238,11 +233,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 +@@ -251,7 +247,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); +@@ -259,9 +255,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; + } +@@ -558,7 +554,7 @@ + } + + struct _EMCreateFolder { +- struct _mail_msg msg; ++ MailMsg base; + + /* input data */ + CamelStore *store; +@@ -582,41 +578,33 @@ + char *uri; + }; + +-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); +@@ -624,11 +612,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 + }; + + +@@ -649,7 +638,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); +@@ -660,8 +649,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.11.92/mail/mail-ops.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/mail-ops.c 2007-09-04 00:19:08.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 */ @@ -107,7 +1196,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelFolder *source_folder; /* where they come from */ GPtrArray *source_uids; /* uids to copy, or NULL == copy all */ -@@ -99,8 +99,8 @@ struct _fetch_mail_msg { +@@ -99,8 +99,8 @@ void *data; }; @@ -118,7 +1207,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m { return g_strdup (_("Filtering Selected Messages")); } -@@ -108,9 +108,8 @@ em_filter_folder_element_describe (struc +@@ -108,9 +108,8 @@ /* filter a folder, or a subset thereof, uses source_folder/source_uids */ /* this is shared with fetch_mail */ static void @@ -129,7 +1218,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelFolder *folder; GPtrArray *uids, *folder_uids = NULL; -@@ -137,15 +136,15 @@ em_filter_folder_element_filter (struct +@@ -137,15 +136,15 @@ else folder_uids = uids = camel_folder_get_uids (folder); @@ -148,7 +1237,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m camel_folder_thaw (folder); if (m->destination) -@@ -161,15 +160,13 @@ em_filter_folder_element_filter (struct +@@ -161,15 +160,13 @@ } static void @@ -166,7 +1255,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m if (m->source_folder) camel_object_unref (m->source_folder); -@@ -188,11 +185,12 @@ em_filter_folder_element_free (struct _m +@@ -188,11 +185,12 @@ mail_session_flush_filter_log (); } @@ -184,7 +1273,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; void -@@ -202,7 +200,7 @@ mail_filter_folder (CamelFolder *source_ +@@ -202,7 +200,7 @@ { struct _filter_mail_msg *m; @@ -193,7 +1282,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m m->source_folder = source_folder; camel_object_ref (source_folder); m->source_uids = uids; -@@ -221,7 +219,7 @@ mail_filter_folder (CamelFolder *source_ +@@ -221,7 +219,7 @@ camel_filter_driver_remove_rule_by_name (m->driver, "new-mail-notification"); } @@ -202,7 +1291,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m } /* convenience functions for it */ -@@ -260,17 +258,16 @@ uid_cachename_hack (CamelStore *store) +@@ -260,17 +258,16 @@ return filename; } @@ -224,7 +1313,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m int i; if (m->cancel) -@@ -283,20 +280,20 @@ fetch_mail_fetch (struct _mail_msg *mm) +@@ -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)) { @@ -250,7 +1339,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m if (folder) { /* this handles 'keep on server' stuff, if we have any new uid's to copy -@@ -322,17 +319,17 @@ fetch_mail_fetch (struct _mail_msg *mm) +@@ -322,17 +319,17 @@ camel_uid_cache_free_uids (cache_uids); fm->cache = cache; @@ -271,7 +1360,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m /* 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 @@ fetch_mail_fetch (struct _mail_msg *mm) +@@ -348,7 +345,7 @@ camel_uid_cache_destroy (cache); camel_folder_free_uids (folder, folder_uids); } else { @@ -280,7 +1369,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m } /* we unref the source folder here since we -@@ -372,31 +369,28 @@ fail: +@@ -372,31 +369,28 @@ } static void @@ -321,7 +1410,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; /* ouch, a 'do everything' interface ... */ -@@ -409,7 +403,7 @@ mail_fetch_mail (const char *source, int +@@ -409,7 +403,7 @@ struct _fetch_mail_msg *m; struct _filter_mail_msg *fm; @@ -330,7 +1419,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m fm = (struct _filter_mail_msg *)m; m->source_uri = g_strdup (source); fm->delete = !keep; -@@ -426,7 +420,7 @@ mail_fetch_mail (const char *source, int +@@ -426,7 +420,7 @@ if (status) camel_filter_driver_set_status_func (fm->driver, status, status_data); @@ -339,7 +1428,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m } /* ********************************************************************** */ -@@ -657,7 +651,7 @@ exit: +@@ -657,7 +651,7 @@ /* ** SEND MAIL QUEUE ***************************************************** */ struct _send_queue_msg { @@ -348,7 +1437,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelFolder *queue; char *destination; -@@ -689,9 +683,8 @@ report_status (struct _send_queue_msg *m +@@ -689,9 +683,8 @@ } static void @@ -359,7 +1448,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelFolder *sent_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT); GPtrArray *uids, *send_uids = NULL; CamelException ex; -@@ -739,17 +732,17 @@ send_queue_send(struct _mail_msg *mm) +@@ -739,17 +732,17 @@ if (camel_exception_is_set (&ex)) { if (ex.id != CAMEL_EXCEPTION_USER_CANCEL) { /* merge exceptions into one */ @@ -381,7 +1470,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m break; } } -@@ -759,7 +752,7 @@ send_queue_send(struct _mail_msg *mm) +@@ -759,7 +752,7 @@ if (j > 0) report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Failed to send %d of %d messages"), j, send_uids->len); @@ -390,7 +1479,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Canceled.")); else report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Complete.")); -@@ -785,19 +778,15 @@ send_queue_send(struct _mail_msg *mm) +@@ -785,19 +778,15 @@ } static void @@ -412,7 +1501,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m if (m->driver) camel_object_unref(m->driver); camel_object_unref(m->queue); -@@ -806,11 +795,12 @@ send_queue_free(struct _mail_msg *mm) +@@ -806,11 +795,12 @@ camel_operation_unref(m->cancel); } @@ -430,7 +1519,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; /* 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 @@ mail_send_queue(CamelFolder *queue, cons +@@ -823,7 +813,7 @@ { struct _send_queue_msg *m; @@ -439,7 +1528,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m m->queue = queue; camel_object_ref(queue); m->destination = g_strdup(destination); -@@ -839,13 +829,13 @@ mail_send_queue(CamelFolder *queue, cons +@@ -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); @@ -455,7 +1544,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelFolder *folder; CamelMimeMessage *message; -@@ -856,45 +846,40 @@ struct _append_msg { +@@ -856,45 +846,40 @@ void *data; }; @@ -514,7 +1603,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; void -@@ -911,7 +896,7 @@ mail_append_mail (CamelFolder *folder, C +@@ -911,7 +896,7 @@ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Mailer", "Evolution " VERSION SUB_VERSION " " VERSION_COMMENT); @@ -523,7 +1612,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m m->folder = folder; camel_object_ref(folder); m->message = message; -@@ -921,13 +906,13 @@ mail_append_mail (CamelFolder *folder, C +@@ -921,13 +906,13 @@ m->done = done; m->data = data; @@ -539,7 +1628,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelFolder *source; GPtrArray *uids; -@@ -939,24 +924,21 @@ struct _transfer_msg { +@@ -939,24 +924,21 @@ void *data; }; @@ -569,7 +1658,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m return; if (dest == m->source) { -@@ -968,7 +950,7 @@ transfer_messages_transfer (struct _mail +@@ -968,7 +950,7 @@ camel_folder_freeze (m->source); camel_folder_freeze (dest); @@ -578,7 +1667,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m /* make sure all deleted messages are marked as seen */ -@@ -987,29 +969,26 @@ transfer_messages_transfer (struct _mail +@@ -987,29 +969,26 @@ } static void @@ -617,16 +1706,16 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; void -@@ -1026,7 +1005,7 @@ mail_transfer_messages (CamelFolder *sou - g_assert(uids != NULL); - g_assert(dest_uri != NULL); +@@ -1026,7 +1005,7 @@ + g_return_if_fail (uids != NULL); + g_return_if_fail (dest_uri != NULL); - 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 @@ mail_transfer_messages (CamelFolder *sou +@@ -1036,13 +1015,13 @@ m->done = done; m->data = data; @@ -642,7 +1731,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelStore *store; CamelFolderInfo *info; -@@ -1050,10 +1029,9 @@ struct _get_folderinfo_msg { +@@ -1050,10 +1029,9 @@ void *data; }; @@ -655,7 +1744,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m char *ret, *name; name = camel_service_get_name((CamelService *)m->store, TRUE); -@@ -1063,25 +1041,22 @@ get_folderinfo_desc (struct _mail_msg *m +@@ -1063,25 +1041,22 @@ } static void @@ -686,7 +1775,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m g_free (url); } -@@ -1090,20 +1065,19 @@ get_folderinfo_got (struct _mail_msg *mm +@@ -1090,20 +1065,19 @@ } static void @@ -714,7 +1803,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; int -@@ -1112,19 +1086,19 @@ mail_get_folderinfo (CamelStore *store, +@@ -1112,19 +1086,19 @@ struct _get_folderinfo_msg *m; int id; @@ -739,7 +1828,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m return id; } -@@ -1196,7 +1170,7 @@ mail_build_attachment(CamelFolder *folde +@@ -1196,7 +1170,7 @@ presumably create a folder ... */ struct _get_folder_msg { @@ -748,7 +1837,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m char *uri; guint32 flags; -@@ -1205,71 +1179,64 @@ struct _get_folder_msg { +@@ -1205,71 +1179,64 @@ void *data; }; @@ -837,7 +1926,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m char *uri; CamelStore *store; -@@ -1277,50 +1244,43 @@ struct _get_store_msg { +@@ -1277,50 +1244,43 @@ void *data; }; @@ -900,7 +1989,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; int -@@ -1329,25 +1289,25 @@ mail_get_store (const char *uri, CamelOp +@@ -1329,25 +1289,25 @@ struct _get_store_msg *m; int id; @@ -932,7 +2021,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m char *uri; gboolean removed; -@@ -1355,18 +1315,15 @@ struct _remove_folder_msg { +@@ -1355,18 +1315,15 @@ void *data; }; @@ -954,7 +2043,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelStore *store; CamelFolder *folder; GPtrArray *uids; -@@ -1374,7 +1331,7 @@ remove_folder_get (struct _mail_msg *mm) +@@ -1374,7 +1331,7 @@ m->removed = FALSE; @@ -963,7 +2052,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m if (!folder) return; -@@ -1394,16 +1351,14 @@ remove_folder_get (struct _mail_msg *mm) +@@ -1394,16 +1351,14 @@ camel_store_unsubscribe_folder (store, folder->full_name, NULL); /* Then delete the folder from the store */ @@ -983,7 +2072,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m if (m->removed) { /* FIXME: Remove this folder from the folder cache ??? */ } -@@ -1413,18 +1368,17 @@ remove_folder_got (struct _mail_msg *mm) +@@ -1413,18 +1368,17 @@ } static void @@ -1009,7 +2098,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; void -@@ -1432,59 +1386,56 @@ mail_remove_folder (const char *uri, voi +@@ -1432,59 +1386,56 @@ { struct _remove_folder_msg *m; @@ -1087,7 +2176,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; void -@@ -1492,19 +1443,19 @@ mail_sync_folder(CamelFolder *folder, vo +@@ -1492,19 +1443,19 @@ { struct _sync_folder_msg *m; @@ -1110,7 +2199,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelStore *store; int expunge; -@@ -1512,9 +1463,9 @@ struct _sync_store_msg { +@@ -1512,9 +1463,9 @@ void *data; }; @@ -1122,7 +2211,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m char *uri, *res; uri = camel_url_to_string(((CamelService *)m->store)->url, CAMEL_URL_HIDE_ALL); -@@ -1527,33 +1478,31 @@ static char *sync_store_desc(struct _mai +@@ -1527,33 +1478,31 @@ return res; } @@ -1169,7 +2258,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; void -@@ -1561,36 +1510,37 @@ mail_sync_store(CamelStore *store, int e +@@ -1561,36 +1510,37 @@ { struct _sync_store_msg *m; @@ -1219,7 +2308,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; void -@@ -1598,35 +1548,36 @@ mail_refresh_folder(CamelFolder *folder, +@@ -1598,35 +1548,36 @@ { struct _sync_folder_msg *m; @@ -1268,7 +2357,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; void -@@ -1634,31 +1585,30 @@ mail_expunge_folder(CamelFolder *folder, +@@ -1634,31 +1585,30 @@ { struct _sync_folder_msg *m; @@ -1305,7 +2394,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m return g_strdup_printf (_("Emptying trash in \'%s\'"), m->account ? m->account->name : _("Local Folders")); #else -@@ -1666,49 +1616,48 @@ static char *empty_trash_desc(struct _ma +@@ -1666,49 +1616,48 @@ #endif } @@ -1370,7 +2459,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; void -@@ -1716,20 +1665,20 @@ mail_empty_trash(EAccount *account, void +@@ -1716,20 +1665,20 @@ { struct _empty_trash_msg *m; @@ -1394,7 +2483,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelFolder *folder; char *uid; -@@ -1739,32 +1688,28 @@ struct _get_message_msg { +@@ -1739,32 +1688,28 @@ CamelOperation *cancel; }; @@ -1436,7 +2525,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m g_free (m->uid); camel_object_unref (m->folder); camel_operation_unref (m->cancel); -@@ -1773,21 +1718,22 @@ static void get_message_free(struct _mai +@@ -1773,21 +1718,22 @@ camel_object_unref (m->message); } @@ -1466,7 +2555,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m m->folder = folder; camel_object_ref(folder); m->uid = g_strdup(uid); -@@ -1795,37 +1741,37 @@ mail_get_message(CamelFolder *folder, co +@@ -1795,37 +1741,37 @@ m->done = (void (*) (CamelFolder *, const char *, CamelMimeMessage *, void *)) done; m->cancel = camel_operation_new(NULL, NULL); @@ -1516,7 +2605,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m m->folder = folder; camel_object_ref(folder); m->uid = g_strdup(uid); -@@ -1833,13 +1779,13 @@ mail_get_messagex(CamelFolder *folder, c +@@ -1833,13 +1779,13 @@ m->done = (void (*) (CamelFolder *, const char *, CamelMimeMessage *, void *)) done; m->cancel = camel_operation_new(NULL, NULL); @@ -1532,7 +2621,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelFolder *folder; GPtrArray *uids; -@@ -1849,26 +1795,25 @@ struct _get_messages_msg { +@@ -1849,26 +1795,25 @@ void *data; }; @@ -1565,7 +2654,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m if (message == NULL) break; -@@ -1876,17 +1821,16 @@ static void get_messages_get(struct _mai +@@ -1876,17 +1821,16 @@ } } @@ -1587,7 +2676,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m int i; em_utils_uids_free (m->uids); -@@ -1898,11 +1842,12 @@ static void get_messages_free(struct _ma +@@ -1898,11 +1842,12 @@ camel_object_unref(m->folder); } @@ -1605,7 +2694,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; void -@@ -1912,7 +1857,7 @@ mail_get_messages(CamelFolder *folder, G +@@ -1912,7 +1857,7 @@ { struct _get_messages_msg *m; @@ -1614,7 +2703,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m m->folder = folder; camel_object_ref(folder); m->uids = uids; -@@ -1920,13 +1865,13 @@ mail_get_messages(CamelFolder *folder, G +@@ -1920,13 +1865,13 @@ m->data = data; m->done = done; @@ -1630,7 +2719,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelFolder *folder; GPtrArray *uids; -@@ -1935,10 +1880,9 @@ struct _save_messages_msg { +@@ -1935,10 +1880,9 @@ void *data; }; @@ -1643,7 +2732,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m return g_strdup_printf(ngettext("Saving %d message", "Saving %d messsages", m->uids->len), m->uids->len); -@@ -1977,9 +1921,8 @@ save_prepare_part (CamelMimePart *mime_p +@@ -1977,9 +1921,8 @@ } static void @@ -1654,7 +2743,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelStreamFilter *filtered_stream; CamelMimeFilterFrom *from_filter; CamelStream *stream; -@@ -1996,8 +1939,8 @@ save_messages_save (struct _mail_msg *mm +@@ -1996,8 +1939,8 @@ CamelMimeMessage *message; int pc = ((i+1) * 100) / m->uids->len; @@ -1665,7 +2754,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m if (message == NULL) break; -@@ -2009,7 +1952,7 @@ save_messages_save (struct _mail_msg *mm +@@ -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) { @@ -1674,7 +2763,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m _("Error saving messages to: %s:\n %s"), m->path, strerror(errno)); g_free(from); camel_object_unref((CamelObject *)message); -@@ -2023,28 +1966,27 @@ save_messages_save (struct _mail_msg *mm +@@ -2023,28 +1966,27 @@ camel_object_unref(stream); } @@ -1713,7 +2802,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; int -@@ -2054,7 +1996,7 @@ mail_save_messages(CamelFolder *folder, +@@ -2054,7 +1996,7 @@ struct _save_messages_msg *m; int id; @@ -1722,7 +2811,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m m->folder = folder; camel_object_ref(folder); m->uids = uids; -@@ -2062,8 +2004,8 @@ mail_save_messages(CamelFolder *folder, +@@ -2062,8 +2004,8 @@ m->data = data; m->done = done; @@ -1733,7 +2822,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m return id; } -@@ -2071,7 +2013,7 @@ mail_save_messages(CamelFolder *folder, +@@ -2071,7 +2013,7 @@ /* ** SAVE PART ******************************************************* */ struct _save_part_msg { @@ -1742,7 +2831,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelMimePart *part; char *path; -@@ -2080,27 +2022,27 @@ struct _save_part_msg { +@@ -2080,27 +2022,27 @@ gboolean readonly; }; @@ -1775,7 +2864,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m _("Cannot create output file: %s:\n %s"), m->path, g_strerror (errno)); return; -@@ -2110,7 +2052,7 @@ save_part_save (struct _mail_msg *mm) +@@ -2110,7 +2052,7 @@ if (camel_data_wrapper_decode_to_stream (content, stream) == -1 || camel_stream_flush (stream) == -1) @@ -1784,7 +2873,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m _("Could not write data: %s"), g_strerror (errno)); -@@ -2118,27 +2060,25 @@ save_part_save (struct _mail_msg *mm) +@@ -2118,27 +2060,25 @@ } static void @@ -1821,7 +2910,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; int -@@ -2147,7 +2087,7 @@ mail_save_part (CamelMimePart *part, con +@@ -2147,7 +2087,7 @@ { struct _save_part_msg *m; int id; @@ -1830,7 +2919,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m m->part = part; camel_object_ref (part); m->path = g_strdup (path); -@@ -2155,8 +2095,8 @@ mail_save_part (CamelMimePart *part, con +@@ -2155,8 +2095,8 @@ m->done = done; m->readonly = readonly; @@ -1841,7 +2930,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m return id; } -@@ -2165,7 +2105,7 @@ mail_save_part (CamelMimePart *part, con +@@ -2165,7 +2105,7 @@ /* ** PREPARE OFFLINE ***************************************************** */ struct _prep_offline_msg { @@ -1850,7 +2939,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelOperation *cancel; char *uri; -@@ -2173,22 +2113,22 @@ struct _prep_offline_msg { +@@ -2173,22 +2113,22 @@ void *data; }; @@ -1878,7 +2967,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m } /* prepare_for_offline should do this? */ /* of course it should all be atomic, but ... */ -@@ -2200,28 +2140,27 @@ static void prep_offline_do(struct _mail +@@ -2200,28 +2140,27 @@ camel_operation_unregister(m->cancel); } @@ -1917,7 +3006,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; void -@@ -2232,7 +2171,7 @@ mail_prep_offline(const char *uri, +@@ -2232,7 +2171,7 @@ { struct _prep_offline_msg *m; @@ -1926,7 +3015,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m m->cancel = cancel; if (cancel) camel_operation_ref(cancel); -@@ -2240,13 +2179,13 @@ mail_prep_offline(const char *uri, +@@ -2240,13 +2179,13 @@ m->data = data; m->done = done; @@ -1942,7 +3031,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m CamelStore *store; gboolean offline; -@@ -2254,9 +2193,9 @@ struct _set_offline_msg { +@@ -2254,9 +2193,9 @@ void *data; }; @@ -1954,7 +3043,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m char *service_name = camel_service_get_name (CAMEL_SERVICE (m->store), TRUE); char *msg; -@@ -2266,61 +2205,59 @@ static char *set_offline_desc(struct _ma +@@ -2266,61 +2205,59 @@ return msg; } @@ -2033,7 +3122,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; int -@@ -2337,61 +2274,59 @@ mail_store_set_offline (CamelStore *stor +@@ -2337,61 +2274,59 @@ if (offline) camel_service_cancel_connect (CAMEL_SERVICE (store)); @@ -2116,7 +3205,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; int -@@ -2404,14 +2339,14 @@ mail_store_prepare_offline (CamelStore * +@@ -2404,14 +2339,14 @@ * thread won't get queued behind a hung connect op. */ @@ -2134,7 +3223,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m return id; } -@@ -2428,7 +2363,7 @@ mail_execute_shell_command (CamelFilterD +@@ -2428,7 +2363,7 @@ /* Async service-checking/authtype-lookup code. */ struct _check_msg { @@ -2143,7 +3232,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m char *url; CamelProviderType type; -@@ -2438,51 +2373,47 @@ struct _check_msg { +@@ -2438,51 +2373,47 @@ void *data; }; @@ -2209,7 +3298,7 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m }; int -@@ -2491,14 +2422,14 @@ mail_check_service(const char *url, Came +@@ -2491,14 +2422,14 @@ struct _check_msg *m; int id; @@ -2227,2329 +3316,8 @@ diff -up evolution-2.11.91/mail/mail-ops.c.kill-ethread evolution-2.11.91/mail/m return id; } -diff -up evolution-2.11.91/mail/em-folder-utils.c.kill-ethread evolution-2.11.91/mail/em-folder-utils.c ---- evolution-2.11.91/mail/em-folder-utils.c.kill-ethread 2007-08-09 02:46:46.000000000 -0400 -+++ evolution-2.11.91/mail/em-folder-utils.c 2007-08-29 17:39:34.000000000 -0400 -@@ -85,7 +85,7 @@ emfu_is_special_local_folder (const char - } - - struct _EMCopyFolders { -- struct _mail_msg msg; -+ MailMsg base; - - /* input data */ - CamelStore *fromstore; -@@ -97,18 +97,15 @@ struct _EMCopyFolders { - 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; -@@ -116,7 +113,7 @@ emft_copy_folders__copy (struct _mail_ms - 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); -@@ -156,8 +153,8 @@ emft_copy_folders__copy (struct _mail_ms - 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 */ -@@ -166,16 +163,16 @@ emft_copy_folders__copy (struct _mail_ms - - 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) -@@ -186,7 +183,7 @@ emft_copy_folders__copy (struct _mail_ms - } - } - -- 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); -@@ -227,10 +224,8 @@ emft_copy_folders__copy (struct _mail_ms - } - - 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); - -@@ -238,11 +233,12 @@ emft_copy_folders__free (struct _mail_ms - 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 -@@ -251,7 +247,7 @@ em_folder_utils_copy_folders(CamelStore - 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); -@@ -259,9 +255,9 @@ em_folder_utils_copy_folders(CamelStore - 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; - } -@@ -558,7 +554,7 @@ em_folder_utils_rename_folder (CamelFold - } - - struct _EMCreateFolder { -- struct _mail_msg msg; -+ MailMsg base; - - /* input data */ - CamelStore *store; -@@ -582,41 +578,33 @@ struct _EMCreateFolderTempData - char *uri; - }; - --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); -@@ -624,11 +612,12 @@ emfu_create_folder__free (struct _mail_m - 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 - }; - - -@@ -649,7 +638,7 @@ emfu_create_folder_real (CamelStore *sto - 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); -@@ -660,8 +649,8 @@ emfu_create_folder_real (CamelStore *sto - - 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; - } -diff -up evolution-2.11.91/mail/importers/elm-importer.c.kill-ethread evolution-2.11.91/mail/importers/elm-importer.c ---- evolution-2.11.91/mail/importers/elm-importer.c.kill-ethread 2007-07-05 02:09:35.000000000 -0400 -+++ evolution-2.11.91/mail/importers/elm-importer.c 2007-08-29 17:39:34.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 @@ elm_supported(EImport *ei, EImportTarget - 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 MailImporterSpecial elm_special_f - }; - - 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 @@ elm_import_import(struct _mail_msg *mm) - } - - 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 @@ elm_import_imported(struct _mail_msg *mm - } - - 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 @@ elm_status_timeout(void *data) - 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 @@ mail_importer_elm_import(EImport *ei, EI - 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 @@ mail_importer_elm_import(EImport *ei, EI - 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; - } -diff -up evolution-2.11.91/mail/importers/mail-importer.c.kill-ethread evolution-2.11.91/mail/importers/mail-importer.c ---- evolution-2.11.91/mail/importers/mail-importer.c.kill-ethread 2007-07-05 02:09:35.000000000 -0400 -+++ evolution-2.11.91/mail/importers/mail-importer.c 2007-08-29 17:39:34.000000000 -0400 -@@ -132,7 +132,7 @@ struct _BonoboObject *mail_importer_fact - } - - struct _import_mbox_msg { -- struct _mail_msg msg; -+ MailMsg base; - - char *path; - char *uri; -@@ -142,8 +142,8 @@ struct _import_mbox_msg { - 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 @@ decode_mozilla_status(const char *tmp) - } - - 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 @@ import_mbox_import(struct _mail_msg *mm) - 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 @@ import_mbox_import(struct _mail_msg *mm) - 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 @@ fail1: - } - - 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 @@ mail_importer_import_mbox(const char *pa - 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 @@ mail_importer_import_mbox(const char *pa - 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 @@ mail_importer_import_mbox_sync(const cha - { - 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 @@ mail_importer_import_mbox_sync(const cha - 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 { -diff -up evolution-2.11.91/mail/importers/pine-importer.c.kill-ethread evolution-2.11.91/mail/importers/pine-importer.c ---- evolution-2.11.91/mail/importers/pine-importer.c.kill-ethread 2007-07-05 02:09:35.000000000 -0400 -+++ evolution-2.11.91/mail/importers/pine-importer.c 2007-08-29 17:39:34.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 @@ import_contacts(void) - 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 MailImporterSpecial pine_special_ - }; - - 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 @@ pine_import_import(struct _mail_msg *mm) - } - - 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 @@ pine_import_imported(struct _mail_msg *m - } - - 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 @@ pine_status_timeout(void *data) - 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 @@ mail_importer_pine_import(EImport *ei, E - 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 @@ mail_importer_pine_import(EImport *ei, E - m->status_lock = g_mutex_new(); - m->status = camel_operation_new(pine_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; - } -diff -up evolution-2.11.91/mail/em-utils.c.kill-ethread evolution-2.11.91/mail/em-utils.c ---- evolution-2.11.91/mail/em-utils.c.kill-ethread 2007-08-29 17:39:34.000000000 -0400 -+++ evolution-2.11.91/mail/em-utils.c 2007-08-29 17:39:34.000000000 -0400 -@@ -1912,7 +1912,7 @@ em_utils_in_addressbook(CamelInternetAdd - ESource *source = s->data; - GList *contacts; - EBook *book; -- void *hook; -+ GHook *hook; - - d(printf(" checking '%s'\n", e_source_get_uri(source))); - -diff -up evolution-2.11.91/mail/mail-vfolder.c.kill-ethread evolution-2.11.91/mail/mail-vfolder.c ---- evolution-2.11.91/mail/mail-vfolder.c.kill-ethread 2007-07-05 02:09:37.000000000 -0400 -+++ evolution-2.11.91/mail/mail-vfolder.c 2007-08-29 17:39:34.000000000 -0400 -@@ -21,7 +21,7 @@ - */ - - #include -- -+#include - #include - - #include -@@ -75,7 +75,7 @@ static void rule_changed(FilterRule *rul - /* ********************************************************************** */ - - struct _setup_msg { -- struct _mail_msg msg; -+ MailMsg base; - - CamelFolder *folder; - char *query; -@@ -83,18 +83,15 @@ struct _setup_msg { - 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 @@ vfolder_setup_do(struct _mail_msg *mm) - 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 @@ vfolder_setup_do(struct _mail_msg *mm) - } - - 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 @@ vfolder_setup_free (struct _mail_msg *mm - 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 @@ vfolder_setup(CamelFolder *folder, const - 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 @@ vfolder_setup(CamelFolder *folder, const - /* ********************************************************************** */ - - 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 @@ vfolder_adduri_desc(struct _mail_msg *mm - } - - 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 @@ vfolder_adduri_do(struct _mail_msg *mm) - } - - 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 @@ vfolder_adduri_do(struct _mail_msg *mm) - } - - 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 @@ vfolder_adduri(const char *uri, GList *f - 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; - } -@@ -447,7 +435,7 @@ mail_vfolder_add_uri(CamelStore *store, - 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 @@ mail_vfolder_delete_uri(CamelStore *stor - - 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 @@ mail_vfolder_rename_uri(CamelStore *stor - 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); -diff -up evolution-2.11.91/mail/em-format-html.c.kill-ethread evolution-2.11.91/mail/em-format-html.c ---- evolution-2.11.91/mail/em-format-html.c.kill-ethread 2007-08-27 02:14:40.000000000 -0400 -+++ evolution-2.11.91/mail/em-format-html.c 2007-08-29 17:39:34.000000000 -0400 -@@ -165,7 +165,7 @@ efh_gtkhtml_destroy(GtkHTML *html, EMFor - 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; - } - -@@ -1202,7 +1202,7 @@ efh_builtin_init(EMFormatHTMLClass *efhc - - /* 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; -@@ -1212,14 +1212,15 @@ struct _format_msg { - 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; -@@ -1304,10 +1305,9 @@ static void efh_format_do(struct _mail_m - ((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; -@@ -1315,10 +1315,9 @@ static void efh_format_done(struct _mail - 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) { -@@ -1334,11 +1333,12 @@ static void efh_format_free(struct _mail - 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 -@@ -1349,7 +1349,7 @@ efh_format_timeout(struct _format_msg *m - struct _EMFormatHTMLPrivate *p = efh->priv; - - if (m->format->html == NULL) { -- mail_msg_free(m); -+ mail_msg_unref(m); - return FALSE; - } - -@@ -1377,7 +1377,7 @@ efh_format_timeout(struct _format_msg *m - 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 = gtk_html_begin(efh->html); -@@ -1401,8 +1401,8 @@ efh_format_timeout(struct _format_msg *m - 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; -@@ -1426,11 +1426,11 @@ static void efh_format_clone(EMFormat *e - 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; -diff -up evolution-2.11.91/mail/em-folder-properties.c.kill-ethread evolution-2.11.91/mail/em-folder-properties.c ---- evolution-2.11.91/mail/em-folder-properties.c.kill-ethread 2007-07-05 02:09:37.000000000 -0400 -+++ evolution-2.11.91/mail/em-folder-properties.c 2007-08-29 17:39:34.000000000 -0400 -@@ -386,7 +386,7 @@ em_folder_properties_show(GtkWindow *par - } - - 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); - } -diff -up evolution-2.11.91/mail/em-folder-tree.c.kill-ethread evolution-2.11.91/mail/em-folder-tree.c ---- evolution-2.11.91/mail/em-folder-tree.c.kill-ethread 2007-08-24 02:49:43.000000000 -0400 -+++ evolution-2.11.91/mail/em-folder-tree.c 2007-08-29 17:39:34.000000000 -0400 -@@ -835,7 +835,7 @@ fail: - /* 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; -@@ -860,17 +860,16 @@ emft_drop_folder(struct _DragDataReceive - - d(printf(" * Drop folder '%s' onto '%s'\n", m->selection->data, m->full_name)); - -- if (!(src = mail_tool_uri_to_folder((char *)m->selection->data, 0, &m->msg.ex))) -+ if (!(src = mail_tool_uri_to_folder((char *)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; - -@@ -894,9 +893,8 @@ emft_drop_async_desc (struct _mail_msg * - } - - 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 */ -@@ -904,14 +902,14 @@ emft_drop_async_drop (struct _mail_msg * - /* 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 */ -@@ -929,9 +927,8 @@ emft_drop_async_drop (struct _mail_msg * - } - - 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; - - /* ?? */ -@@ -939,7 +936,7 @@ emft_drop_async_done (struct _mail_msg * - 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; - } - -@@ -947,10 +944,8 @@ emft_drop_async_done (struct _mail_msg * - } - - 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); -@@ -959,18 +954,19 @@ emft_drop_async_free (struct _mail_msg * - 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 -@@ -997,7 +993,7 @@ emft_drop_popup_cancel(EPopup *ep, EPopu - struct _DragDataReceivedAsync *m = data; - - m->aborted = TRUE; -- mail_msg_free(&m->msg); -+ mail_msg_unref(m); - } - - static EPopupItem emft_drop_popup_menu[] = { -@@ -1053,7 +1049,7 @@ tree_drag_data_received(GtkWidget *widge - 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; -@@ -1692,7 +1688,7 @@ dump_fi (CamelFolderInfo *fi, int depth) - #endif - - struct _EMFolderTreeGetFolderInfo { -- struct _mail_msg msg; -+ MailMsg base; - - /* input data */ - GtkTreeRowReference *root; -@@ -1705,10 +1701,9 @@ struct _EMFolderTreeGetFolderInfo { - 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); -@@ -1718,18 +1713,16 @@ emft_get_folder_info__desc(struct _mail_ - } - - 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; -@@ -1757,7 +1750,7 @@ emft_get_folder_info__got (struct _mail_ - 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); -@@ -1812,10 +1805,8 @@ emft_get_folder_info__got (struct _mail_ - } - - 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); -@@ -1824,11 +1815,12 @@ emft_get_folder_info__free (struct _mail - 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 -@@ -1915,7 +1907,7 @@ emft_tree_row_expanded (GtkTreeView *tre - - 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; -@@ -1924,7 +1916,7 @@ emft_tree_row_expanded (GtkTreeView *tre - 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 -diff -up evolution-2.11.91/mail/em-folder-browser.c.kill-ethread evolution-2.11.91/mail/em-folder-browser.c ---- evolution-2.11.91/mail/em-folder-browser.c.kill-ethread 2007-08-27 01:55:18.000000000 -0400 -+++ evolution-2.11.91/mail/em-folder-browser.c 2007-08-29 17:39:34.000000000 -0400 -@@ -851,7 +851,7 @@ get_view_query (ESearchBar *esb) - - - struct _setup_msg { -- struct _mail_msg msg; -+ MailMsg base; - - CamelFolder *folder; - char *query; -@@ -859,16 +859,15 @@ struct _setup_msg { - 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")); - } - - 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; - -@@ -879,12 +878,12 @@ vfolder_setup_do(struct _mail_msg *mm) - 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; - } -@@ -908,17 +907,13 @@ vfolder_setup_do(struct _mail_msg *mm) - } - - 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); -@@ -939,11 +934,12 @@ vfolder_setup_free (struct _mail_msg *mm - 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 */ -@@ -953,15 +949,15 @@ vfolder_setup(CamelFolder *folder, const - 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; - } -diff -up evolution-2.11.91/mail/message-list.c.kill-ethread evolution-2.11.91/mail/message-list.c ---- evolution-2.11.91/mail/message-list.c.kill-ethread 2007-08-09 02:46:47.000000000 -0400 -+++ evolution-2.11.91/mail/message-list.c 2007-08-29 17:39:34.000000000 -0400 -@@ -1841,7 +1841,7 @@ ml_tree_drag_data_get (ETree *tree, int - /* TODO: merge this with the folder tree stuff via empopup targets */ - /* Drop handling */ - struct _drop_msg { -- struct _mail_msg msg; -+ MailMsg base; - - GdkDragContext *context; - -@@ -1858,11 +1858,9 @@ struct _drop_msg { - unsigned int aborted:1; - }; - --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 -@@ -1870,13 +1868,11 @@ ml_drop_async_desc (struct _mail_msg *mm - } - - 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); -@@ -1888,9 +1884,8 @@ ml_drop_async_drop(struct _mail_msg *mm) - } - - 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; - - /* ?? */ -@@ -1898,7 +1893,7 @@ ml_drop_async_done(struct _mail_msg *mm) - 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; - } - -@@ -1906,10 +1901,8 @@ ml_drop_async_done(struct _mail_msg *mm) - } - - 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); - -@@ -1917,18 +1910,19 @@ ml_drop_async_free(struct _mail_msg *mm) - g_free(m->selection); - } - --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 - }; - - 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); - } - - static void -@@ -1955,7 +1949,7 @@ ml_drop_popup_cancel(EPopup *ep, EPopupI - struct _drop_msg *m = data; - - m->aborted = TRUE; -- mail_msg_free(&m->msg); -+ mail_msg_unref(m); - } - - static EPopupItem ml_drop_popup_menu[] = { -@@ -1985,7 +1979,7 @@ ml_tree_drag_data_received (ETree *tree, - if (!ml->folder || data->data == NULL || data->length == -1) - return; - -- 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; -@@ -3718,7 +3712,7 @@ save_hide_state (MessageList *ml) - - /* ** REGENERATE MESSAGELIST ********************************************** */ - struct _regen_list_msg { -- struct _mail_msg msg; -+ MailMsg base; - - int complete; - -@@ -3746,16 +3740,15 @@ struct _regen_list_msg { - - */ - --static char * --regen_list_describe (struct _mail_msg *mm, gint complete) -+static gchar * -+regen_list_desc (struct _regen_list_msg *m) - { - return g_strdup (_("Generating message list")); - } - - static void --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; -@@ -3785,7 +3778,7 @@ regen_list_regen (struct _mail_msg *mm) - } 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; - -@@ -3795,23 +3788,23 @@ regen_list_regen (struct _mail_msg *mm) - 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); - } - } - -- 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); -@@ -3886,7 +3879,7 @@ regen_list_regen (struct _mail_msg *mm) - - 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) -@@ -3915,17 +3908,15 @@ regen_list_regen (struct _mail_msg *mm) - } - - 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; - - if (!m->complete) - return; - -- if (camel_operation_cancel_check(mm->cancel)) -+ if (camel_operation_cancel_check(m->base.cancel)) - return; - - if (m->ml->folder != m->folder) -@@ -3976,9 +3967,8 @@ regen_list_regened (struct _mail_msg *mm - } - - static void --regen_list_free (struct _mail_msg *mm) -+regen_list_free (struct _regen_list_msg *m) - { -- struct _regen_list_msg *m = (struct _regen_list_msg *)mm; - int i; - - e_profile_event_emit("list.regenerated", m->folder->full_name, 0); -@@ -4006,11 +3996,12 @@ regen_list_free (struct _mail_msg *mm) - g_object_unref(m->ml); - } - --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 -@@ -4020,7 +4011,7 @@ ml_regen_timeout(struct _regen_list_msg - - 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 (m); - - m->ml->regen_timeout_msg = NULL; - m->ml->regen_timeout_id = 0; -@@ -4036,7 +4027,7 @@ mail_regen_cancel(MessageList *ml) - GList *l = ml->regen; - - while (l) { -- struct _mail_msg *mm = l->data; -+ MailMsg *mm = l->data; - - if (mm->cancel) - camel_operation_cancel(mm->cancel); -@@ -4048,7 +4039,7 @@ mail_regen_cancel(MessageList *ml) - 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; - } - } -@@ -4083,7 +4074,7 @@ mail_regen_list (MessageList *ml, const - } - #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); -diff -up evolution-2.11.91/mail/em-sync-stream.h.kill-ethread evolution-2.11.91/mail/em-sync-stream.h ---- evolution-2.11.91/mail/em-sync-stream.h.kill-ethread 2007-07-05 02:09:39.000000000 -0400 -+++ evolution-2.11.91/mail/em-sync-stream.h 2007-08-29 17:39:34.000000000 -0400 -@@ -29,41 +29,45 @@ requests are always handled in the main - #ifndef EM_SYNC_STREAM_H - #define EM_SYNC_STREAM_H - --#ifdef __cplusplus --extern "C" { --#pragma } --#endif /* __cplusplus */ -- --#define EM_SYNC_STREAM_TYPE (em_sync_stream_get_type ()) --#define EM_SYNC_STREAM(obj) (CAMEL_CHECK_CAST((obj), EM_SYNC_STREAM_TYPE, EMSyncStream)) --#define EM_SYNC_STREAM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), EM_SYNC_STREAM_TYPE, EMSyncStreamClass)) --#define EM_IS_SYNC_STREAM(o) (CAMEL_CHECK_TYPE((o), EM_SYNC_STREAM_TYPE)) -- - #include - #include - --typedef struct _EMSyncStream { -- CamelStream parent_stream; -- -- struct _EMSyncStreamPrivate *priv; -+#define EM_SYNC_STREAM_TYPE \ -+ (em_sync_stream_get_type ()) -+#define EM_SYNC_STREAM(obj) \ -+ (CAMEL_CHECK_CAST \ -+ ((obj), EM_SYNC_STREAM_TYPE, EMSyncStream)) -+#define EM_SYNC_STREAM_CLASS(cls) \ -+ (CAMEL_CHECK_CLASS_CAST \ -+ ((cls), EM_SYNC_STREAM_TYPE, EMSyncStreamClass)) -+#define EM_IS_SYNC_STREAM(obj) \ -+ (CAMEL_CHECK_TYPE ((obj), EM_SYNC_STREAM_TYPE)) -+ -+G_BEGIN_DECLS -+ -+typedef struct _EMSyncStream EMSyncStream; -+typedef struct _EMSyncStreamClass EMSyncStreamClass; -+ -+struct _EMSyncStream { -+ CamelStream parent; -+ GString *buffer; -+ gboolean cancel; -+}; - -- int cancel; --} EMSyncStream; -- --typedef struct { -+struct _EMSyncStreamClass { - CamelStreamClass parent_class; - -- ssize_t (*sync_write) (CamelStream *stream, const char *buffer, size_t n); -- int (*sync_close) (CamelStream *stream); -- int (*sync_flush) (CamelStream *stream); -- --} EMSyncStreamClass; -- --CamelType em_sync_stream_get_type (void); --void em_sync_stream_set_buffer_size(EMSyncStream *, size_t size); -- --#ifdef __cplusplus --} --#endif /* __cplusplus */ -+ gssize (*sync_write) (CamelStream *stream, -+ const gchar *string, -+ gsize len); -+ int (*sync_close) (CamelStream *stream); -+ int (*sync_flush) (CamelStream *stream); -+}; -+ -+CamelType em_sync_stream_get_type (void); -+void em_sync_stream_set_buffer_size (EMSyncStream *stream, -+ gsize size); -+ -+G_END_DECLS - - #endif /* EM_SYNC_STREAM_H */ -diff -up evolution-2.11.91/mail/em-format-html-print.c.kill-ethread evolution-2.11.91/mail/em-format-html-print.c ---- evolution-2.11.91/mail/em-format-html-print.c.kill-ethread 2007-07-08 22:46:50.000000000 -0400 -+++ evolution-2.11.91/mail/em-format-html-print.c 2007-08-29 17:39:34.000000000 -0400 -@@ -228,7 +228,7 @@ em_format_html_print_message (EMFormatHT - g_object_ref (efhp); - - mail_get_message ( -- folder, uid, emfhp_got_message, efhp, mail_thread_new); -+ folder, uid, emfhp_got_message, efhp, mail_msg_unordered_push); - } - - void -diff -up evolution-2.11.91/mail/em-sync-stream.c.kill-ethread evolution-2.11.91/mail/em-sync-stream.c ---- evolution-2.11.91/mail/em-sync-stream.c.kill-ethread 2007-07-05 02:09:38.000000000 -0400 -+++ evolution-2.11.91/mail/em-sync-stream.c 2007-08-29 17:39:34.000000000 -0400 -@@ -25,42 +25,17 @@ - #include - #endif - --#include -+#include "em-sync-stream.h" -+ - #include --#include -+#include - #include --#include --#include "em-sync-stream.h" -+#include - - #include "mail-mt.h" - --#define LOG_STREAM -- --#define d(x) -- - #define EMSS_CLASS(x) ((EMSyncStreamClass *)(((CamelObject *)(x))->klass)) - --struct _EMSyncStreamPrivate { -- /* FIXME: use a single data port/gui channel for all instances */ -- /* TODO: possibly just use one of the mail-mt ports ... */ -- struct _EMsgPort *data_port, *reply_port; -- struct _GIOChannel *gui_channel; -- guint gui_watch; -- -- char *buf_data; -- int buf_used; -- int buf_size; -- --#ifdef LOG_STREAM -- FILE *logfd; --#endif --}; -- --#ifdef LOG_STREAM --int dolog; --#endif -- --/* Should probably expose messages to outside world ... so subclasses can extend */ - enum _write_msg_t { - EMSS_WRITE, - EMSS_FLUSH, -@@ -68,275 +43,168 @@ enum _write_msg_t { - }; - - struct _write_msg { -- EMsg msg; -+ EMSyncStream *emss; -+ EFlag *done; - - enum _write_msg_t op; - -- const char *data; -- size_t n; -+ const gchar *string; -+ gsize len; - }; - --static void em_sync_stream_class_init (EMSyncStreamClass *klass); --static void em_sync_stream_init (CamelObject *object); --static void em_sync_stream_finalize (CamelObject *object); -- --static ssize_t stream_write(CamelStream *stream, const char *buffer, size_t n); --static int stream_close(CamelStream *stream); --static int stream_flush(CamelStream *stream); -- - static CamelStreamClass *parent_class = NULL; - --CamelType --em_sync_stream_get_type (void) --{ -- static CamelType type = CAMEL_INVALID_TYPE; -- -- if (type == CAMEL_INVALID_TYPE) { --#ifdef LOG_STREAM -- dolog = getenv("EVOLUTION_MAIL_LOG_HTML") != NULL; --#endif -- type = camel_type_register (CAMEL_STREAM_TYPE, -- "EMSyncStream", -- sizeof (EMSyncStream), -- sizeof (EMSyncStreamClass), -- (CamelObjectClassInitFunc) em_sync_stream_class_init, -- NULL, -- (CamelObjectInitFunc) em_sync_stream_init, -- (CamelObjectFinalizeFunc) em_sync_stream_finalize); -- } -- -- return type; --} -- --static void --em_sync_stream_class_init (EMSyncStreamClass *klass) --{ -- CamelStreamClass *stream_class = CAMEL_STREAM_CLASS (klass); -- -- parent_class = (CamelStreamClass *) CAMEL_STREAM_TYPE; -- -- /* virtual method overload */ -- stream_class->write = stream_write; -- stream_class->flush = stream_flush; -- stream_class->close = stream_close; --} -- - static gboolean --emcs_gui_received(GIOChannel *source, GIOCondition cond, void *data) -+emss_process_message (struct _write_msg *msg) - { -- EMSyncStream *emss = data; -- struct _EMSyncStreamPrivate *p = emss->priv; -- struct _write_msg *msg; -- -- d(printf("%p: gui sync op job waiting\n", emss)); -- -- msg = (struct _write_msg *)e_msgport_get(p->data_port); -- /* Should never happen ... */ -- if (msg == NULL) -- return TRUE; -- -- d(printf("%p: running sync op %d\n", emss, msg->op)); -- -- /* force out any pending data before doing anything else */ -- if (p->buf_used > 0) { -- EMSS_CLASS(emss)->sync_write((CamelStream *)emss, p->buf_data, p->buf_used); --#ifdef LOG_STREAM -- if (p->logfd) -- fwrite(p->buf_data, 1, p->buf_used, p->logfd); --#endif -- p->buf_used = 0; -- } -+ struct _EMSyncStream *emss = msg->emss; - -- /* FIXME: need to handle return values */ -+ /* Force out any pending data before doing anything else. */ -+ if (emss->buffer != NULL && emss->buffer->len > 0) { -+ EMSS_CLASS (emss)->sync_write ( -+ CAMEL_STREAM (emss), emss->buffer->str, -+ emss->buffer->len); -+ g_string_set_size (emss->buffer, 0); -+ } - - switch (msg->op) { -- case EMSS_WRITE: -- EMSS_CLASS(emss)->sync_write((CamelStream *)emss, msg->data, msg->n); --#ifdef LOG_STREAM -- if (p->logfd) -- fwrite(msg->data, 1, msg->n, p->logfd); --#endif -- break; -- case EMSS_FLUSH: -- EMSS_CLASS(emss)->sync_flush((CamelStream *)emss); -- break; -- case EMSS_CLOSE: -- EMSS_CLASS(emss)->sync_close((CamelStream *)emss); --#ifdef LOG_STREAM -- if (p->logfd) { -- fclose(p->logfd); -- p->logfd = NULL; -- } --#endif -- break; -+ case EMSS_WRITE: -+ EMSS_CLASS (emss)->sync_write ( -+ CAMEL_STREAM (emss), msg->string, msg->len); -+ break; -+ case EMSS_FLUSH: -+ EMSS_CLASS (emss)->sync_flush ( -+ CAMEL_STREAM (emss)); -+ break; -+ case EMSS_CLOSE: -+ EMSS_CLASS (emss)->sync_close ( -+ CAMEL_STREAM (emss)); -+ break; - } -- -- e_msgport_reply((EMsg *)msg); -- d(printf("%p: gui sync op jobs done\n", emss)); -- -- return TRUE; --} -- --static void --em_sync_stream_init (CamelObject *object) --{ -- EMSyncStream *emss = (EMSyncStream *)object; -- struct _EMSyncStreamPrivate *p; -- -- p = emss->priv = g_malloc0(sizeof(*p)); - -- p->data_port = e_msgport_new(); -- p->reply_port = e_msgport_new(); -+ e_flag_set (msg->done); - --#ifndef G_OS_WIN32 -- p->gui_channel = g_io_channel_unix_new(e_msgport_fd(p->data_port)); --#else -- p->gui_channel = g_io_channel_win32_new_socket(e_msgport_fd(p->data_port)); --#endif -- p->gui_watch = g_io_add_watch(p->gui_channel, G_IO_IN, emcs_gui_received, emss); -- --#ifdef LOG_STREAM -- if (dolog) { -- char name[32]; -- static int count; -- -- sprintf(name, "sync-stream.%d.html", count++); -- printf("Saving raw data stream to '%s'\n", name); -- p->logfd = fopen(name, "w"); -- } --#endif -- -- d(printf("%p: new emss\n", emss)); -+ return FALSE; - } - - static void --sync_op(EMSyncStream *emss, enum _write_msg_t op, const char *data, size_t n) -+emss_sync_op (EMSyncStream *emss, enum _write_msg_t op, -+ const gchar *string, gsize len) - { -- struct _EMSyncStreamPrivate *p = emss->priv; - struct _write_msg msg; -- EMsg *reply_msg; -- -- d(printf("%p: launching sync op %d\n", emss, op)); - -- /* we do everything synchronous, we should never have any locks, and -- this prevents overflow from banked up data */ -- -- msg.msg.reply_port = p->reply_port; -+ msg.done = e_flag_new (); -+ msg.emss = emss; - msg.op = op; -- msg.data = data; -- msg.n = n; -- -- e_msgport_put(p->data_port, &msg.msg); -- reply_msg = e_msgport_wait(p->reply_port); -- g_assert(reply_msg == &msg.msg); -- -- d(printf("%p: returned sync op %d\n", emss, op)); --} -- --static void --em_sync_stream_finalize (CamelObject *object) --{ -- EMSyncStream *emss = (EMSyncStream *)object; -- struct _EMSyncStreamPrivate *p = emss->priv; -- -- /* TODO: is this stuff safe to do in another thread? */ -- g_source_remove(p->gui_watch); -- g_io_channel_unref(p->gui_channel); -+ msg.string = string; -+ msg.len = len; - -- e_msgport_destroy(p->data_port); -- e_msgport_destroy(p->reply_port); -+ camel_object_ref (emss); - -- p->data_port = NULL; -- p->reply_port = NULL; -+ g_idle_add ((GSourceFunc) emss_process_message, &msg); - -- g_free(p->buf_data); -+ e_flag_wait (msg.done); -+ e_flag_free (msg.done); - --#ifdef LOG_STREAM -- if (p->logfd) -- fclose(p->logfd); --#endif -- -- g_free(p); -+ camel_object_unref (emss); - } - --static ssize_t --stream_write (CamelStream *stream, const char *buffer, size_t n) -+static gssize -+emss_stream_write (CamelStream *stream, const gchar *string, gsize len) - { - EMSyncStream *emss = EM_SYNC_STREAM (stream); -- struct _EMSyncStreamPrivate *p = emss->priv; - - if (emss->cancel) - return -1; - -- if (pthread_equal(pthread_self(), mail_gui_thread)) { -- EMSS_CLASS(emss)->sync_write(stream, buffer, n); --#ifdef LOG_STREAM -- if (p->logfd) -- fwrite(buffer, 1, n, p->logfd); --#endif -- } else if (p->buf_size > 0) { -- size_t left = p->buf_size-p->buf_used; -- -- if (n >= left) { -- sync_op(emss, EMSS_WRITE, buffer, n); -- } else { -- memcpy(p->buf_data + p->buf_used, buffer, n); -- p->buf_used += n; -- } -+ if (mail_in_main_thread ()) { -+ EMSS_CLASS (emss)->sync_write (stream, string, len); -+ } else if (emss->buffer != NULL) { -+ if (len < (emss->buffer->allocated_len - emss->buffer->len)) -+ g_string_append_len (emss->buffer, string, len); -+ else -+ emss_sync_op (emss, EMSS_WRITE, string, len); - } else { -- sync_op(emss, EMSS_WRITE, buffer, n); -+ emss_sync_op(emss, EMSS_WRITE, string, len); - } - -- return (ssize_t) n; -+ return (gssize) len; - } - - static int --stream_flush(CamelStream *stream) -+emss_stream_flush (CamelStream *stream) - { -- EMSyncStream *emss = (EMSyncStream *)stream; -+ EMSyncStream *emss = EM_SYNC_STREAM (stream); - - if (emss->cancel) - return -1; - -- if (pthread_equal(pthread_self(), mail_gui_thread)) -- return ((EMSyncStreamClass *)(((CamelObject *)emss)->klass))->sync_flush(stream); -+ if (mail_in_main_thread ()) -+ return EMSS_CLASS (emss)->sync_flush (stream); - else -- sync_op(emss, EMSS_FLUSH, NULL, 0); -+ emss_sync_op (emss, EMSS_FLUSH, NULL, 0); - - return 0; - } - - static int --stream_close(CamelStream *stream) -+emss_stream_close (CamelStream *stream) - { -- EMSyncStream *emss = (EMSyncStream *)stream; -+ EMSyncStream *emss = EM_SYNC_STREAM (stream); - - if (emss->cancel) - return -1; - -- d(printf("%p: closing stream\n", stream)); -- -- if (pthread_equal(pthread_self(), mail_gui_thread)) { --#ifdef LOG_STREAM -- if (emss->priv->logfd) { -- fclose(emss->priv->logfd); -- emss->priv->logfd = NULL; -- } --#endif -- return ((EMSyncStreamClass *)(((CamelObject *)emss)->klass))->sync_close(stream); -- } else -- sync_op(emss, EMSS_CLOSE, NULL, 0); -+ if (mail_in_main_thread ()) -+ return EMSS_CLASS (emss)->sync_close (stream); -+ else -+ emss_sync_op (emss, EMSS_CLOSE, NULL, 0); - - return 0; - } - --void --em_sync_stream_set_buffer_size(EMSyncStream *emss, size_t size) -+static void -+em_sync_stream_class_init (EMSyncStreamClass *class) -+{ -+ CamelStreamClass *stream_class = CAMEL_STREAM_CLASS (class); -+ -+ parent_class = (CamelStreamClass *) CAMEL_STREAM_TYPE; -+ -+ stream_class->write = emss_stream_write; -+ stream_class->flush = emss_stream_flush; -+ stream_class->close = emss_stream_close; -+} -+ -+static void -+em_sync_stream_finalize (EMSyncStream *emss) -+{ -+ if (emss->buffer != NULL) -+ g_string_free (emss->buffer, TRUE); -+} -+ -+CamelType -+em_sync_stream_get_type (void) - { -- struct _EMSyncStreamPrivate *p = emss->priv; -+ static CamelType type = CAMEL_INVALID_TYPE; -+ -+ if (G_UNLIKELY (type == CAMEL_INVALID_TYPE)) -+ type = camel_type_register ( -+ CAMEL_STREAM_TYPE, -+ "EMSyncStream", -+ sizeof (EMSyncStream), -+ sizeof (EMSyncStreamClass), -+ (CamelObjectClassInitFunc) em_sync_stream_class_init, -+ NULL, -+ (CamelObjectInitFunc) NULL, -+ (CamelObjectFinalizeFunc) em_sync_stream_finalize); - -- g_free(p->buf_data); -- p->buf_data = g_malloc(size); -- p->buf_size = size; -- p->buf_used = 0; -+ return type; -+} -+ -+void -+em_sync_stream_set_buffer_size (EMSyncStream *emss, gsize size) -+{ -+ if (emss->buffer != NULL) -+ g_string_free (emss->buffer, TRUE); -+ emss->buffer = g_string_sized_new (size); - } -diff -up evolution-2.11.91/mail/em-subscribe-editor.c.kill-ethread evolution-2.11.91/mail/em-subscribe-editor.c ---- evolution-2.11.91/mail/em-subscribe-editor.c.kill-ethread 2007-08-24 02:49:43.000000000 -0400 -+++ evolution-2.11.91/mail/em-subscribe-editor.c 2007-08-29 17:39:34.000000000 -0400 -@@ -175,7 +175,7 @@ sub_unref(EMSubscribe *sub) - /* ** Subscribe folder operation **************************************** */ - - struct _zsubscribe_msg { -- struct _mail_msg msg; -+ MailMsg base; - - EMSubscribe *sub; - EMSubscribeNode *node; -@@ -184,20 +184,18 @@ struct _zsubscribe_msg { - }; - - 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 @@ sub_folder_subscribed (struct _mail_msg - 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 @@ sub_folder_subscribed (struct _mail_msg - /* 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; -- e_thread_put(mail_thread_new, (EMsg *)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); -@@ -237,19 +235,18 @@ sub_folder_subscribed (struct _mail_msg - } - - 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 @@ sub_subscribe_folder (EMSubscribe *sub, - 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 (m); - } else { - d(printf("queueing subscribe folder '%s'\n", spath)); - e_dlist_addtail(&sub->subscribe, (EDListNode *)m); -@@ -341,7 +338,7 @@ sub_fill_level(EMSubscribe *sub, CamelFo - /* async query of folderinfo */ - - struct _emse_folderinfo_msg { -- struct _mail_msg msg; -+ MailMsg base; - - int seq; - -@@ -351,31 +348,29 @@ struct _emse_folderinfo_msg { - }; - - 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 @@ sub_folderinfo_got(struct _mail_msg *mm) - } - - 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_folderinfo_free(struct _mail_msg *mm - 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 @@ sub_queue_fill_level(EMSubscribe *sub, E - 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 (m); - return id; - } - -@@ -573,7 +567,7 @@ sub_destroy(GtkWidget *w, EMSubscribe *s - 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); - } -diff -up evolution-2.11.91/mail/mail-mt.h.kill-ethread evolution-2.11.91/mail/mail-mt.h ---- evolution-2.11.91/mail/mail-mt.h.kill-ethread 2007-07-05 02:09:38.000000000 -0400 -+++ evolution-2.11.91/mail/mail-mt.h 2007-08-29 17:39:34.000000000 -0400 +--- evolution-2.11.92/mail/mail-mt.h.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/mail-mt.h 2007-09-04 00:19:08.000000000 -0400 @@ -23,47 +23,64 @@ #ifndef _MAIL_MT #define _MAIL_MT @@ -4636,7 +3404,7 @@ diff -up evolution-2.11.91/mail/mail-mt.h.kill-ethread evolution-2.11.91/mail/ma /* request a string/password */ char *mail_get_password (CamelService *service, const char *prompt, -@@ -112,24 +129,6 @@ void *mail_call_main(mail_call_t type, M +@@ -112,24 +129,6 @@ void mail_enable_stop(void); void mail_disable_stop(void); @@ -4661,186 +3429,255 @@ diff -up evolution-2.11.91/mail/mail-mt.h.kill-ethread evolution-2.11.91/mail/ma /* A generic proxy event for anything that can be proxied during the life of the mailer (almost nothing) */ /* Note that almost all objects care about the lifecycle of their events, so this cannot be used */ extern MailAsyncEvent *mail_async_event; -diff -up evolution-2.11.91/mail/mail-ops.h.kill-ethread evolution-2.11.91/mail/mail-ops.h ---- evolution-2.11.91/mail/mail-ops.h.kill-ethread 2007-07-05 02:09:38.000000000 -0400 -+++ evolution-2.11.91/mail/mail-ops.h 2007-08-29 17:39:34.000000000 -0400 -@@ -30,13 +30,14 @@ extern "C" { - #pragma } - #endif /* __cplusplus */ +--- evolution-2.11.92/mail/mail-component.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/mail-component.c 2007-09-04 00:19:08.000000000 -0400 +@@ -1005,7 +1005,7 @@ + if (camel_url_get_param(url, "uid") != NULL) { + char *curi = em_uri_to_camel(uri); -+#include "mail-mt.h" -+ - #include "camel/camel-store.h" - #include "camel/camel-folder.h" - #include "camel/camel-filter-driver.h" - #include "camel/camel-mime-message.h" - #include "camel/camel-operation.h" +- mail_get_folder(curi, 0, handleuri_got_folder, url, mail_thread_new); ++ mail_get_folder(curi, 0, handleuri_got_folder, url, mail_msg_unordered_push); + g_free(curi); + } else { + g_warning("email uri's must include a uid parameter"); +--- evolution-2.11.92/mail/mail-vfolder.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/mail-vfolder.c 2007-09-04 00:19:08.000000000 -0400 +@@ -21,7 +21,7 @@ + */ --#include "libedataserver/e-msgport.h" - #include "libedataserver/e-account.h" + #include +- ++#include + #include - void mail_append_mail (CamelFolder *folder, CamelMimeMessage *message, CamelMessageInfo *info, -@@ -55,12 +56,12 @@ void mail_transfer_messages (CamelFolder - void mail_get_message (CamelFolder *folder, const char *uid, - void (*done) (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data), - void *data, -- EThread *thread); -+ MailMsgDispatchFunc dispatch); + #include +@@ -75,7 +75,7 @@ + /* ********************************************************************** */ - 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); - - /* get several messages */ - void mail_get_messages (CamelFolder *folder, GPtrArray *uids, -@@ -70,7 +71,7 @@ void mail_get_messages (CamelFolder *fol - /* same for a folder */ - int mail_get_folder (const char *uri, guint32 flags, - void (*done) (char *uri, CamelFolder *folder, void *data), void *data, -- EThread *thread); -+ MailMsgDispatchFunc dispatch); - - /* and for a store */ - int mail_get_store (const char *uri, CamelOperation *op, -diff -up evolution-2.11.91/mail/em-composer-utils.c.kill-ethread evolution-2.11.91/mail/em-composer-utils.c ---- evolution-2.11.91/mail/em-composer-utils.c.kill-ethread 2007-08-24 02:49:43.000000000 -0400 -+++ evolution-2.11.91/mail/em-composer-utils.c 2007-08-29 17:39:34.000000000 -0400 -@@ -553,7 +553,7 @@ em_utils_composer_save_draft_cb (EMsgCom - strcmp (account->drafts_folder_uri, default_drafts_folder_uri) != 0) { - int id; - -- id = mail_get_folder (account->drafts_folder_uri, 0, save_draft_folder, &folder, mail_thread_new); -+ id = mail_get_folder (account->drafts_folder_uri, 0, save_draft_folder, &folder, mail_msg_unordered_push); - mail_msg_wait (id); - - if (!folder || !account->enabled) { -@@ -1104,7 +1104,7 @@ em_utils_redirect_message_by_uid (CamelF - g_return_if_fail (CAMEL_IS_FOLDER (folder)); - g_return_if_fail (uid != NULL); - -- mail_get_message (folder, uid, redirect_msg, NULL, mail_thread_new); -+ mail_get_message (folder, uid, redirect_msg, NULL, mail_msg_unordered_push); - } - - static void -@@ -1135,7 +1135,7 @@ em_utils_handle_receipt (CamelFolder *fo - } - - if (msg == NULL) { -- mail_get_messagex(folder, uid, emu_handle_receipt_message, NULL, mail_thread_new); -+ mail_get_messagex(folder, uid, emu_handle_receipt_message, NULL, mail_msg_unordered_push); - camel_message_info_free(info); - return; - } -@@ -1949,7 +1949,7 @@ em_utils_reply_to_message(CamelFolder *f - rd->source = source; - if (rd->source) - g_object_ref(rd->source); -- mail_get_message(folder, uid, reply_to_message, rd, mail_thread_new); -+ mail_get_message(folder, uid, reply_to_message, rd, mail_msg_unordered_push); - - return; - } -@@ -2121,5 +2121,5 @@ em_utils_post_reply_to_message_by_uid (C - g_return_if_fail (CAMEL_IS_FOLDER (folder)); - g_return_if_fail (uid != NULL); - -- mail_get_message (folder, uid, post_reply_to_message, NULL, mail_thread_new); -+ mail_get_message (folder, uid, post_reply_to_message, NULL, mail_msg_unordered_push); - } -diff -up evolution-2.11.91/mail/mail-folder-cache.c.kill-ethread evolution-2.11.91/mail/mail-folder-cache.c ---- evolution-2.11.91/mail/mail-folder-cache.c.kill-ethread 2007-08-09 02:46:46.000000000 -0400 -+++ evolution-2.11.91/mail/mail-folder-cache.c 2007-08-29 17:39:34.000000000 -0400 -@@ -862,15 +862,14 @@ update_folders(CamelStore *store, CamelF - - - struct _ping_store_msg { + struct _setup_msg { - struct _mail_msg msg; + MailMsg base; - - CamelStore *store; + + CamelFolder *folder; + char *query; +@@ -83,18 +83,15 @@ + GList *sources_folder; }; -static char * --ping_store_desc (struct _mail_msg *mm, int done) +-vfolder_setup_desc(struct _mail_msg *mm, int done) +static gchar * -+ping_store_desc (struct _ping_store_msg *m) ++vfolder_setup_desc (struct _setup_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; - -@@ -881,10 +880,9 @@ ping_store_desc (struct _mail_msg *mm, i +- struct _setup_msg *m = (struct _setup_msg *)mm; +- + return g_strdup_printf(_("Setting up Search Folder: %s"), m->folder->full_name); } static void --ping_store_ping (struct _mail_msg *mm) -+ping_store_exec (struct _ping_store_msg *m) +-vfolder_setup_do(struct _mail_msg *mm) ++vfolder_setup_exec (struct _setup_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) && -@@ -895,22 +893,21 @@ ping_store_ping (struct _mail_msg *mm) - online = TRUE; +- 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; } - if (online) -- camel_store_noop (m->store, &mm->ex); -+ camel_store_noop (m->store, &m->base.ex); +@@ -135,17 +132,13 @@ } static void --ping_store_free (struct _mail_msg *mm) -+ping_store_free (struct _ping_store_msg *m) +-vfolder_setup_done(struct _mail_msg *mm) ++vfolder_setup_done (struct _setup_msg *m) { -- struct _ping_store_msg *m = (struct _ping_store_msg *) mm; -- - camel_object_unref (m->store); +- struct _setup_msg *m = (struct _setup_msg *)mm; +- +- m = m; } --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 +-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 }; - static void -@@ -922,11 +919,11 @@ ping_store (gpointer key, gpointer val, - if (CAMEL_SERVICE (store)->status != CAMEL_SERVICE_CONNECTED) - return; + /* sources_uri should be camel uri's */ +@@ -180,15 +174,15 @@ + struct _setup_msg *m; + int id; -- 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); +- 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; -- e_thread_put (mail_thread_queued_slow, (EMsg *) m); +- 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 gboolean -@@ -971,7 +968,7 @@ mail_note_store(CamelStore *store, Camel - int hook = 0; + 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; - g_assert(CAMEL_IS_STORE(store)); -- g_assert(pthread_equal(pthread_self(), mail_gui_thread)); -+ g_assert(mail_in_main_thread()); +- 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); - LOCK(info_lock); + return id; + } +@@ -447,7 +435,7 @@ + return; + } -diff -up evolution-2.11.91/mail/em-folder-view.c.kill-ethread evolution-2.11.91/mail/em-folder-view.c ---- evolution-2.11.91/mail/em-folder-view.c.kill-ethread 2007-08-27 01:55:18.000000000 -0400 -+++ evolution-2.11.91/mail/em-folder-view.c 2007-08-29 17:39:34.000000000 -0400 +- g_return_if_fail (pthread_equal(pthread_self(), mail_gui_thread)); ++ g_return_if_fail (mail_in_main_thread()); + + is_ignore = uri_is_ignore(store, curi); + +@@ -543,7 +531,7 @@ + + d(printf ("Deleting uri to check: %s\n", uri)); + +- g_return_if_fail (pthread_equal(pthread_self(), mail_gui_thread)); ++ g_return_if_fail (mail_in_main_thread()); + + changed = g_string_new (""); + +@@ -627,7 +615,7 @@ + if (context == NULL || uri_is_spethal(store, cfrom) || uri_is_spethal(store, cto)) + return; + +- g_return_if_fail (pthread_equal(pthread_self(), mail_gui_thread)); ++ g_return_if_fail (mail_in_main_thread()); + + from = em_uri_from_camel(cfrom); + to = em_uri_from_camel(cto); +--- evolution-2.11.92/mail/em-folder-view.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/em-folder-view.c 2007-09-04 00:19:08.000000000 -0400 @@ -71,6 +71,7 @@ #include @@ -4849,7 +3686,7 @@ diff -up evolution-2.11.91/mail/em-folder-view.c.kill-ethread evolution-2.11.91/ #include "menus/gal-view-etable.h" #include "menus/gal-view-factory-etable.h" -@@ -777,7 +778,7 @@ emfv_got_folder(char *uri, CamelFolder * +@@ -777,7 +778,7 @@ static void emfv_set_folder_uri(EMFolderView *emfv, const char *uri) { @@ -4858,7 +3695,7 @@ diff -up evolution-2.11.91/mail/em-folder-view.c.kill-ethread evolution-2.11.91/ } static void -@@ -1752,7 +1753,7 @@ filter_type_uid (CamelFolder *folder, co +@@ -1752,7 +1753,7 @@ data->type = type; data->source = source; @@ -4867,7 +3704,7 @@ diff -up evolution-2.11.91/mail/em-folder-view.c.kill-ethread evolution-2.11.91/ } static void -@@ -1850,7 +1851,7 @@ vfolder_type_uid (CamelFolder *folder, c +@@ -1850,7 +1851,7 @@ data->type = type; data->uri = g_strdup (uri); @@ -4876,7 +3713,7 @@ diff -up evolution-2.11.91/mail/em-folder-view.c.kill-ethread evolution-2.11.91/ } static void -@@ -2418,7 +2419,7 @@ emfv_message_selected_timeout(void *data +@@ -2418,7 +2419,7 @@ emfv->displayed_uid); gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK); */ @@ -4885,9 +3722,535 @@ diff -up evolution-2.11.91/mail/em-folder-view.c.kill-ethread evolution-2.11.91/ } else { e_profile_event_emit("goto.empty", "", 0); g_free(emfv->priv->selected_uid); -diff -up evolution-2.11.91/mail/mail-session.c.kill-ethread evolution-2.11.91/mail/mail-session.c ---- evolution-2.11.91/mail/mail-session.c.kill-ethread 2007-08-27 01:55:18.000000000 -0400 -+++ evolution-2.11.91/mail/mail-session.c 2007-08-29 17:39:34.000000000 -0400 +--- evolution-2.11.92/mail/em-folder-properties.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/em-folder-properties.c 2007-09-04 00:19:08.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.11.92/mail/mail-send-recv.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/mail-send-recv.c 2007-09-04 00:19:08.000000000 -0400 +@@ -770,23 +770,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; + CamelException ex = CAMEL_EXCEPTION_INITIALISER; +@@ -808,17 +807,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++) +@@ -827,11 +823,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 +@@ -864,13 +861,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 (m); + } else { + receive_done ("", data); + } +--- evolution-2.11.92/mail/em-format-html.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/em-format-html.c 2007-09-04 00:19:08.000000000 -0400 +@@ -165,7 +165,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; + } + +@@ -1205,7 +1205,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; +@@ -1215,14 +1215,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; +@@ -1307,10 +1308,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; +@@ -1318,10 +1318,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) { +@@ -1337,11 +1336,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 +@@ -1352,7 +1352,7 @@ + struct _EMFormatHTMLPrivate *p = efh->priv; + + if (m->format->html == NULL) { +- mail_msg_free(m); ++ mail_msg_unref(m); + return FALSE; + } + +@@ -1380,7 +1380,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 = gtk_html_begin(efh->html); +@@ -1404,8 +1404,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; +@@ -1429,11 +1429,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.11.92/mail/em-sync-stream.h.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/em-sync-stream.h 2007-09-04 00:19:08.000000000 -0400 +@@ -29,41 +29,45 @@ + #ifndef EM_SYNC_STREAM_H + #define EM_SYNC_STREAM_H + +-#ifdef __cplusplus +-extern "C" { +-#pragma } +-#endif /* __cplusplus */ +- +-#define EM_SYNC_STREAM_TYPE (em_sync_stream_get_type ()) +-#define EM_SYNC_STREAM(obj) (CAMEL_CHECK_CAST((obj), EM_SYNC_STREAM_TYPE, EMSyncStream)) +-#define EM_SYNC_STREAM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), EM_SYNC_STREAM_TYPE, EMSyncStreamClass)) +-#define EM_IS_SYNC_STREAM(o) (CAMEL_CHECK_TYPE((o), EM_SYNC_STREAM_TYPE)) +- + #include + #include + +-typedef struct _EMSyncStream { +- CamelStream parent_stream; +- +- struct _EMSyncStreamPrivate *priv; ++#define EM_SYNC_STREAM_TYPE \ ++ (em_sync_stream_get_type ()) ++#define EM_SYNC_STREAM(obj) \ ++ (CAMEL_CHECK_CAST \ ++ ((obj), EM_SYNC_STREAM_TYPE, EMSyncStream)) ++#define EM_SYNC_STREAM_CLASS(cls) \ ++ (CAMEL_CHECK_CLASS_CAST \ ++ ((cls), EM_SYNC_STREAM_TYPE, EMSyncStreamClass)) ++#define EM_IS_SYNC_STREAM(obj) \ ++ (CAMEL_CHECK_TYPE ((obj), EM_SYNC_STREAM_TYPE)) ++ ++G_BEGIN_DECLS ++ ++typedef struct _EMSyncStream EMSyncStream; ++typedef struct _EMSyncStreamClass EMSyncStreamClass; ++ ++struct _EMSyncStream { ++ CamelStream parent; ++ GString *buffer; ++ gboolean cancel; ++}; + +- int cancel; +-} EMSyncStream; +- +-typedef struct { ++struct _EMSyncStreamClass { + CamelStreamClass parent_class; + +- ssize_t (*sync_write) (CamelStream *stream, const char *buffer, size_t n); +- int (*sync_close) (CamelStream *stream); +- int (*sync_flush) (CamelStream *stream); +- +-} EMSyncStreamClass; +- +-CamelType em_sync_stream_get_type (void); +-void em_sync_stream_set_buffer_size(EMSyncStream *, size_t size); +- +-#ifdef __cplusplus +-} +-#endif /* __cplusplus */ ++ gssize (*sync_write) (CamelStream *stream, ++ const gchar *string, ++ gsize len); ++ int (*sync_close) (CamelStream *stream); ++ int (*sync_flush) (CamelStream *stream); ++}; ++ ++CamelType em_sync_stream_get_type (void); ++void em_sync_stream_set_buffer_size (EMSyncStream *stream, ++ gsize size); ++ ++G_END_DECLS + + #endif /* EM_SYNC_STREAM_H */ +--- evolution-2.11.92/mail/em-subscribe-editor.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/em-subscribe-editor.c 2007-09-04 00:19:08.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; +- e_thread_put(mail_thread_new, (EMsg *)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); +@@ -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 (m); + } else { + d(printf("queueing subscribe folder '%s'\n", spath)); + e_dlist_addtail(&sub->subscribe, (EDListNode *)m); +@@ -341,7 +338,7 @@ + /* async query of folderinfo */ + + struct _emse_folderinfo_msg { +- struct _mail_msg msg; ++ MailMsg base; + + 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 (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.11.92/mail/em-format-html-print.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/em-format-html-print.c 2007-09-04 00:19:08.000000000 -0400 +@@ -228,7 +228,7 @@ + g_object_ref (efhp); + + mail_get_message ( +- folder, uid, emfhp_got_message, efhp, mail_thread_new); ++ folder, uid, emfhp_got_message, efhp, mail_msg_unordered_push); + } + + void +--- evolution-2.11.92/mail/mail-session.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/mail-session.c 2007-09-04 00:19:08.000000000 -0400 @@ -35,7 +35,7 @@ #include @@ -4897,7 +4260,7 @@ diff -up evolution-2.11.91/mail/mail-session.c.kill-ethread evolution-2.11.91/ma #include /* FIXME: this is where camel_init is defined, it shouldn't include everything else */ #include -@@ -264,148 +264,145 @@ forget_password (CamelSession *session, +@@ -264,148 +264,145 @@ /* ********************************************************************** */ @@ -5106,7 +4469,7 @@ diff -up evolution-2.11.91/mail/mail-session.c.kill-ethread evolution-2.11.91/ma if (cancel) { - r = (struct _user_message_msg *)e_msgport_wait(user_message_reply); -- g_assert(m == r); +- g_return_val_if_fail (m == r, FALSE); + e_flag_wait (m->done); + result = m->result; + mail_msg_unref (m); @@ -5127,7 +4490,7 @@ diff -up evolution-2.11.91/mail/mail-session.c.kill-ethread evolution-2.11.91/ma } static CamelFolder * -@@ -541,7 +538,7 @@ get_filter_driver (CamelSession *session +@@ -541,7 +538,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 */ @@ -5136,7 +4499,7 @@ diff -up evolution-2.11.91/mail/mail-session.c.kill-ethread evolution-2.11.91/ma static void *ms_thread_msg_new(CamelSession *session, CamelSessionThreadOps *ops, unsigned int size) { -@@ -550,7 +547,7 @@ static void *ms_thread_msg_new(CamelSess +@@ -550,7 +547,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) { @@ -5145,7 +4508,7 @@ diff -up evolution-2.11.91/mail/mail-session.c.kill-ethread evolution-2.11.91/ma msg->data = m; camel_operation_unref(msg->op); -@@ -563,7 +560,7 @@ static void *ms_thread_msg_new(CamelSess +@@ -563,7 +560,7 @@ static void ms_thread_msg_free(CamelSession *session, CamelSessionThreadMsg *m) { @@ -5154,7 +4517,7 @@ diff -up evolution-2.11.91/mail/mail-session.c.kill-ethread evolution-2.11.91/ma ms_parent_class->thread_msg_free(session, m); } -@@ -686,22 +683,23 @@ mail_session_set_interactive (gboolean i +@@ -686,22 +683,23 @@ MAIL_SESSION (session)->interactive = interactive; if (!interactive) { @@ -5184,9 +4547,1575 @@ diff -up evolution-2.11.91/mail/mail-session.c.kill-ethread evolution-2.11.91/ma } } } -diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/mail-mt.c ---- evolution-2.11.91/mail/mail-mt.c.kill-ethread 2007-07-05 02:09:38.000000000 -0400 -+++ evolution-2.11.91/mail/mail-mt.c 2007-08-29 17:39:34.000000000 -0400 +--- evolution-2.11.92/mail/message-list.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/message-list.c 2007-09-04 00:19:08.000000000 -0400 +@@ -1841,7 +1841,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; + +@@ -1858,11 +1858,9 @@ + unsigned int aborted:1; + }; + +-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 +@@ -1870,13 +1868,11 @@ + } + + 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); +@@ -1888,9 +1884,8 @@ + } + + 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; + + /* ?? */ +@@ -1898,7 +1893,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; + } + +@@ -1906,10 +1901,8 @@ + } + + 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); + +@@ -1917,18 +1910,19 @@ + g_free(m->selection); + } + +-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 + }; + + 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); + } + + static void +@@ -1955,7 +1949,7 @@ + struct _drop_msg *m = data; + + m->aborted = TRUE; +- mail_msg_free(&m->msg); ++ mail_msg_unref(m); + } + + static EPopupItem ml_drop_popup_menu[] = { +@@ -1985,7 +1979,7 @@ + if (!ml->folder || data->data == NULL || data->length == -1) + return; + +- 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; +@@ -3721,7 +3715,7 @@ + + /* ** REGENERATE MESSAGELIST ********************************************** */ + struct _regen_list_msg { +- struct _mail_msg msg; ++ MailMsg base; + + int complete; + +@@ -3749,16 +3743,15 @@ + + */ + +-static char * +-regen_list_describe (struct _mail_msg *mm, gint complete) ++static gchar * ++regen_list_desc (struct _regen_list_msg *m) + { + return g_strdup (_("Generating message list")); + } + + static void +-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; +@@ -3788,7 +3781,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; + +@@ -3798,23 +3791,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); + } + } + +- 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); +@@ -3889,7 +3882,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) +@@ -3918,17 +3911,15 @@ + } + + 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; + + if (!m->complete) + return; + +- if (camel_operation_cancel_check(mm->cancel)) ++ if (camel_operation_cancel_check(m->base.cancel)) + return; + + if (m->ml->folder != m->folder) +@@ -3979,9 +3970,8 @@ + } + + static void +-regen_list_free (struct _mail_msg *mm) ++regen_list_free (struct _regen_list_msg *m) + { +- struct _regen_list_msg *m = (struct _regen_list_msg *)mm; + int i; + + e_profile_event_emit("list.regenerated", m->folder->full_name, 0); +@@ -4009,11 +3999,12 @@ + g_object_unref(m->ml); + } + +-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 +@@ -4023,7 +4014,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 (m); + + m->ml->regen_timeout_msg = NULL; + m->ml->regen_timeout_id = 0; +@@ -4039,7 +4030,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); +@@ -4051,7 +4042,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; + } + } +@@ -4086,7 +4077,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.11.92/mail/em-folder-tree.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/em-folder-tree.c 2007-09-04 00:19:08.000000000 -0400 +@@ -835,7 +835,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; +@@ -860,17 +860,16 @@ + + d(printf(" * Drop folder '%s' onto '%s'\n", m->selection->data, m->full_name)); + +- if (!(src = mail_tool_uri_to_folder((char *)m->selection->data, 0, &m->msg.ex))) ++ if (!(src = mail_tool_uri_to_folder((char *)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; + +@@ -894,9 +893,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 */ +@@ -904,14 +902,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 */ +@@ -929,10 +927,25 @@ + } + + static void +-emft_drop_async_free (struct _mail_msg *mm) ++emft_drop_async__done (struct _DragDataReceivedAsync *m) + { +- struct _DragDataReceivedAsync *m = (struct _DragDataReceivedAsync *) mm; ++ gboolean success, delete; + ++ /* ?? */ ++ if (m->aborted) { ++ success = FALSE; ++ delete = FALSE; ++ } else { ++ success = !camel_exception_is_set (&m->base.ex); ++ delete = success && m->move && !m->moved; ++ } ++ ++ gtk_drag_finish (m->context, success, delete, GDK_CURRENT_TIME); ++} ++ ++static void ++emft_drop_async__free (struct _DragDataReceivedAsync *m) ++{ + g_object_unref(m->context); + camel_object_unref(m->store); + g_free(m->full_name); +@@ -941,18 +954,19 @@ + g_free(m->selection); + } + +-static struct _mail_msg_op emft_drop_async_op = { +- emft_drop_async_desc, +- emft_drop_async_drop, +- NULL, +- 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 +@@ -979,7 +993,7 @@ + struct _DragDataReceivedAsync *m = data; + + m->aborted = TRUE; +- mail_msg_free(&m->msg); ++ mail_msg_unref(m); + } + + static EPopupItem emft_drop_popup_menu[] = { +@@ -1035,7 +1049,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; +@@ -1674,7 +1688,7 @@ + #endif + + struct _EMFolderTreeGetFolderInfo { +- struct _mail_msg msg; ++ MailMsg base; + + /* input data */ + GtkTreeRowReference *root; +@@ -1687,10 +1701,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); +@@ -1700,18 +1713,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; +@@ -1739,7 +1750,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); +@@ -1794,10 +1805,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); +@@ -1806,11 +1815,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 +@@ -1897,7 +1907,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; +@@ -1906,7 +1916,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.11.92/mail/em-folder-browser.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/em-folder-browser.c 2007-09-04 00:19:08.000000000 -0400 +@@ -851,7 +851,7 @@ + + + struct _setup_msg { +- struct _mail_msg msg; ++ MailMsg base; + + CamelFolder *folder; + char *query; +@@ -859,16 +859,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")); + } + + 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; + +@@ -879,12 +878,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; + } +@@ -908,17 +907,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); +@@ -939,11 +934,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 */ +@@ -953,15 +949,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; + } +--- evolution-2.11.92/mail/em-sync-stream.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/em-sync-stream.c 2007-09-04 00:19:08.000000000 -0400 +@@ -25,42 +25,17 @@ + #include + #endif + +-#include ++#include "em-sync-stream.h" ++ + #include +-#include ++#include + #include +-#include +-#include "em-sync-stream.h" ++#include + + #include "mail-mt.h" + +-#define LOG_STREAM +- +-#define d(x) +- + #define EMSS_CLASS(x) ((EMSyncStreamClass *)(((CamelObject *)(x))->klass)) + +-struct _EMSyncStreamPrivate { +- /* FIXME: use a single data port/gui channel for all instances */ +- /* TODO: possibly just use one of the mail-mt ports ... */ +- struct _EMsgPort *data_port, *reply_port; +- struct _GIOChannel *gui_channel; +- guint gui_watch; +- +- char *buf_data; +- int buf_used; +- int buf_size; +- +-#ifdef LOG_STREAM +- FILE *logfd; +-#endif +-}; +- +-#ifdef LOG_STREAM +-int dolog; +-#endif +- +-/* Should probably expose messages to outside world ... so subclasses can extend */ + enum _write_msg_t { + EMSS_WRITE, + EMSS_FLUSH, +@@ -68,275 +43,168 @@ + }; + + struct _write_msg { +- EMsg msg; ++ EMSyncStream *emss; ++ EFlag *done; + + enum _write_msg_t op; + +- const char *data; +- size_t n; ++ const gchar *string; ++ gsize len; + }; + +-static void em_sync_stream_class_init (EMSyncStreamClass *klass); +-static void em_sync_stream_init (CamelObject *object); +-static void em_sync_stream_finalize (CamelObject *object); +- +-static ssize_t stream_write(CamelStream *stream, const char *buffer, size_t n); +-static int stream_close(CamelStream *stream); +-static int stream_flush(CamelStream *stream); +- + static CamelStreamClass *parent_class = NULL; + +-CamelType +-em_sync_stream_get_type (void) +-{ +- static CamelType type = CAMEL_INVALID_TYPE; +- +- if (type == CAMEL_INVALID_TYPE) { +-#ifdef LOG_STREAM +- dolog = getenv("EVOLUTION_MAIL_LOG_HTML") != NULL; +-#endif +- type = camel_type_register (CAMEL_STREAM_TYPE, +- "EMSyncStream", +- sizeof (EMSyncStream), +- sizeof (EMSyncStreamClass), +- (CamelObjectClassInitFunc) em_sync_stream_class_init, +- NULL, +- (CamelObjectInitFunc) em_sync_stream_init, +- (CamelObjectFinalizeFunc) em_sync_stream_finalize); +- } +- +- return type; +-} +- +-static void +-em_sync_stream_class_init (EMSyncStreamClass *klass) +-{ +- CamelStreamClass *stream_class = CAMEL_STREAM_CLASS (klass); +- +- parent_class = (CamelStreamClass *) CAMEL_STREAM_TYPE; +- +- /* virtual method overload */ +- stream_class->write = stream_write; +- stream_class->flush = stream_flush; +- stream_class->close = stream_close; +-} +- + static gboolean +-emcs_gui_received(GIOChannel *source, GIOCondition cond, void *data) ++emss_process_message (struct _write_msg *msg) + { +- EMSyncStream *emss = data; +- struct _EMSyncStreamPrivate *p = emss->priv; +- struct _write_msg *msg; +- +- d(printf("%p: gui sync op job waiting\n", emss)); +- +- msg = (struct _write_msg *)e_msgport_get(p->data_port); +- /* Should never happen ... */ +- if (msg == NULL) +- return TRUE; +- +- d(printf("%p: running sync op %d\n", emss, msg->op)); +- +- /* force out any pending data before doing anything else */ +- if (p->buf_used > 0) { +- EMSS_CLASS(emss)->sync_write((CamelStream *)emss, p->buf_data, p->buf_used); +-#ifdef LOG_STREAM +- if (p->logfd) +- fwrite(p->buf_data, 1, p->buf_used, p->logfd); +-#endif +- p->buf_used = 0; +- } ++ struct _EMSyncStream *emss = msg->emss; + +- /* FIXME: need to handle return values */ ++ /* Force out any pending data before doing anything else. */ ++ if (emss->buffer != NULL && emss->buffer->len > 0) { ++ EMSS_CLASS (emss)->sync_write ( ++ CAMEL_STREAM (emss), emss->buffer->str, ++ emss->buffer->len); ++ g_string_set_size (emss->buffer, 0); ++ } + + switch (msg->op) { +- case EMSS_WRITE: +- EMSS_CLASS(emss)->sync_write((CamelStream *)emss, msg->data, msg->n); +-#ifdef LOG_STREAM +- if (p->logfd) +- fwrite(msg->data, 1, msg->n, p->logfd); +-#endif +- break; +- case EMSS_FLUSH: +- EMSS_CLASS(emss)->sync_flush((CamelStream *)emss); +- break; +- case EMSS_CLOSE: +- EMSS_CLASS(emss)->sync_close((CamelStream *)emss); +-#ifdef LOG_STREAM +- if (p->logfd) { +- fclose(p->logfd); +- p->logfd = NULL; +- } +-#endif +- break; ++ case EMSS_WRITE: ++ EMSS_CLASS (emss)->sync_write ( ++ CAMEL_STREAM (emss), msg->string, msg->len); ++ break; ++ case EMSS_FLUSH: ++ EMSS_CLASS (emss)->sync_flush ( ++ CAMEL_STREAM (emss)); ++ break; ++ case EMSS_CLOSE: ++ EMSS_CLASS (emss)->sync_close ( ++ CAMEL_STREAM (emss)); ++ break; + } +- +- e_msgport_reply((EMsg *)msg); +- d(printf("%p: gui sync op jobs done\n", emss)); +- +- return TRUE; +-} +- +-static void +-em_sync_stream_init (CamelObject *object) +-{ +- EMSyncStream *emss = (EMSyncStream *)object; +- struct _EMSyncStreamPrivate *p; +- +- p = emss->priv = g_malloc0(sizeof(*p)); + +- p->data_port = e_msgport_new(); +- p->reply_port = e_msgport_new(); ++ e_flag_set (msg->done); + +-#ifndef G_OS_WIN32 +- p->gui_channel = g_io_channel_unix_new(e_msgport_fd(p->data_port)); +-#else +- p->gui_channel = g_io_channel_win32_new_socket(e_msgport_fd(p->data_port)); +-#endif +- p->gui_watch = g_io_add_watch(p->gui_channel, G_IO_IN, emcs_gui_received, emss); +- +-#ifdef LOG_STREAM +- if (dolog) { +- char name[32]; +- static int count; +- +- sprintf(name, "sync-stream.%d.html", count++); +- printf("Saving raw data stream to '%s'\n", name); +- p->logfd = fopen(name, "w"); +- } +-#endif +- +- d(printf("%p: new emss\n", emss)); ++ return FALSE; + } + + static void +-sync_op(EMSyncStream *emss, enum _write_msg_t op, const char *data, size_t n) ++emss_sync_op (EMSyncStream *emss, enum _write_msg_t op, ++ const gchar *string, gsize len) + { +- struct _EMSyncStreamPrivate *p = emss->priv; + struct _write_msg msg; +- EMsg *reply_msg; +- +- d(printf("%p: launching sync op %d\n", emss, op)); + +- /* we do everything synchronous, we should never have any locks, and +- this prevents overflow from banked up data */ +- +- msg.msg.reply_port = p->reply_port; ++ msg.done = e_flag_new (); ++ msg.emss = emss; + msg.op = op; +- msg.data = data; +- msg.n = n; +- +- e_msgport_put(p->data_port, &msg.msg); +- reply_msg = e_msgport_wait(p->reply_port); +- g_return_if_fail (reply_msg == &msg.msg); +- +- d(printf("%p: returned sync op %d\n", emss, op)); +-} +- +-static void +-em_sync_stream_finalize (CamelObject *object) +-{ +- EMSyncStream *emss = (EMSyncStream *)object; +- struct _EMSyncStreamPrivate *p = emss->priv; +- +- /* TODO: is this stuff safe to do in another thread? */ +- g_source_remove(p->gui_watch); +- g_io_channel_unref(p->gui_channel); ++ msg.string = string; ++ msg.len = len; + +- e_msgport_destroy(p->data_port); +- e_msgport_destroy(p->reply_port); ++ camel_object_ref (emss); + +- p->data_port = NULL; +- p->reply_port = NULL; ++ g_idle_add ((GSourceFunc) emss_process_message, &msg); + +- g_free(p->buf_data); ++ e_flag_wait (msg.done); ++ e_flag_free (msg.done); + +-#ifdef LOG_STREAM +- if (p->logfd) +- fclose(p->logfd); +-#endif +- +- g_free(p); ++ camel_object_unref (emss); + } + +-static ssize_t +-stream_write (CamelStream *stream, const char *buffer, size_t n) ++static gssize ++emss_stream_write (CamelStream *stream, const gchar *string, gsize len) + { + EMSyncStream *emss = EM_SYNC_STREAM (stream); +- struct _EMSyncStreamPrivate *p = emss->priv; + + if (emss->cancel) + return -1; + +- if (pthread_equal(pthread_self(), mail_gui_thread)) { +- EMSS_CLASS(emss)->sync_write(stream, buffer, n); +-#ifdef LOG_STREAM +- if (p->logfd) +- fwrite(buffer, 1, n, p->logfd); +-#endif +- } else if (p->buf_size > 0) { +- size_t left = p->buf_size-p->buf_used; +- +- if (n >= left) { +- sync_op(emss, EMSS_WRITE, buffer, n); +- } else { +- memcpy(p->buf_data + p->buf_used, buffer, n); +- p->buf_used += n; +- } ++ if (mail_in_main_thread ()) { ++ EMSS_CLASS (emss)->sync_write (stream, string, len); ++ } else if (emss->buffer != NULL) { ++ if (len < (emss->buffer->allocated_len - emss->buffer->len)) ++ g_string_append_len (emss->buffer, string, len); ++ else ++ emss_sync_op (emss, EMSS_WRITE, string, len); + } else { +- sync_op(emss, EMSS_WRITE, buffer, n); ++ emss_sync_op(emss, EMSS_WRITE, string, len); + } + +- return (ssize_t) n; ++ return (gssize) len; + } + + static int +-stream_flush(CamelStream *stream) ++emss_stream_flush (CamelStream *stream) + { +- EMSyncStream *emss = (EMSyncStream *)stream; ++ EMSyncStream *emss = EM_SYNC_STREAM (stream); + + if (emss->cancel) + return -1; + +- if (pthread_equal(pthread_self(), mail_gui_thread)) +- return ((EMSyncStreamClass *)(((CamelObject *)emss)->klass))->sync_flush(stream); ++ if (mail_in_main_thread ()) ++ return EMSS_CLASS (emss)->sync_flush (stream); + else +- sync_op(emss, EMSS_FLUSH, NULL, 0); ++ emss_sync_op (emss, EMSS_FLUSH, NULL, 0); + + return 0; + } + + static int +-stream_close(CamelStream *stream) ++emss_stream_close (CamelStream *stream) + { +- EMSyncStream *emss = (EMSyncStream *)stream; ++ EMSyncStream *emss = EM_SYNC_STREAM (stream); + + if (emss->cancel) + return -1; + +- d(printf("%p: closing stream\n", stream)); +- +- if (pthread_equal(pthread_self(), mail_gui_thread)) { +-#ifdef LOG_STREAM +- if (emss->priv->logfd) { +- fclose(emss->priv->logfd); +- emss->priv->logfd = NULL; +- } +-#endif +- return ((EMSyncStreamClass *)(((CamelObject *)emss)->klass))->sync_close(stream); +- } else +- sync_op(emss, EMSS_CLOSE, NULL, 0); ++ if (mail_in_main_thread ()) ++ return EMSS_CLASS (emss)->sync_close (stream); ++ else ++ emss_sync_op (emss, EMSS_CLOSE, NULL, 0); + + return 0; + } + +-void +-em_sync_stream_set_buffer_size(EMSyncStream *emss, size_t size) ++static void ++em_sync_stream_class_init (EMSyncStreamClass *class) ++{ ++ CamelStreamClass *stream_class = CAMEL_STREAM_CLASS (class); ++ ++ parent_class = (CamelStreamClass *) CAMEL_STREAM_TYPE; ++ ++ stream_class->write = emss_stream_write; ++ stream_class->flush = emss_stream_flush; ++ stream_class->close = emss_stream_close; ++} ++ ++static void ++em_sync_stream_finalize (EMSyncStream *emss) ++{ ++ if (emss->buffer != NULL) ++ g_string_free (emss->buffer, TRUE); ++} ++ ++CamelType ++em_sync_stream_get_type (void) + { +- struct _EMSyncStreamPrivate *p = emss->priv; ++ static CamelType type = CAMEL_INVALID_TYPE; ++ ++ if (G_UNLIKELY (type == CAMEL_INVALID_TYPE)) ++ type = camel_type_register ( ++ CAMEL_STREAM_TYPE, ++ "EMSyncStream", ++ sizeof (EMSyncStream), ++ sizeof (EMSyncStreamClass), ++ (CamelObjectClassInitFunc) em_sync_stream_class_init, ++ NULL, ++ (CamelObjectInitFunc) NULL, ++ (CamelObjectFinalizeFunc) em_sync_stream_finalize); + +- g_free(p->buf_data); +- p->buf_data = g_malloc(size); +- p->buf_size = size; +- p->buf_used = 0; ++ return type; ++} ++ ++void ++em_sync_stream_set_buffer_size (EMSyncStream *emss, gsize size) ++{ ++ if (emss->buffer != NULL) ++ g_string_free (emss->buffer, TRUE); ++ emss->buffer = g_string_sized_new (size); + } +--- evolution-2.11.92/mail/importers/pine-importer.c.kill-ethread 2007-09-02 14:56:47.000000000 -0400 ++++ evolution-2.11.92/mail/importers/pine-importer.c 2007-09-04 00:19:08.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; + +- e_thread_put(mail_thread_queued, (EMsg *)m); ++ mail_msg_fast_ordered_push (m); + + return id; + } +--- evolution-2.11.92/mail/importers/mail-importer.c.kill-ethread 2007-09-02 14:56:47.000000000 -0400 ++++ evolution-2.11.92/mail/importers/mail-importer.c 2007-09-04 00:19:08.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.11.92/mail/importers/elm-importer.c.kill-ethread 2007-09-02 14:56:47.000000000 -0400 ++++ evolution-2.11.92/mail/importers/elm-importer.c 2007-09-04 00:19:08.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.11.92/mail/mail-ops.h.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/mail-ops.h 2007-09-04 00:19:08.000000000 -0400 +@@ -30,13 +30,14 @@ + #pragma } + #endif /* __cplusplus */ + ++#include "mail-mt.h" ++ + #include "camel/camel-store.h" + #include "camel/camel-folder.h" + #include "camel/camel-filter-driver.h" + #include "camel/camel-mime-message.h" + #include "camel/camel-operation.h" + +-#include "libedataserver/e-msgport.h" + #include "libedataserver/e-account.h" + + void mail_append_mail (CamelFolder *folder, CamelMimeMessage *message, CamelMessageInfo *info, +@@ -55,12 +56,12 @@ + void mail_get_message (CamelFolder *folder, const char *uid, + void (*done) (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data), + void *data, +- EThread *thread); ++ MailMsgDispatchFunc dispatch); + + 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); + + /* get several messages */ + void mail_get_messages (CamelFolder *folder, GPtrArray *uids, +@@ -70,7 +71,7 @@ + /* same for a folder */ + int mail_get_folder (const char *uri, guint32 flags, + void (*done) (char *uri, CamelFolder *folder, void *data), void *data, +- EThread *thread); ++ MailMsgDispatchFunc dispatch); + + /* and for a store */ + int mail_get_store (const char *uri, CamelOperation *op, +--- evolution-2.11.92/mail/em-utils.c.kill-ethread 2007-09-04 00:19:00.000000000 -0400 ++++ evolution-2.11.92/mail/em-utils.c 2007-09-04 00:19:08.000000000 -0400 +@@ -1912,7 +1912,7 @@ + ESource *source = s->data; + GList *contacts; + EBook *book; +- void *hook; ++ GHook *hook; + + d(printf(" checking '%s'\n", e_source_get_uri(source))); + +--- evolution-2.11.92/mail/mail-folder-cache.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/mail-folder-cache.c 2007-09-04 00:19:08.000000000 -0400 +@@ -862,15 +862,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; + +@@ -881,10 +880,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) && +@@ -895,22 +893,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 +@@ -922,11 +919,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 (m); + } + + static gboolean +@@ -971,7 +968,7 @@ + int hook = 0; + + g_return_if_fail (CAMEL_IS_STORE(store)); +- g_return_if_fail (pthread_equal(pthread_self(), mail_gui_thread)); ++ g_return_if_fail (mail_in_main_thread()); + + LOCK(info_lock); + +--- evolution-2.11.92/mail/em-composer-utils.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/em-composer-utils.c 2007-09-04 00:19:08.000000000 -0400 +@@ -553,7 +553,7 @@ + strcmp (account->drafts_folder_uri, default_drafts_folder_uri) != 0) { + int id; + +- id = mail_get_folder (account->drafts_folder_uri, 0, save_draft_folder, &folder, mail_thread_new); ++ id = mail_get_folder (account->drafts_folder_uri, 0, save_draft_folder, &folder, mail_msg_unordered_push); + mail_msg_wait (id); + + if (!folder || !account->enabled) { +@@ -1104,7 +1104,7 @@ + g_return_if_fail (CAMEL_IS_FOLDER (folder)); + g_return_if_fail (uid != NULL); + +- mail_get_message (folder, uid, redirect_msg, NULL, mail_thread_new); ++ mail_get_message (folder, uid, redirect_msg, NULL, mail_msg_unordered_push); + } + + static void +@@ -1135,7 +1135,7 @@ + } + + if (msg == NULL) { +- mail_get_messagex(folder, uid, emu_handle_receipt_message, NULL, mail_thread_new); ++ mail_get_messagex(folder, uid, emu_handle_receipt_message, NULL, mail_msg_unordered_push); + camel_message_info_free(info); + return; + } +@@ -1949,7 +1949,7 @@ + rd->source = source; + if (rd->source) + g_object_ref(rd->source); +- mail_get_message(folder, uid, reply_to_message, rd, mail_thread_new); ++ mail_get_message(folder, uid, reply_to_message, rd, mail_msg_unordered_push); + + return; + } +@@ -2121,5 +2121,5 @@ + g_return_if_fail (CAMEL_IS_FOLDER (folder)); + g_return_if_fail (uid != NULL); + +- mail_get_message (folder, uid, post_reply_to_message, NULL, mail_thread_new); ++ mail_get_message (folder, uid, post_reply_to_message, NULL, mail_msg_unordered_push); + } +--- evolution-2.11.92/mail/mail-mt.c.kill-ethread 2007-09-02 14:56:48.000000000 -0400 ++++ evolution-2.11.92/mail/mail-mt.c 2007-09-04 00:19:08.000000000 -0400 @@ -29,8 +29,8 @@ #include #include @@ -5197,7 +6126,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma #include #include -@@ -63,7 +63,7 @@ static void mail_operation_status(struct +@@ -63,7 +63,7 @@ #endif /* background operation status stuff */ @@ -5206,7 +6135,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma 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 GHashTable *mail_msg_active_table +@@ -82,15 +82,12 @@ static pthread_mutex_t mail_msg_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t mail_msg_cond = PTHREAD_COND_INITIALIZER; @@ -5225,7 +6154,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma MAIL_MT_LOCK(mail_msg_lock); -@@ -112,7 +109,6 @@ void *mail_msg_new(mail_msg_op_t *ops, E +@@ -112,7 +109,6 @@ fprintf(log, "Logging async operations\n"); if (log_locks) { @@ -5233,7 +6162,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma fprintf(log, "%" G_GINT64_MODIFIER "x: lock mail_msg_lock\n", e_util_pthread_id(pthread_self())); } } else { -@@ -122,13 +118,13 @@ void *mail_msg_new(mail_msg_op_t *ops, E +@@ -122,13 +118,13 @@ } } #endif @@ -5251,7 +6180,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma g_hash_table_insert(mail_msg_active_table, GINT_TO_POINTER(msg->seq), msg); -@@ -143,12 +139,15 @@ void *mail_msg_new(mail_msg_op_t *ops, E +@@ -143,12 +139,15 @@ return msg; } @@ -5270,7 +6199,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma e_activity_handler_operation_finished (activity_handler, activity_id); } -@@ -177,58 +176,93 @@ checkmem(void *p) +@@ -177,58 +176,93 @@ } #endif @@ -5392,7 +6321,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma } /* hash table of ops->dialogue of active errors */ -@@ -244,9 +278,10 @@ static void error_response(GtkObject *o, +@@ -244,9 +278,10 @@ gtk_widget_destroy((GtkWidget *)o); } @@ -5405,7 +6334,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma char *what; GtkDialog *gd; -@@ -271,27 +306,27 @@ void mail_msg_check_error(void *msg) +@@ -271,27 +306,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. */ @@ -5440,7 +6369,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma MAIL_MT_LOCK(mail_msg_lock); m = g_hash_table_lookup(mail_msg_active_table, GINT_TO_POINTER(msgid)); -@@ -304,13 +339,12 @@ void mail_msg_cancel(unsigned int msgid) +@@ -304,13 +339,12 @@ /* waits for a message to be finished processing (freed) @@ -5457,7 +6386,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma MAIL_MT_LOCK(mail_msg_lock); m = g_hash_table_lookup(mail_msg_active_table, GINT_TO_POINTER(msgid)); while (m) { -@@ -347,9 +381,7 @@ int mail_msg_active(unsigned int msgid) +@@ -347,9 +381,7 @@ void mail_msg_wait_all(void) { @@ -5468,7 +6397,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma MAIL_MT_LOCK(mail_msg_lock); while (g_hash_table_size(mail_msg_active_table) > 0) { MAIL_MT_UNLOCK(mail_msg_lock); -@@ -367,294 +399,239 @@ void mail_msg_wait_all(void) +@@ -367,294 +399,239 @@ } /* **************************************** */ @@ -5931,7 +6860,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma } /* ********************************************************************** */ -@@ -665,7 +642,8 @@ static pthread_mutex_t status_lock = PTH +@@ -665,7 +642,8 @@ /* ********************************************************************** */ struct _proxy_msg { @@ -5941,7 +6870,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma MailAsyncEvent *ea; mail_async_event_t type; -@@ -679,10 +657,8 @@ struct _proxy_msg { +@@ -679,10 +657,8 @@ }; static void @@ -5953,7 +6882,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma m->thread = pthread_self(); m->have_thread = TRUE; m->func(m->o, m->event_data, m->data); -@@ -697,16 +673,17 @@ static int +@@ -697,16 +673,17 @@ idle_async_event(void *mm) { do_async_event(mm); @@ -5977,7 +6906,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma }; MailAsyncEvent *mail_async_event_new(void) -@@ -723,10 +700,9 @@ int mail_async_event_emit(MailAsyncEvent +@@ -723,10 +700,9 @@ { struct _proxy_msg *m; int id; @@ -5989,7 +6918,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma m->func = func; m->o = o; m->event_data = event_data; -@@ -735,7 +711,7 @@ int mail_async_event_emit(MailAsyncEvent +@@ -735,7 +711,7 @@ m->type = type; m->have_thread = FALSE; @@ -5998,7 +6927,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma g_mutex_lock(ea->lock); ea->tasks = g_slist_prepend(ea->tasks, m); g_mutex_unlock(ea->lock); -@@ -743,12 +719,12 @@ int mail_async_event_emit(MailAsyncEvent +@@ -743,12 +719,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) { @@ -6014,7 +6943,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma return id; } -@@ -762,7 +738,7 @@ int mail_async_event_destroy(MailAsyncEv +@@ -762,7 +738,7 @@ g_mutex_lock(ea->lock); while (ea->tasks) { m = ea->tasks->data; @@ -6023,7 +6952,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma 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 +760,18 @@ int mail_async_event_destroy(MailAsyncEv +@@ -784,17 +760,18 @@ /* ********************************************************************** */ struct _call_msg { @@ -6045,7 +6974,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma void *p1, *p2, *p3, *p4, *p5; int i1; va_list ap; -@@ -842,45 +819,47 @@ do_call(struct _mail_msg *mm) +@@ -842,45 +819,47 @@ m->ret = m->func(p1, p2, i1, p3, p4, p5); break; } @@ -6112,7 +7041,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma return ret; } -@@ -889,40 +868,42 @@ void *mail_call_main(mail_call_t type, M +@@ -889,40 +868,42 @@ /* locked via status_lock */ static int busy_state; @@ -6167,7 +7096,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma } MAIL_MT_UNLOCK(status_lock); } -@@ -930,7 +911,7 @@ void mail_disable_stop(void) +@@ -930,7 +911,7 @@ /* ******************************************************************************** */ struct _op_status_msg { @@ -6176,7 +7105,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma struct _CamelOperation *op; char *what; -@@ -938,16 +919,16 @@ struct _op_status_msg { +@@ -938,16 +919,16 @@ void *data; }; @@ -6193,12 +7122,12 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma char *out, *p, *o, c; int pc; -- g_assert (pthread_equal(mail_gui_thread, pthread_self ())); -+ g_assert (mail_in_main_thread ()); +- g_return_if_fail (pthread_equal(mail_gui_thread, pthread_self ())); ++ g_return_if_fail (mail_in_main_thread ()); MAIL_MT_LOCK (mail_msg_lock); -@@ -986,8 +967,8 @@ static void do_op_status(struct _mail_ms +@@ -986,8 +967,8 @@ progress_icon = e_icon_factory_get_icon ("stock_mail-unread", E_ICON_SIZE_MENU); MAIL_MT_UNLOCK (mail_msg_lock); @@ -6209,7 +7138,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma /* uncommenting because message is not very useful for a user, see bug 271734*/ else { what = g_strdup(""); -@@ -1001,11 +982,7 @@ static void do_op_status(struct _mail_ms +@@ -1001,11 +982,7 @@ MAIL_MT_LOCK (mail_msg_lock); if (data->activity_state == 3) { MAIL_MT_UNLOCK (mail_msg_lock); @@ -6222,7 +7151,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma } else { data->activity_state = 2; MAIL_MT_UNLOCK (mail_msg_lock); -@@ -1021,18 +998,17 @@ static void do_op_status(struct _mail_ms +@@ -1021,18 +998,17 @@ } static void @@ -6248,7 +7177,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma }; static void -@@ -1042,7 +1018,7 @@ mail_operation_status (struct _CamelOper +@@ -1042,7 +1018,7 @@ d(printf("got operation statys: %s %d%%\n", what, pc)); @@ -6257,7 +7186,7 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma m->op = op; m->what = g_strdup(what); switch (pc) { -@@ -1055,7 +1031,7 @@ mail_operation_status (struct _CamelOper +@@ -1055,7 +1031,7 @@ } m->pc = pc; m->data = data; @@ -6266,970 +7195,3 @@ diff -up evolution-2.11.91/mail/mail-mt.c.kill-ethread evolution-2.11.91/mail/ma } /* ******************** */ -diff -up evolution-2.11.91/plugins/folder-unsubscribe/folder-unsubscribe.c.kill-ethread evolution-2.11.91/plugins/folder-unsubscribe/folder-unsubscribe.c ---- evolution-2.11.91/plugins/folder-unsubscribe/folder-unsubscribe.c.kill-ethread 2007-07-05 02:09:19.000000000 -0400 -+++ evolution-2.11.91/plugins/folder-unsubscribe/folder-unsubscribe.c 2007-08-29 17:39:34.000000000 -0400 -@@ -44,32 +44,30 @@ void org_gnome_mail_folder_unsubscribe ( - - - 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 @@ folder_unsubscribe__unsub (struct _mail_ - } - - 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 @@ org_gnome_mail_folder_unsubscribe (EPlug - 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 (unsub); - } -diff -up evolution-2.11.91/plugins/mark-all-read/mark-all-read.c.kill-ethread evolution-2.11.91/plugins/mark-all-read/mark-all-read.c ---- evolution-2.11.91/plugins/mark-all-read/mark-all-read.c.kill-ethread 2007-07-05 02:09:23.000000000 -0400 -+++ evolution-2.11.91/plugins/mark-all-read/mark-all-read.c 2007-08-29 17:39:34.000000000 -0400 -@@ -44,7 +44,7 @@ org_gnome_mark_all_read (EPlugin *ep, EM - return; - } - -- mail_get_folder(t->uri, 0, mar_got_folder, NULL, mail_thread_new); -+ mail_get_folder(t->uri, 0, mar_got_folder, NULL, mail_msg_unordered_push); - } - - static void -diff -up evolution-2.11.91/plugins/exchange-operations/exchange-folder.c.kill-ethread evolution-2.11.91/plugins/exchange-operations/exchange-folder.c ---- evolution-2.11.91/plugins/exchange-operations/exchange-folder.c.kill-ethread 2007-07-05 02:09:22.000000000 -0400 -+++ evolution-2.11.91/plugins/exchange-operations/exchange-folder.c 2007-08-29 17:39:34.000000000 -0400 -@@ -140,7 +140,7 @@ org_gnome_exchange_folder_inbox_unsubscr - inbox_physical_uri = e_folder_get_physical_uri (inbox); - - /* To get the CamelStore/Folder */ -- mail_get_folder (inbox_physical_uri, 0, exchange_get_folder, target_uri, mail_thread_new); -+ mail_get_folder (inbox_physical_uri, 0, exchange_get_folder, target_uri, mail_msg_unordered_push); - - - } -diff -up evolution-2.11.91/plugins/save-attachments/save-attachments.c.kill-ethread evolution-2.11.91/plugins/save-attachments/save-attachments.c ---- evolution-2.11.91/plugins/save-attachments/save-attachments.c.kill-ethread 2007-07-05 02:09:25.000000000 -0400 -+++ evolution-2.11.91/plugins/save-attachments/save-attachments.c 2007-08-29 17:39:34.000000000 -0400 -@@ -403,5 +403,5 @@ org_gnome_save_attachments_save(EPlugin - camel_object_ref(data->folder); - data->uid = g_strdup(target->uids->pdata[0]); - -- mail_get_message(data->folder, data->uid, save_got_message, data, mail_thread_new); -+ mail_get_message(data->folder, data->uid, save_got_message, data, mail_msg_unordered_push); - } -diff -up evolution-2.11.91/plugins/mailing-list-actions/mailing-list-actions.c.kill-ethread evolution-2.11.91/plugins/mailing-list-actions/mailing-list-actions.c ---- evolution-2.11.91/plugins/mailing-list-actions/mailing-list-actions.c.kill-ethread 2007-07-05 02:09:24.000000000 -0400 -+++ evolution-2.11.91/plugins/mailing-list-actions/mailing-list-actions.c 2007-08-29 17:39:34.000000000 -0400 -@@ -89,7 +89,7 @@ void emla_list_action (EPlugin *item, EM - data->uri = strdup (sel->uri); - - mail_get_message (sel->folder, (const char*) g_ptr_array_index (sel->uids, 0), -- emla_list_action_do, data, mail_thread_new); -+ emla_list_action_do, data, mail_msg_unordered_push); - } - - void emla_list_action_do (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data) -diff -up evolution-2.11.91/plugins/groupwise-features/share-folder-common.c.kill-ethread evolution-2.11.91/plugins/groupwise-features/share-folder-common.c ---- evolution-2.11.91/plugins/groupwise-features/share-folder-common.c.kill-ethread 2007-07-05 02:09:21.000000000 -0400 -+++ evolution-2.11.91/plugins/groupwise-features/share-folder-common.c 2007-08-29 17:39:34.000000000 -0400 -@@ -121,7 +121,7 @@ shared_folder_abort (EPlugin *ep, EConfi - } - - struct _EMCreateFolder { -- struct _mail_msg msg; -+ MailMsg base; - - /* input data */ - CamelStore *store; -@@ -137,31 +137,26 @@ struct _EMCreateFolder { - 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 @@ create_folder__created (struct _mail_msg - } - - 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 @@ create_folder__free (struct _mail_msg *m - 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 @@ create_folder (CamelStore *store, const - 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 @@ create_folder (CamelStore *store, const - m->user_data = (struct ShareInfo *) user_data; - m->done = done; - 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; - } -diff -up evolution-2.11.91/calendar/gui/alarm-notify/alarm-notify.h.kill-ethread evolution-2.11.91/calendar/gui/alarm-notify/alarm-notify.h ---- evolution-2.11.91/calendar/gui/alarm-notify/alarm-notify.h.kill-ethread 2007-07-05 02:11:11.000000000 -0400 -+++ evolution-2.11.91/calendar/gui/alarm-notify/alarm-notify.h 2007-08-29 17:39:34.000000000 -0400 -@@ -39,19 +39,6 @@ typedef struct _AlarmNotifyClass AlarmNo - - typedef struct _AlarmNotifyPrivate AlarmNotifyPrivate; - --typedef struct _AlarmMsg AlarmMsg; --typedef struct _AlarmMsgPrivate AlarmMsgPrivate; -- --struct _AlarmMsg { -- EMsg msg; -- -- void (*receive_msg)(EThread *e, struct _AlarmMsg *msg, void *data); /* message received */ -- void *data; -- -- /* Private Usage */ -- struct _AlarmMsgPrivate *priv; --}; -- - struct _AlarmNotify { - BonoboObject object; - -diff -up evolution-2.11.91/calendar/gui/alarm-notify/alarm-notify.c.kill-ethread evolution-2.11.91/calendar/gui/alarm-notify/alarm-notify.c ---- evolution-2.11.91/calendar/gui/alarm-notify/alarm-notify.c.kill-ethread 2007-08-13 00:00:08.000000000 -0400 -+++ evolution-2.11.91/calendar/gui/alarm-notify/alarm-notify.c 2007-08-29 17:39:34.000000000 -0400 -@@ -45,10 +45,6 @@ struct _AlarmNotifyPrivate { - GMutex *mutex; - }; - --EThread *alarm_operation_thread; /* for operations that can (or should) be queued */ --EMsgPort *alarm_reply_port; --static GIOChannel *alarm_reply_channel; -- - #define d(x) x - - -@@ -286,72 +282,12 @@ alarm_notify_finalize (GObject *object) - g_mutex_free (priv->mutex); - g_free (priv); - -- e_thread_destroy(alarm_operation_thread); -- g_io_channel_unref(alarm_reply_channel); -- e_msgport_destroy(alarm_reply_port); - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); - } - - - --static guint --alarm_channel_setup(EMsgPort **port, GIOChannel **channel, GIOFunc func) --{ -- GSource *source; -- guint id; -- -- d (printf("%s:%d (alarm_channel_setup) - Channel Setup\n ", __FILE__, __LINE__)); -- *port = e_msgport_new(); --#ifndef G_OS_WIN32 -- *channel = g_io_channel_unix_new(e_msgport_fd(*port)); --#else -- *channel = g_io_channel_win32_new_socket(e_msgport_fd(*port)); --#endif -- source = g_io_create_watch(*channel, G_IO_IN); -- g_source_set_callback(source, (GSourceFunc)func, *port, NULL); -- g_source_set_can_recurse(source, FALSE); -- id = g_source_attach(source, NULL); -- g_source_unref(source); -- -- return id; --} -- --static void --alarm_msg_destroy(EThread *e, EMsg *msg, void *data) --{ -- AlarmMsg *m = (AlarmMsg *)msg; -- -- /* Free the private */ -- g_free (m->data); /* Mostly it is a structure allocated as a carrier*/ -- g_free (m); --} -- --static gboolean --alarm_msgport_replied(GIOChannel *source, GIOCondition cond, void *d) --{ -- EMsgPort *port = (EMsgPort *)d; -- EMsg *m; -- -- while (( m = e_msgport_get(port))) { -- d (printf("%s:%d (alarm_msgport_replied) - %p: Replied to GUI thread\n", __FILE__, __LINE__, m)); -- alarm_msg_destroy(NULL, m, NULL); -- } -- -- return TRUE; --} -- --static void --alarm_msg_received(EThread *e, EMsg *msg, void *data) --{ -- AlarmMsg *m = (AlarmMsg *)msg; -- -- d(printf("%s:%d (alarm_msg_received) - %p: Received at thread %" G_GINT64_MODIFIER "x\n", __FILE__, __LINE__, m, e_util_pthread_id(pthread_self()))); -- if (m->receive_msg) { -- m->receive_msg (e, m, data); -- } --} -- - /** - * alarm_notify_new: - * -@@ -363,23 +299,10 @@ alarm_msg_received(EThread *e, EMsg *msg - AlarmNotify * - alarm_notify_new (void) - { -- AlarmNotify *an; -- -- d (printf("%s:%d (alarm_notify_new) - Alarm Notify New \n ", __FILE__, __LINE__)); -- -- /* Create a thread for alarm queue operation*/ -- alarm_channel_setup(&alarm_reply_port, &alarm_reply_channel, alarm_msgport_replied); -- -- alarm_operation_thread = e_thread_new(E_THREAD_QUEUE); -- e_thread_set_msg_destroy(alarm_operation_thread, alarm_msg_destroy, 0); -- e_thread_set_msg_received(alarm_operation_thread, alarm_msg_received, 0); -- e_thread_set_reply_port(alarm_operation_thread, alarm_reply_port); -- -- an = g_object_new (TYPE_ALARM_NOTIFY, -- "poa", bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL), -- NULL); -- -- return an; -+ return g_object_new (TYPE_ALARM_NOTIFY, -+ "poa", bonobo_poa_get_threaded ( -+ ORBIT_THREAD_HINT_PER_REQUEST, NULL), -+ NULL); - } - - static void -diff -up evolution-2.11.91/calendar/gui/alarm-notify/alarm-queue.c.kill-ethread evolution-2.11.91/calendar/gui/alarm-notify/alarm-queue.c ---- evolution-2.11.91/calendar/gui/alarm-notify/alarm-queue.c.kill-ethread 2007-08-13 00:00:08.000000000 -0400 -+++ evolution-2.11.91/calendar/gui/alarm-notify/alarm-queue.c 2007-08-29 17:39:34.000000000 -0400 -@@ -97,9 +97,6 @@ static int tray_blink_id = -1; - static int tray_blink_state = FALSE; - static AlarmNotify *an; - --/* Main Tasks thread for dealing with the global structures */ --extern EThread *alarm_operation_thread; -- - /* Structure that stores a client we are monitoring */ - typedef struct { - /* Monitored client */ -@@ -181,6 +178,40 @@ static void on_dialog_objs_removed_cb (E - static void load_alarms_for_today (ClientAlarms *ca); - static void midnight_refresh_cb (gpointer alarm_id, time_t trigger, gpointer data); - -+/* Simple asynchronous message dispatcher */ -+ -+typedef struct _Message Message; -+typedef void (*MessageFunc) (Message *msg); -+ -+struct _Message { -+ MessageFunc func; -+}; -+ -+static void -+message_proxy (Message *msg) -+{ -+ g_return_if_fail (msg->func != NULL); -+ -+ msg->func (msg); -+} -+ -+static gpointer -+create_thread_pool (void) -+{ -+ /* once created, run forever */ -+ return g_thread_pool_new ((GFunc) message_proxy, NULL, 1, FALSE, NULL); -+} -+ -+static void -+message_push (Message *msg) -+{ -+ static GOnce once = G_ONCE_INIT; -+ -+ g_once (&once, (GThreadFunc) create_thread_pool, NULL); -+ -+ g_thread_pool_push ((GThreadPool *) once.retval, msg, NULL); -+} -+ - /* Queues an alarm trigger for midnight so that we can load the next day's worth - * of alarms. - */ -@@ -219,47 +250,41 @@ add_client_alarms_cb (gpointer key, gpoi - } - - struct _midnight_refresh_msg { -+ Message header; - gboolean remove; - }; - - /* Loads the alarms for the new day every midnight */ - static void --midnight_refresh_async (EThread *e, AlarmMsg *msg, void *data) -+midnight_refresh_async (struct _midnight_refresh_msg *msg) - { -- struct _midnight_refresh_msg *list = msg->data; -- - d(printf("%s:%d (midnight_refresh_async) \n",__FILE__, __LINE__)); - - /* Re-load the alarms for all clients */ - g_hash_table_foreach (client_alarms_hash, add_client_alarms_cb, NULL); - - /* Re-schedule the midnight update */ -- if (list->remove && midnight_refresh_id != NULL) { -+ if (msg->remove && midnight_refresh_id != NULL) { - d(printf("%s:%d (midnight_refresh_async) - Reschedule the midnight update \n",__FILE__, __LINE__)); - alarm_remove (midnight_refresh_id); - midnight_refresh_id = NULL; - } - - queue_midnight_refresh (); -+ -+ g_slice_free (struct _midnight_refresh_msg, msg); - } - - static void - midnight_refresh_cb (gpointer alarm_id, time_t trigger, gpointer data) - { -- AlarmMsg *msg; -- struct _midnight_refresh_msg *list; -- -- /* These two structures will be freed by the msg destroy function*/ -- msg = malloc (sizeof (AlarmMsg)); -- msg->receive_msg = midnight_refresh_async; -- -- list = malloc (sizeof (struct _midnight_refresh_msg)); -+ struct _midnight_refresh_msg *msg; - -- list->remove = TRUE; -- msg->data = list; -+ msg = g_slice_new (struct _midnight_refresh_msg); -+ msg->header.func = (MessageFunc) midnight_refresh_async; -+ msg->remove = TRUE; - -- d(printf("%s:%d (midnight_refresh_cb) - Invoking task for midnight refresh\n",__FILE__, __LINE__)); -- e_thread_put(alarm_operation_thread, (EMsg *)msg); -+ message_push ((Message *) msg); - } - - /* Looks up a client in the client alarms hash table */ -@@ -658,6 +683,7 @@ remove_comp (ClientAlarms *ca, ECalCompo - * alarms. - */ - struct _query_msg { -+ Message header; - ECal *client; - GList *objects; - gpointer data; -@@ -691,7 +717,7 @@ duplicate_ecal (GList *in_list) - } - - static void --query_objects_changed_async (EThread *e, AlarmMsg *msg, void *data) -+query_objects_changed_async (struct _query_msg *msg) - { - ClientAlarms *ca; - time_t from, day_end; -@@ -700,13 +726,12 @@ query_objects_changed_async (EThread *e, - icaltimezone *zone; - CompQueuedAlarms *cqa; - GList *l; -- struct _query_msg *list = msg->data; - ECal *client; - GList *objects; - -- client = list->client; -- ca = list->data; -- objects = list->objects; -+ client = msg->client; -+ ca = msg->data; -+ objects = msg->objects; - - from = config_data_get_last_notification_time (); - if (from == -1) -@@ -800,43 +825,38 @@ query_objects_changed_async (EThread *e, - comp = NULL; - } - g_list_free (objects); -+ -+ g_slice_free (struct _query_msg, msg); - } - - static void - query_objects_changed_cb (ECal *client, GList *objects, gpointer data) - { -- AlarmMsg *msg; -- struct _query_msg *list; -+ struct _query_msg *msg; - -- /* These two structures will be freed by the msg destroy function*/ -- msg = malloc (sizeof (AlarmMsg)); -- msg->receive_msg = query_objects_changed_async; -- list = malloc (sizeof (struct _query_msg)); -- list->client = client; -- list->objects = duplicate_ical (objects); -- list->data = data; -- msg->data = list; -- -- d(printf("%s:%d (query_objects_changed_cb) - Posting a task\n",__FILE__, __LINE__)); -- e_thread_put(alarm_operation_thread, (EMsg *)msg); -+ msg = g_slice_new (struct _query_msg); -+ msg->header.func = (MessageFunc) query_objects_changed_async; -+ msg->client = client; -+ msg->objects = duplicate_ical (objects); -+ msg->data = data; - -+ message_push ((Message *) msg); - } - - /* Called when a calendar component is removed; we must delete its corresponding - * alarms. - */ - static void --query_objects_removed_async (EThread *e, AlarmMsg *msg, void *data) -+query_objects_removed_async (struct _query_msg *msg) - { - ClientAlarms *ca; - GList *l; -- struct _query_msg *list = msg->data; - ECal *client; - GList *objects; - -- client = list->client; -- ca = list->data; -- objects = list->objects; -+ client = msg->client; -+ ca = msg->data; -+ objects = msg->objects; - - d(printf("%s:%d (query_objects_removed_async) - Removing %d objects\n",__FILE__, __LINE__, g_list_length(objects))); - -@@ -849,27 +869,22 @@ query_objects_removed_async (EThread *e, - } - - g_list_free (objects); -+ -+ g_slice_free (struct _query_msg, msg); - } - - static void - query_objects_removed_cb (ECal *client, GList *objects, gpointer data) - { -- AlarmMsg *msg; -- struct _query_msg *list; -- -- /* These two structures will be freed by the msg destroy function*/ -- msg = malloc (sizeof (AlarmMsg)); -- msg->receive_msg = query_objects_removed_async; -- -- list = malloc (sizeof (struct _query_msg)); -- list->client = client; -- list->objects = duplicate_ecal (objects); -- list->data = data; -- msg->data = list; -+ struct _query_msg *msg; - -- d(printf("%s:%d (query_objects_removed_cb) - Posting a task\n",__FILE__, __LINE__)); -- e_thread_put(alarm_operation_thread, (EMsg *)msg); -+ msg = g_slice_new (struct _query_msg); -+ msg->header.func = (MessageFunc) query_objects_removed_async; -+ msg->client = client; -+ msg->objects = duplicate_ecal (objects); -+ msg->data = data; - -+ message_push ((Message *) msg); - } - - -@@ -1011,20 +1026,19 @@ free_tray_icon_data (TrayIconData *tray_ - } - - static void --on_dialog_objs_removed_async (EThread *e, AlarmMsg *msg, void *data) -+on_dialog_objs_removed_async (struct _query_msg *msg) - { - const char *our_uid; - GList *l; - TrayIconData *tray_data; -- struct _query_msg *list = msg->data; - ECal *client; - GList *objects; - - d(printf("%s:%d (on_dialog_objs_removed_async)\n",__FILE__, __LINE__)); - -- client = list->client; -- tray_data = list->data; -- objects = list->objects; -+ client = msg->client; -+ tray_data = msg->data; -+ objects = msg->objects; - - e_cal_component_get_uid (tray_data->comp, &our_uid); - g_return_if_fail (our_uid && *our_uid); -@@ -1042,37 +1056,33 @@ on_dialog_objs_removed_async (EThread *e - tray_data = NULL; - } - } -+ -+ g_slice_free (struct _query_msg, msg); - } - - static void - on_dialog_objs_removed_cb (ECal *client, GList *objects, gpointer data) - { -- AlarmMsg *msg; -- struct _query_msg *list; -+ struct _query_msg *msg; - -- /* These two structures will be freed by the msg destroy function*/ -- msg = malloc (sizeof (AlarmMsg)); -- msg->receive_msg = on_dialog_objs_removed_async; -- -- list = malloc (sizeof (struct _query_msg)); -- list->client = client; -- list->objects = objects; -- list->data = data; -- msg->data = list; -+ msg = g_slice_new (struct _query_msg); -+ msg->header.func = (MessageFunc) on_dialog_objs_removed_async; -+ msg->client = client; -+ msg->objects = objects; -+ msg->data = data; - -- d(printf("%s:%d (on_dialog_objs_removed_cb) - Posting a task \n",__FILE__, __LINE__)); -- e_thread_put(alarm_operation_thread, (EMsg *)msg); -+ message_push ((Message *) msg); - } - - struct _tray_cqa_msg { -+ Message header; - CompQueuedAlarms *cqa; - }; - - static void --tray_list_remove_cqa_async(EThread *e, AlarmMsg *msg, void *data) -+tray_list_remove_cqa_async (struct _tray_cqa_msg *msg) - { -- struct _tray_cqa_msg *tmsg = msg->data; -- CompQueuedAlarms *cqa = tmsg->cqa; -+ CompQueuedAlarms *cqa = msg->cqa; - GList *list = tray_icons_list; - - d(printf("%s:%d (tray_list_remove_cqa_async) - Removing CQA %p from tray list\n",__FILE__, __LINE__, cqa)); -@@ -1111,28 +1121,25 @@ tray_list_remove_cqa_async(EThread *e, A - gtk_tree_selection_select_iter (sel, &iter); - } - } -+ -+ g_slice_free (struct _tray_cqa_msg, msg); - } - - static void - tray_list_remove_cqa (CompQueuedAlarms *cqa) - { -- AlarmMsg *msg; -- struct _tray_cqa_msg *list; -- /* These two structures will be freed by the msg destroy function*/ -- msg = malloc (sizeof (AlarmMsg)); -- msg->receive_msg = tray_list_remove_cqa_async; -- -- list = malloc (sizeof (struct _tray_cqa_msg)); -- list->cqa = cqa; -- msg->data = list; -+ struct _tray_cqa_msg *msg; -+ -+ msg = g_slice_new (struct _tray_cqa_msg); -+ msg->header.func = (MessageFunc) tray_list_remove_cqa_async; -+ msg->cqa = cqa; - -- d(printf("%s:%d (tray_list_remove_cqa) - Posting a task\n",__FILE__, __LINE__)); -- e_thread_put(alarm_operation_thread, (EMsg *)msg); -+ message_push ((Message *) msg); - } - - /* Callback used from the alarm notify dialog */ - static void --tray_list_remove_async(EThread *e, AlarmMsg *msg, void *data) -+tray_list_remove_async (Message *msg) - { - GList *list = tray_icons_list; - -@@ -1162,55 +1169,50 @@ tray_list_remove_async(EThread *e, Alarm - } else - list = list->next; - } -+ -+ g_slice_free (Message, msg); - } - - static void --tray_list_remove_icons () -+tray_list_remove_icons (void) - { -- AlarmMsg *msg; -- -- /* These two structures will be freed by the msg destroy function*/ -- msg = malloc (sizeof (AlarmMsg)); -- msg->receive_msg = tray_list_remove_async; -+ Message *msg; - -- msg->data = NULL; -+ msg = g_slice_new (Message); -+ msg->func = tray_list_remove_async; - -- d(printf("%s:%d (tray_list_remove_icons) - Posting a task\n",__FILE__, __LINE__)); -- e_thread_put(alarm_operation_thread, (EMsg *)msg); -+ message_push (msg); - } - - struct _tray_msg { -+ Message header; - TrayIconData *data; - }; - - static void --tray_list_remove_data_async(EThread *e, AlarmMsg *msg, void *data) -+tray_list_remove_data_async (struct _tray_msg *msg) - { -- struct _tray_msg *tmsg = msg->data; -- TrayIconData *tray_data = tmsg->data; -+ TrayIconData *tray_data = msg->data; - - d(printf("%s:%d (tray_list_remove_data_async) - Removing %p from tray list\n",__FILE__, __LINE__, tray_data)); - - tray_icons_list = g_list_remove_all (tray_icons_list, tray_data); - free_tray_icon_data (tray_data); - tray_data = NULL; -+ -+ g_slice_free (struct _tray_msg, msg); - } - - static void - tray_list_remove_data (TrayIconData *data) - { -- AlarmMsg *msg; -- struct _tray_msg *list; -- /* These two structures will be freed by the msg destroy function*/ -- msg = malloc (sizeof (AlarmMsg)); -- msg->receive_msg = tray_list_remove_data_async; -- -- list = malloc (sizeof (struct _tray_msg)); -- list->data = data; -- msg->data = list; -+ struct _tray_msg *msg; -+ -+ msg = g_slice_new (struct _tray_msg); -+ msg->header.func = (MessageFunc) tray_list_remove_data_async; -+ msg->data = data; - -- d(printf("%s:%d (tray_list_remove_data) - Posting a task\n",__FILE__, __LINE__)); -- e_thread_put(alarm_operation_thread, (EMsg *)msg); -+ message_push ((Message *) msg); - } - - static void -@@ -1417,29 +1419,24 @@ tray_icon_blink_cb (gpointer data) - /* Add a new data to tray list */ - - static void --tray_list_add_async (EThread *e, AlarmMsg *msg, void *data) -+tray_list_add_async (struct _tray_msg *msg) - { -- struct _tray_msg *list = msg->data; -- d(printf("%s:%d (tray_list_add_async) - Add %p\n",__FILE__, __LINE__, list->data)); -- tray_icons_list = g_list_prepend (tray_icons_list, list->data); -+ d(printf("%s:%d (tray_list_add_async) - Add %p\n",__FILE__, __LINE__, msg->data)); -+ tray_icons_list = g_list_prepend (tray_icons_list, msg->data); -+ -+ g_slice_free (struct _tray_msg, msg); - } - - static void - tray_list_add_new (TrayIconData *data) - { -- AlarmMsg *msg; -- struct _tray_msg *list; -+ struct _tray_msg *msg; - -- /* These two structures will be freed by the msg destroy function*/ -- msg = malloc (sizeof (AlarmMsg)); -- msg->receive_msg = tray_list_add_async; -- -- list = malloc (sizeof (struct _tray_msg)); -- list->data = data; -- msg->data = list; -- -- d(printf("%s:%d (tray_list_add_new) - Posting a task\n",__FILE__, __LINE__)); -- e_thread_put(alarm_operation_thread, (EMsg *)msg); -+ msg = g_slice_new (struct _tray_msg); -+ msg->header.func = (MessageFunc) tray_list_add_async; -+ msg->data = data; -+ -+ message_push ((Message *) msg); - } - - /* Performs notification of a display alarm */ -@@ -1836,21 +1833,13 @@ check_midnight_refresh (gpointer user_da - new_midnight = time_day_end_with_zone (time (NULL), zone); - - if (new_midnight > midnight) { -- AlarmMsg *msg; -- struct _midnight_refresh_msg *list; -- -- /* These two structures will be freed by the msg destroy function*/ -- msg = malloc (sizeof (AlarmMsg)); -- msg->receive_msg = midnight_refresh_async; -- -- list = malloc (sizeof (struct _midnight_refresh_msg)); -+ struct _midnight_refresh_msg *msg; - -- list->remove = FALSE; -- /* We dont need it. So set it to NULL */ -- msg->data = list; -+ msg = g_slice_new (struct _midnight_refresh_msg); -+ msg->header.func = (MessageFunc) midnight_refresh_async; -+ msg->remove = FALSE; - -- d(printf("%s:%d (check_midnight_refresh) - Posting a task to refresh\n",__FILE__, __LINE__)); -- e_thread_put(alarm_operation_thread, (EMsg *)msg); -+ message_push ((Message *) msg); - } - - return TRUE; -@@ -1981,14 +1970,15 @@ hash_ids (gpointer a) - } - - struct _alarm_client_msg { -+ Message header; - ECal *client; - }; - --static void alarm_queue_add_async (EThread *e, AlarmMsg *msg, void *data) -+static void -+alarm_queue_add_async (struct _alarm_client_msg *msg) - { - ClientAlarms *ca; -- struct _alarm_client_msg *list = msg->data; -- ECal *client = list->client; -+ ECal *client = msg->client; - - g_return_if_fail (alarm_queue_inited); - g_return_if_fail (client != NULL); -@@ -2019,6 +2009,8 @@ static void alarm_queue_add_async (EThre - G_CALLBACK (cal_opened_cb), - ca); - } -+ -+ g_slice_free (struct _alarm_client_msg, msg); - } - - /** -@@ -2038,20 +2030,13 @@ static void alarm_queue_add_async (EThre - void - alarm_queue_add_client (ECal *client) - { -- AlarmMsg *msg; -- struct _alarm_client_msg *list; -+ struct _alarm_client_msg *msg; - -- /* These two structures will be freed by the msg destroy function*/ -- msg = malloc (sizeof (AlarmMsg)); -- msg->receive_msg = alarm_queue_add_async; -- -- list = malloc (sizeof (struct _alarm_client_msg)); -- list->client = client; -- g_object_ref (client); -- msg->data = list; -+ msg = g_slice_new (struct _alarm_client_msg); -+ msg->header.func = (MessageFunc) alarm_queue_add_async; -+ msg->client = g_object_ref (client); - -- d(printf("%s:%d (alarm_queue_add_client) - Posting a task\n",__FILE__, __LINE__)); -- e_thread_put(alarm_operation_thread, (EMsg *)msg); -+ message_push ((Message *) msg); - } - - /* Removes a component an its alarms */ -@@ -2103,11 +2088,10 @@ remove_client_alarms (ClientAlarms *ca) - * Removes a calendar client from the alarm queueing system. - **/ - static void --alarm_queue_remove_async (EThread *e, AlarmMsg *msg, void *data) -+alarm_queue_remove_async (struct _alarm_client_msg *msg) - { - ClientAlarms *ca; -- struct _alarm_client_msg *list = msg->data; -- ECal *client = list->client; -+ ECal *client = msg->client; - - g_return_if_fail (alarm_queue_inited); - g_return_if_fail (client != NULL); -@@ -2144,6 +2128,8 @@ alarm_queue_remove_async (EThread *e, Al - g_free (ca); - - g_hash_table_remove (client_alarms_hash, client); -+ -+ g_slice_free (struct _alarm_client_msg, msg); - } - - /** alarm_queue_remove_client -@@ -2156,22 +2142,16 @@ alarm_queue_remove_async (EThread *e, Al - void - alarm_queue_remove_client (ECal *client, gboolean immediately) - { -- AlarmMsg *msg; -- struct _alarm_client_msg *list; -+ struct _alarm_client_msg *msg; - -- /* These two structures will be freed by the msg destroy function*/ -- msg = malloc (sizeof (AlarmMsg)); -- msg->receive_msg = alarm_queue_remove_async; -- -- list = malloc (sizeof (struct _alarm_client_msg)); -- list->client = client; -- msg->data = list; -+ msg = g_slice_new (struct _alarm_client_msg); -+ msg->header.func = (MessageFunc) alarm_queue_remove_async; -+ msg->client = client; - -- d(printf("%s:%d (alarm_queue_remove_client) - Posting a task\n",__FILE__, __LINE__)); - if (immediately) -- alarm_queue_remove_async (NULL, msg, NULL); -+ alarm_queue_remove_async (msg); - else -- e_thread_put(alarm_operation_thread, (EMsg *)msg); -+ message_push ((Message *) msg); - } - - /* Update non-time related variables for various structures on modification of an existing component diff --git a/evolution-2.9.1-kill-ememory.patch b/evolution-2.9.1-kill-ememory.patch index 753fe08..04f5d2a 100644 --- a/evolution-2.9.1-kill-ememory.patch +++ b/evolution-2.9.1-kill-ememory.patch @@ -30,7 +30,7 @@ - default: - string = NULL; - index = NORMALISED_LAST; -- g_assert_not_reached (); +- g_warning ("Should not be reached\n"); - } - - /* slight optimisation */ diff --git a/evolution.spec b/evolution.spec index 1f7b15f..ce00486 100644 --- a/evolution.spec +++ b/evolution.spec @@ -523,6 +523,7 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/evolution/%{evo_major}/conduits/libeaddress_conduit.so %{_libdir}/gnome-pilot/conduits/e-address.conduit +%{_libdir}/evolution/%{evo_major}/conduits/libecalendar_common_conduit.so %{_libdir}/evolution/%{evo_major}/conduits/libecalendar_conduit.so %{_libdir}/gnome-pilot/conduits/e-calendar.conduit