[evolution-data-server] Perform consistency check on local folders based on the parameter 'need-summary-check'



commit 43e2b50981540865eb76516e9c7a93f2ca049ad9
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Wed Feb 9 11:09:50 2011 +0530

    Perform consistency check on local folders based on the parameter 'need-summary-check'

 camel/providers/local/camel-local-folder.c |   15 +++++++++++++--
 camel/providers/local/camel-local-folder.h |    1 +
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c
index 551e25e..e61be8a 100644
--- a/camel/providers/local/camel-local-folder.c
+++ b/camel/providers/local/camel-local-folder.c
@@ -375,7 +375,8 @@ local_folder_refresh_info_sync (CamelFolder *folder,
 {
 	CamelLocalFolder *lf = (CamelLocalFolder *)folder;
 
-	if (camel_local_summary_check ((CamelLocalSummary *)folder->summary, lf->changes, cancellable, error) == -1)
+	if (lf->need_summary_check &&
+	    camel_local_summary_check ((CamelLocalSummary *)folder->summary, lf->changes, cancellable, error) == -1)
 		return FALSE;
 
 	if (camel_folder_change_info_changed (lf->changes)) {
@@ -509,12 +510,15 @@ camel_local_folder_construct (CamelLocalFolder *lf,
 	CamelLocalStore *ls;
 	CamelStore *parent_store;
 	const gchar *full_name;
+	const gchar *summary_check;
+	CamelURL *url;
 
 	folder = CAMEL_FOLDER (lf);
 	full_name = camel_folder_get_full_name (folder);
 	parent_store = camel_folder_get_parent_store (folder);
 
 	ls = CAMEL_LOCAL_STORE (parent_store);
+	url = CAMEL_SERVICE (parent_store)->url;
 
 	root_dir_path = camel_local_store_get_toplevel_dir (ls);
 	/* strip the trailing '/' which is always present */
@@ -534,6 +538,12 @@ camel_local_folder_construct (CamelLocalFolder *lf,
 	camel_object_set_state_filename (CAMEL_OBJECT (lf), statepath);
 	g_free (statepath);
 
+	summary_check = camel_url_get_param (url, "need-summary-check");
+	if (summary_check && !strcmp (summary_check, "no"))
+		lf->need_summary_check = FALSE;
+	else
+		lf->need_summary_check = TRUE;
+
 	lf->flags = flags;
 
 	if (camel_object_state_read (CAMEL_OBJECT (lf)) == -1) {
@@ -583,7 +593,8 @@ camel_local_folder_construct (CamelLocalFolder *lf,
 	folder->summary = (CamelFolderSummary *)CAMEL_LOCAL_FOLDER_GET_CLASS (lf)->create_summary (lf, lf->summary_path, lf->folder_path, lf->index);
 	if (!(flags & CAMEL_STORE_IS_MIGRATING) && camel_local_summary_load ((CamelLocalSummary *)folder->summary, forceindex, NULL) == -1) {
 		/* ? */
-		if (camel_local_summary_check ((CamelLocalSummary *)folder->summary, lf->changes, cancellable, error) == 0) {
+		if (lf->need_summary_check && 
+		    camel_local_summary_check ((CamelLocalSummary *)folder->summary, lf->changes, cancellable, error) == 0) {
 			/* we sync here so that any hard work setting up the folder isn't lost */
 			if (camel_local_summary_sync ((CamelLocalSummary *)folder->summary, FALSE, lf->changes, cancellable, error) == -1) {
 				g_object_unref (CAMEL_OBJECT (folder));
diff --git a/camel/providers/local/camel-local-folder.h b/camel/providers/local/camel-local-folder.h
index 02415dd..9eefa4f 100644
--- a/camel/providers/local/camel-local-folder.h
+++ b/camel/providers/local/camel-local-folder.h
@@ -56,6 +56,7 @@ struct _CamelLocalFolder {
 	CamelLocalFolderPrivate *priv;
 
 	guint32 flags;		/* open mode flags */
+	gboolean need_summary_check; 
 
 	gint locked;		/* lock counter */
 	CamelLockType locktype;	/* what type of lock we have */



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