File e-d-s-store_synchronize_sync.patch of Package evolution-data-server

From 71257132e4673566a26d8a0f9cb2e066367444bb Mon Sep 17 00:00:00 2001
From: Matthew Barnes <mbarnes@redhat.com>
Date: Fri, 01 Feb 2013 12:42:14 +0000
Subject: store_synchronize_sync() cleanups.

(cherry picked from commit ad1b7cd145c5fa5443556c17ba6e9d701c531bb7)
---
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 593b426..e5a1863 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -343,9 +343,8 @@ store_synchronize_sync (CamelStore *store,
                         GError **error)
 {
 	GPtrArray *folders;
-	CamelFolder *folder;
 	gboolean success = TRUE;
-	gint i;
+	gint ii;
 	GError *local_error = NULL;
 
 	if (expunge) {
@@ -353,27 +352,32 @@ store_synchronize_sync (CamelStore *store,
 		CamelFolderInfo *root, *fi;
 
 		folders = g_ptr_array_new ();
-		root = camel_store_get_folder_info_sync (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL, NULL, NULL);
+		root = camel_store_get_folder_info_sync (
+			store, NULL,
+			CAMEL_STORE_FOLDER_INFO_RECURSIVE |
+			CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL,
+			NULL, NULL);
 		fi = root;
-		while (fi) {
+		while (fi != NULL) {
 			CamelFolderInfo *next;
 
 			if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0) {
-				CamelFolder *fldr;
+				CamelFolder *folder;
 
-				fldr = camel_store_get_folder_sync (store, fi->full_name, 0, NULL, NULL);
-				if (fldr)
-					g_ptr_array_add (folders, fldr);
+				folder = camel_store_get_folder_sync (
+					store, fi->full_name, 0, NULL, NULL);
+				if (folder != NULL)
+					g_ptr_array_add (folders, folder);
 			}
 
 			/* pick the next */
 			next = fi->child;
-			if (!next)
+			if (next == NULL)
 				next = fi->next;
-			if (!next) {
+			if (next == NULL) {
 				next = fi->parent;
-				while (next) {
-					if (next->next) {
+				while (next != NULL) {
+					if (next->next != NULL) {
 						next = next->next;
 						break;
 					}
@@ -385,7 +389,7 @@ store_synchronize_sync (CamelStore *store,
 			fi = next;
 		}
 
-		if (root)
+		if (root != NULL)
 			camel_store_free_folder_info_full (store, root);
 	} else {
 		/* sync only folders opened until now */
@@ -395,10 +399,10 @@ store_synchronize_sync (CamelStore *store,
 	/* We don't sync any vFolders, that is used to update certain
 	 * vfolder queries mainly, and we're really only interested in
 	 * storing/expunging the physical mails. */
-	for (i = 0; i < folders->len; i++) {
-		folder = folders->pdata[i];
-		if (!CAMEL_IS_VEE_FOLDER (folder)
-		    && local_error == NULL) {
+	for (ii = 0; ii < folders->len; ii++) {
+		CamelFolder *folder = folders->pdata[ii];
+
+		if (!CAMEL_IS_VEE_FOLDER (folder) && local_error == NULL) {
 			camel_folder_synchronize_sync (
 				folder, expunge, cancellable, &local_error);
 			ignore_no_such_table_exception (&local_error);
--
cgit v0.9.0.2
From 3e7b237a6242a724830a412b95bbf8a80eb65d99 Mon Sep 17 00:00:00 2001
From: Matthew Barnes <mbarnes@redhat.com>
Date: Fri, 01 Feb 2013 12:45:56 +0000
Subject: store_synchronize_sync(): Only sync subscribed folders.

I recently added a Gmane (NNTP) account and have only a few newsgroup
subscriptions.  Yet when I quit Evolution, Camel tries to synchronize
all 13,872 newsgroups which literally takes days to complete.

This adds a CAMEL_STORE_FOLDER_INFO_SUBSCRIBED flag to the request for
a folder info tree while synchronizing + expunging.

Note, CamelIMAPXStore will ignore the CAMEL_STORE_FOLDER_INFO_SUBSCRIBED
flag if its "use-subscriptions" setting is FALSE, which is what we want.

(cherry picked from commit 48b9d17d16be9f0ecb6066036cc83d08b3cca817)
---
diff --git a/camel/camel-store.c b/camel/camel-store.c
index e5a1863..b74126f 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -355,6 +355,7 @@ store_synchronize_sync (CamelStore *store,
 		root = camel_store_get_folder_info_sync (
 			store, NULL,
 			CAMEL_STORE_FOLDER_INFO_RECURSIVE |
+			CAMEL_STORE_FOLDER_INFO_SUBSCRIBED |
 			CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL,
 			NULL, NULL);
 		fi = root;
--
cgit v0.9.0.2
openSUSE Build Service is sponsored by