[evolution-mapi] Bug #641123 - Not set "folder-id" property on an addressbook source



commit bb84774209c5cc95a5aaf06051aefa593feef805
Author: Milan Crha <mcrha redhat com>
Date:   Wed Feb 9 17:46:26 2011 +0100

    Bug #641123 - Not set "folder-id" property on an addressbook source

 .../exchange-mapi-account-listener.c               |   20 ++++++++++----------
 .../exchange-mapi-account-setup.c                  |    2 ++
 src/addressbook/e-book-backend-mapi.c              |    3 +++
 3 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/src/account-setup-eplugin/exchange-mapi-account-listener.c b/src/account-setup-eplugin/exchange-mapi-account-listener.c
index c74ef6a..bfa6dcf 100644
--- a/src/account-setup-eplugin/exchange-mapi-account-listener.c
+++ b/src/account-setup-eplugin/exchange-mapi-account-listener.c
@@ -607,10 +607,10 @@ remove_calendar_sources (EAccount *account)
 
 	g_object_ref (account);
 
-	if (g_main_context_is_owner (g_main_context_default ())) {
-		remove_calendar_sources_async (account, FALSE, NULL);
-	} else {
+	if (!g_main_context_get_thread_default () || g_main_context_is_owner (g_main_context_default ())) {
 		em_async_queue_push (async_ops, account, NULL, NULL, remove_calendar_sources_async);
+	} else {
+		remove_calendar_sources_async (account, FALSE, NULL);
 	}
 }
 
@@ -830,10 +830,10 @@ remove_addressbook_sources (ExchangeMAPIAccountInfo *existing_account_info)
 {
 	g_return_if_fail (existing_account_info != NULL);
 
-	if (g_main_context_is_owner (g_main_context_default ())) {
-		remove_addressbook_sources_async (copy_mapi_account_info (existing_account_info), FALSE, NULL);
-	} else {
+	if (!g_main_context_get_thread_default () || g_main_context_is_owner (g_main_context_default ())) {
 		em_async_queue_push (async_ops, copy_mapi_account_info (existing_account_info), NULL, NULL, remove_addressbook_sources_async);
+	} else {
+		remove_addressbook_sources_async (copy_mapi_account_info (existing_account_info), FALSE, NULL);
 	}
 }
 
@@ -872,10 +872,10 @@ add_sources (EAccount *account, GSList *folders, mapi_id_t trash_fid)
 	data->folders = exchange_mapi_folder_copy_list (folders);
 	data->trash_fid = trash_fid;
 
-	if (g_main_context_is_owner (g_main_context_default ())) {
-		add_sources_async (data, FALSE, NULL);
-	} else {
+	if (!g_main_context_get_thread_default () || g_main_context_is_owner (g_main_context_default ())) {
 		em_async_queue_push (async_ops, data, NULL, NULL, add_sources_async);
+	} else {
+		add_sources_async (data, FALSE, NULL);
 	}
 }
 
@@ -1021,7 +1021,7 @@ update_account_sources (EAccount *account, gboolean can_create_profile)
 {
 	g_return_if_fail (account != NULL);
 
-	if (g_main_context_is_owner (g_main_context_default ())) {
+	if (!g_main_context_get_thread_default () || g_main_context_is_owner (g_main_context_default ())) {
 		/* called from main thread, but we want this to be called
 		   in its own thread, thus create it */
 		em_async_queue_push (async_ops, g_object_ref (account), GINT_TO_POINTER (can_create_profile ? 1 : 0), update_account_sources_async, NULL);
diff --git a/src/account-setup-eplugin/exchange-mapi-account-setup.c b/src/account-setup-eplugin/exchange-mapi-account-setup.c
index 78b13a7..a176959 100644
--- a/src/account-setup-eplugin/exchange-mapi-account-setup.c
+++ b/src/account-setup-eplugin/exchange-mapi-account-setup.c
@@ -797,6 +797,8 @@ exchange_mapi_book_commit (EPlugin *epl, EConfigTarget *target)
 
 	e_source_set_property (source, "completion", "true");
 	e_source_set_property (source, "public", "no");
+	e_source_set_property (source, "folder-id", sfid);
+
 	// Update the folder list in the plugin and ExchangeMAPIFolder
 	g_free (r_uri);
 	g_free (sfid);
diff --git a/src/addressbook/e-book-backend-mapi.c b/src/addressbook/e-book-backend-mapi.c
index 5393a43..9d49c79 100644
--- a/src/addressbook/e-book-backend-mapi.c
+++ b/src/addressbook/e-book-backend-mapi.c
@@ -1535,6 +1535,9 @@ e_book_backend_mapi_update_view_by_cache (EBookBackendMAPI *ebma, EDataBookView
 	query = e_data_book_view_get_card_query (book_view);
 	e_book_backend_mapi_get_summary_and_cache (ebma, &summary, &cache);
 
+	if (!summary || !cache)
+		return;
+
 	if (e_book_backend_summary_is_summary_query (summary, query)) {
 		GPtrArray *ids = NULL;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]