[evolution-ews] Add version information to CamelEwsStoreSummary



commit bc26dec4510b7297bfc3ecba17ea42b3d5d0db45
Author: Milan Crha <mcrha redhat com>
Date:   Fri Aug 10 08:47:12 2012 +0200

    Add version information to CamelEwsStoreSummary
    
    On version bump will be all folders fetched again, like on the first
    run of evolution-ews after account configuration finished, with old
    folder information being deleted.

 src/camel/camel-ews-store-summary.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/camel/camel-ews-store-summary.c b/src/camel/camel-ews-store-summary.c
index cbf6b66..08e4dcc 100644
--- a/src/camel/camel-ews-store-summary.c
+++ b/src/camel/camel-ews-store-summary.c
@@ -10,6 +10,7 @@
 #define S_UNLOCK(x) (g_static_rec_mutex_unlock(&(x)->priv->s_lock))
 
 #define STORE_GROUP_NAME "##storepriv"
+#define CURRENT_SUMMARY_VERSION 1
 
 struct _CamelEwsStoreSummaryPrivate {
 	GKeyFile *key_file;
@@ -183,7 +184,15 @@ camel_ews_store_summary_load (CamelEwsStoreSummary *ews_summary,
 	ret = g_key_file_load_from_file (
 		priv->key_file, priv->path, 0, error);
 
-	load_id_fname_hash (ews_summary);
+	if (CURRENT_SUMMARY_VERSION != g_key_file_get_integer (priv->key_file, STORE_GROUP_NAME, "Version", NULL)) {
+		/* version doesn't match, get folders again */
+		camel_ews_store_summary_clear (ews_summary);
+
+		g_key_file_set_integer (priv->key_file, STORE_GROUP_NAME, "Version", CURRENT_SUMMARY_VERSION);
+	} else {
+		load_id_fname_hash (ews_summary);
+	}
+
 	S_UNLOCK (ews_summary);
 
 	return ret;



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