[evolution-mapi] Update CamelMapiFolder completely when folder object count changed



commit 6274dd970332da0262715c7a47d78e8366355b7d
Author: Milan Crha <mcrha redhat com>
Date:   Fri Nov 18 21:16:58 2011 +0100

    Update CamelMapiFolder completely when folder object count changed

 src/camel/camel-mapi-folder-summary.c |    1 +
 src/camel/camel-mapi-folder-summary.h |    2 ++
 src/camel/camel-mapi-folder.c         |   15 +++++++++++++--
 3 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/camel/camel-mapi-folder-summary.c b/src/camel/camel-mapi-folder-summary.c
index d99bd35..7b9964c 100644
--- a/src/camel/camel-mapi-folder-summary.c
+++ b/src/camel/camel-mapi-folder-summary.c
@@ -103,6 +103,7 @@ static void
 camel_mapi_folder_summary_init (CamelMapiFolderSummary *mapi_summary)
 {
 	mapi_summary->latest_last_modify = 0;
+	mapi_summary->last_obj_total = -1;
 }
 
 /**
diff --git a/src/camel/camel-mapi-folder-summary.h b/src/camel/camel-mapi-folder-summary.h
index 0e2f8ac..bc6a664 100644
--- a/src/camel/camel-mapi-folder-summary.h
+++ b/src/camel/camel-mapi-folder-summary.h
@@ -67,6 +67,8 @@ struct _CamelMapiFolderSummary {
 	CamelFolderSummary parent;
 
 	time_t latest_last_modify;
+	gint last_obj_total;
+
 	guint32 version;
 	guint32 validity;
 };
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index c5c5e0a..0f60b4d 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -839,6 +839,7 @@ camel_mapi_folder_fetch_summary (CamelFolder *folder, GCancellable *cancellable,
 	CamelMapiFolder *mapi_folder = CAMEL_MAPI_FOLDER (folder);
 	CamelMapiFolderSummary *mapi_summary = CAMEL_MAPI_FOLDER_SUMMARY (folder->summary);
 	EMapiConnection *conn = camel_mapi_store_get_connection (mapi_store);
+	struct FolderBasicPropertiesData fbp;
 	struct GatherChangedObjectsData gco;
 	mapi_object_t obj_folder;
 
@@ -861,6 +862,14 @@ camel_mapi_folder_fetch_summary (CamelFolder *folder, GCancellable *cancellable,
 	else
 		status = e_mapi_connection_open_personal_folder (conn, mapi_folder->folder_id, &obj_folder, cancellable, mapi_error);
 
+	if (status) {
+		status = e_mapi_connection_get_folder_properties (conn, &obj_folder, NULL, NULL, e_mapi_utils_get_folder_basic_properties_cb, &fbp, cancellable, mapi_error);
+		if (status) {
+			if (mapi_summary->last_obj_total != fbp.obj_total)
+				mapi_summary->latest_last_modify = 0;
+		}
+	}
+
 	gco.latest_last_modify = 0;
 	gco.fid = mapi_object_get_id (&obj_folder);
 	gco.summary = folder->summary;
@@ -946,8 +955,10 @@ camel_mapi_folder_fetch_summary (CamelFolder *folder, GCancellable *cancellable,
 
 	camel_operation_pop_message (cancellable);
 
-	if (status && gco.latest_last_modify > 0) {
-		mapi_summary->latest_last_modify = gco.latest_last_modify;
+	if (status) {
+		if (gco.latest_last_modify > 0)
+			mapi_summary->latest_last_modify = gco.latest_last_modify;
+		mapi_summary->last_obj_total = fbp.obj_total;
 	}
 
 	camel_folder_thaw (folder);



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