From 2e158d6b35603cf3817a07ea70405c3687202a65 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 5 Jan 2004 18:46:02 +0000 Subject: If we aren't in the main thread, proxy it over to the main thread. 2004-01-05 Jeffrey Stedfast * em-folder-tree-model.c (folder_subscribed_cb): If we aren't in the main thread, proxy it over to the main thread. (folder_unsubscribed_cb): Same. (folder_created_cb): Here too. (folder_deleted_cb): And here. (folder_renamed_cb): Again here. * em-folder-view.c (emfv_set_folder_uri): Pass mail_thread_queued to mail_get_folder() instead of mail_thread_new so that we eliminate a race when switching folders in the UI. svn path=/trunk/; revision=24050 --- mail/em-folder-tree-model.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'mail/em-folder-tree-model.c') diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index fdbf7ab93b..118f05f28e 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -39,6 +39,7 @@ #include "mail-config.h" #include "mail-session.h" #include "mail-tools.h" +#include "mail-mt.h" #include "em-utils.h" @@ -795,6 +796,11 @@ folder_subscribed_cb (CamelStore *store, void *event_data, EMFolderTreeModel *mo gboolean load; char *dirname; + if (pthread_self () != mail_gui_thread) { + mail_async_event_emit (mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) folder_subscribed_cb, store, event_data, model); + return; + } + if (!(si = g_hash_table_lookup (model->store_hash, store))) return; @@ -849,6 +855,11 @@ folder_unsubscribed_cb (CamelStore *store, void *event_data, EMFolderTreeModel * GtkTreePath *path; GtkTreeIter iter; + if (pthread_self () != mail_gui_thread) { + mail_async_event_emit (mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) folder_unsubscribed_cb, store, event_data, model); + return; + } + if (!(si = g_hash_table_lookup (model->store_hash, store))) return; @@ -867,6 +878,11 @@ folder_unsubscribed_cb (CamelStore *store, void *event_data, EMFolderTreeModel * static void folder_created_cb (CamelStore *store, void *event_data, EMFolderTreeModel *model) { + if (pthread_self () != mail_gui_thread) { + mail_async_event_emit (mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) folder_created_cb, store, event_data, model); + return; + } + /* we only want created events to do more work if we don't support subscriptions */ if (!camel_store_supports_subscriptions (store)) folder_subscribed_cb (store, event_data, model); @@ -875,6 +891,11 @@ folder_created_cb (CamelStore *store, void *event_data, EMFolderTreeModel *model static void folder_deleted_cb (CamelStore *store, void *event_data, EMFolderTreeModel *model) { + if (pthread_self () != mail_gui_thread) { + mail_async_event_emit (mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) folder_deleted_cb, store, event_data, model); + return; + } + /* we only want deleted events to do more work if we don't support subscriptions */ if (!camel_store_supports_subscriptions (store)) folder_unsubscribed_cb (store, event_data, model); @@ -890,6 +911,11 @@ folder_renamed_cb (CamelStore *store, void *event_data, EMFolderTreeModel *model GtkTreePath *path; char *parent, *p; + if (pthread_self () != mail_gui_thread) { + mail_async_event_emit (mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) folder_renamed_cb, store, event_data, model); + return; + } + if (!(si = g_hash_table_lookup (model->store_hash, store))) return; -- cgit