[evolution] mail-folder-cache: Update folders only on stores whose support it



commit f2994d54460e8467a525851bd92941730b548914
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jan 10 15:49:27 2012 +0100

    mail-folder-cache: Update folders only on stores whose support it

 mail/mail-folder-cache.c |   43 +++++++++++++++++++++++++++++--------------
 1 files changed, 29 insertions(+), 14 deletions(-)
---
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 722016c..4092ee6 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -959,6 +959,19 @@ ping_cb (MailFolderCache *cache)
 	return TRUE;
 }
 
+static gboolean
+store_has_folder_hierarchy (CamelStore *store)
+{
+	CamelProvider *provider;
+
+	g_return_val_if_fail (store != NULL, FALSE);
+
+	provider = camel_service_get_provider (CAMEL_SERVICE (store));
+	g_return_val_if_fail (provider != NULL, FALSE);
+
+	return (provider->flags & (CAMEL_PROVIDER_IS_STORAGE | CAMEL_PROVIDER_IS_EXTERNAL)) != 0;
+}
+
 static void
 store_go_online_cb (CamelStore *store,
                     GAsyncResult *result,
@@ -971,13 +984,14 @@ store_go_online_cb (CamelStore *store,
 	if (g_hash_table_lookup (ud->cache->priv->stores, store) != NULL &&
 		!g_cancellable_is_cancelled (ud->cancellable)) {
 		/* We're already in the store update list. */
-		camel_store_get_folder_info (
-			store, NULL,
-			CAMEL_STORE_FOLDER_INFO_FAST |
-			CAMEL_STORE_FOLDER_INFO_RECURSIVE |
-			CAMEL_STORE_FOLDER_INFO_SUBSCRIBED,
-			G_PRIORITY_DEFAULT, ud->cancellable,
-			(GAsyncReadyCallback) update_folders, ud);
+		if (store_has_folder_hierarchy (store))
+			camel_store_get_folder_info (
+				store, NULL,
+				CAMEL_STORE_FOLDER_INFO_FAST |
+				CAMEL_STORE_FOLDER_INFO_RECURSIVE |
+				CAMEL_STORE_FOLDER_INFO_SUBSCRIBED,
+				G_PRIORITY_DEFAULT, ud->cancellable,
+				(GAsyncReadyCallback) update_folders, ud);
 	} else {
 		/* The store vanished, that means we were probably cancelled,
 		 * or at any rate, need to clean ourselves up. */
@@ -1633,13 +1647,14 @@ mail_folder_cache_note_store (MailFolderCache *cache,
 		}
 	} else {
 	normal_setup:
-		camel_store_get_folder_info (
-			store, NULL,
-			CAMEL_STORE_FOLDER_INFO_FAST |
-			CAMEL_STORE_FOLDER_INFO_RECURSIVE |
-			CAMEL_STORE_FOLDER_INFO_SUBSCRIBED,
-			G_PRIORITY_DEFAULT, cancellable,
-			(GAsyncReadyCallback) update_folders, ud);
+		if (store_has_folder_hierarchy (store))
+			camel_store_get_folder_info (
+				store, NULL,
+				CAMEL_STORE_FOLDER_INFO_FAST |
+				CAMEL_STORE_FOLDER_INFO_RECURSIVE |
+				CAMEL_STORE_FOLDER_INFO_SUBSCRIBED,
+				G_PRIORITY_DEFAULT, cancellable,
+				(GAsyncReadyCallback) update_folders, ud);
 	}
 
 	g_queue_push_tail (&si->folderinfo_updates, ud);



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