[evolution-data-server] CamelStoreSummary: Save count changes from CamelFolderSummary immediately



commit 5c52fe678f6d03b50625c385e968650df0e0c068
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jan 17 14:33:55 2012 +0100

    CamelStoreSummary: Save count changes from CamelFolderSummary immediately

 camel/camel-store-summary.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/camel/camel-store-summary.c b/camel/camel-store-summary.c
index 1b3c7e8..82324dd 100644
--- a/camel/camel-store-summary.c
+++ b/camel/camel-store-summary.c
@@ -1104,6 +1104,7 @@ store_summary_sync_folder_summary_count_cb (CamelFolderSummary *folder_summary,
                                             GParamSpec *param,
                                             CamelStoreSummary *summary)
 {
+	gint new_count;
 	const gchar *path;
 	CamelStoreInfo *si;
 
@@ -1126,11 +1127,19 @@ store_summary_sync_folder_summary_count_cb (CamelFolderSummary *folder_summary,
 	}
 
 	if (g_strcmp0 (g_param_spec_get_name (param), "saved-count") == 0) {
-		si->total = camel_folder_summary_get_saved_count (folder_summary);
-		camel_store_summary_touch (summary);
+		new_count = camel_folder_summary_get_saved_count (folder_summary);
+		if (si->total != new_count) {
+			si->total = new_count;
+			camel_store_summary_touch (summary);
+			camel_store_summary_save (summary);
+		}
 	} else if (g_strcmp0 (g_param_spec_get_name (param), "unread-count") == 0) {
-		si->unread = camel_folder_summary_get_unread_count (folder_summary);
-		camel_store_summary_touch (summary);
+		new_count = camel_folder_summary_get_unread_count (folder_summary);
+		if (si->unread != new_count) {
+			si->unread = new_count;
+			camel_store_summary_touch (summary);
+			camel_store_summary_save (summary);
+		}
 	} else {
 		g_warn_if_reached ();
 	}



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