evolution-mapi r87 - trunk/src/camel



Author: jjohnny
Date: Sat Jan 31 05:46:37 2009
New Revision: 87
URL: http://svn.gnome.org/viewvc/evolution-mapi?rev=87&view=rev

Log:
Fixes #568521. Update summary after a rename.

Modified:
   trunk/src/camel/ChangeLog
   trunk/src/camel/camel-mapi-folder.c
   trunk/src/camel/camel-mapi-store.c

Modified: trunk/src/camel/camel-mapi-folder.c
==============================================================================
--- trunk/src/camel/camel-mapi-folder.c	(original)
+++ trunk/src/camel/camel-mapi-folder.c	Sat Jan 31 05:46:37 2009
@@ -1489,6 +1489,12 @@
 }
 
 static void
+mapi_folder_rename (CamelFolder *folder, const char *new)
+{
+	((CamelFolderClass *)parent_class)->rename(folder, new);
+}
+
+static void
 camel_mapi_folder_class_init (CamelMapiFolderClass *camel_mapi_folder_class)
 {
 	CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_mapi_folder_class);
@@ -1498,7 +1504,7 @@
 	((CamelObjectClass *) camel_mapi_folder_class)->getv = mapi_getv;
 
 	camel_folder_class->get_message = mapi_folder_get_message;
-/*  	camel_folder_class->rename = mapi_folder_rename; */
+ 	camel_folder_class->rename = mapi_folder_rename;
 	camel_folder_class->search_by_expression = mapi_folder_search_by_expression;
 /* 	camel_folder_class->get_message_info = mapi_get_message_info; */
 /* 	camel_folder_class->search_by_uids = mapi_folder_search_by_uids;  */

Modified: trunk/src/camel/camel-mapi-store.c
==============================================================================
--- trunk/src/camel/camel-mapi-store.c	(original)
+++ trunk/src/camel/camel-mapi-store.c	Sat Jan 31 05:46:37 2009
@@ -638,6 +638,7 @@
 {
 	CamelMapiStore *mapi_store = CAMEL_MAPI_STORE (store);
 	CamelMapiStorePrivate  *priv = mapi_store->priv;
+	CamelStoreInfo *si = NULL;
 	char *oldpath, *newpath, *storepath;
 	const char *folder_id;
 	char *temp = NULL;
@@ -659,7 +660,8 @@
 
 	folder_id = camel_mapi_store_folder_id_lookup (mapi_store, temp);
 	if (!folder_id) {
-		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot rename MAPI folder `%s'. Folder does not exist."),
+		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, 
+				      _("Cannot rename MAPI folder `%s'. Folder does not exist."),
 				      old_name);
 		CAMEL_SERVICE_REC_UNLOCK (mapi_store, connect_lock);
 		return;
@@ -667,12 +669,12 @@
 
 	/*Do not allow rename for system folders.*/
 	if (mapi_fid_is_system_folder (mapi_store, folder_id)) {
-		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot rename MAPI folder `%s' to `%s'. Default folder."),
+		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, 
+				      _("Cannot rename MAPI folder `%s' to `%s'. Default folder."),
 				      old_name, new_name);
 		return;
 	}
 
-
 	exchange_mapi_util_mapi_id_from_string (folder_id, &fid);
 		
 	temp = strrchr (new_name, '/');
@@ -683,12 +685,15 @@
 	
 	if (!exchange_mapi_rename_folder (fid , temp))
 	{
-		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot rename MAPI folder `%s' to `%s'"),
-				      old_name, new_name);
+		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, 
+				      _("Cannot rename MAPI folder `%s' to `%s'"), old_name, new_name);
+
 		CAMEL_SERVICE_REC_UNLOCK (mapi_store, connect_lock);
 		return;
 	}
 
+	CAMEL_SERVICE_REC_UNLOCK (mapi_store, connect_lock);
+
 	g_hash_table_replace (priv->id_hash, g_strdup(folder_id), g_strdup(temp));
 
 	g_hash_table_insert (priv->name_hash, g_strdup(new_name), g_strdup(folder_id));
@@ -700,6 +705,17 @@
 	g_free (storepath);
 
 	/*XXX: make sure the summary is also renamed*/
+	si = camel_store_summary_path ((CamelStoreSummary *)mapi_store->summary, old_name);
+
+	if (si) {
+		camel_store_info_set_string((CamelStoreSummary *)mapi_store->summary, si,
+					    CAMEL_STORE_INFO_PATH, new_name);
+		camel_store_info_set_string((CamelStoreSummary *)mapi_store->summary, si,
+					    CAMEL_MAPI_STORE_INFO_FULL_NAME, new_name);
+
+		camel_store_summary_touch((CamelStoreSummary *)mapi_store->summary);
+	}
+
 	if (g_rename (oldpath, newpath) == -1) {
 		g_warning ("Could not rename message cache '%s' to '%s': %s: cache reset",
 				oldpath, newpath, strerror (errno));
@@ -707,7 +723,7 @@
 
 	g_free (oldpath);
 	g_free (newpath);
-	CAMEL_SERVICE_REC_UNLOCK (mapi_store, connect_lock);
+
 }
 
 static guint32 hexnib(guint32 c)
@@ -953,7 +969,7 @@
 	}
 
 	/*FIXME*/
-	if (!((!subscribed) && info_fast) ) {
+	if (!((!subscribed) && info_fast) && top[0] == '\0') {
 		fi = mapi_build_folder_info(mapi_store, NULL, DISPLAY_NAME_FAVOURITES);
 		fi->flags |= CAMEL_FOLDER_NOSELECT;
 		fi->flags |= CAMEL_FOLDER_SYSTEM;



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