[evolution-patches] 232499, renaming view meta-data along with folder



messy if simple.

-- 
adfa(evolution-2.4:20087): gtkhtml-WARNING **: cannot find icon:
'stock_insert-url' in gnome 
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3687
diff -u -p -r1.3687 ChangeLog
--- mail/ChangeLog	11 Aug 2005 03:55:17 -0000	1.3687
+++ mail/ChangeLog	11 Aug 2005 07:49:08 -0000
@@ -1,3 +1,10 @@
+2005-08-11  Not Zed  <NotZed Ximian com>
+
+	** See #232499.
+
+	* mail-folder-cache.c (rename_folders): rename view meta-data
+	along with the folder.
+
 2005-08-10  Not Zed  <NotZed Ximian com>
 
 	** See #271985.
Index: mail/mail-folder-cache.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-folder-cache.c,v
retrieving revision 1.100
diff -u -p -r1.100 mail-folder-cache.c
--- mail/mail-folder-cache.c	21 Jul 2005 04:15:21 -0000	1.100
+++ mail/mail-folder-cache.c	11 Aug 2005 07:49:09 -0000
@@ -588,10 +588,32 @@ store_folder_deleted(CamelObject *o, voi
 		store_folder_unsubscribed(o, event_data, data);
 }
 
+static char *
+folder_to_url(CamelStore *store, const char *full_name)
+{
+	CamelURL *url;
+	char *out;
+
+	url = camel_url_copy(((CamelService *)store)->url);
+	if (((CamelService *)store)->provider->url_flags  & CAMEL_URL_FRAGMENT_IS_PATH) {
+		camel_url_set_fragment(url, full_name);
+	} else {
+		char *name = g_alloca(strlen(full_name)+2);
+
+		sprintf(name, "/%s", full_name);
+		camel_url_set_path(url, name);
+	}
+
+	out = camel_url_to_string(url, CAMEL_URL_HIDE_ALL);
+	camel_url_free(url);
+
+	return out;
+}
+
 static void
 rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, CamelFolderInfo *fi)
 {
-	char *old;
+	char *old, *olduri, *oldfile, *newuri, *newfile;
 	struct _folder_info *mfi;
 	struct _folder_update *up;
 
@@ -630,8 +652,6 @@ rename_folders(struct _store_info *si, c
 		g_hash_table_insert(si->folders_uri, mfi->uri, mfi);
 	}
 
-	g_free(old);
-
 	up->full_name = g_strdup(mfi->full_name);
 	up->uri = g_strdup(mfi->uri);
 	up->unread = fi->unread==-1?0:fi->unread;
@@ -649,6 +669,26 @@ rename_folders(struct _store_info *si, c
 	if (fi->child)
 		rename_folders(si, oldbase, newbase, fi->child, folders);
 #endif
+
+	/* rename the meta-data we maintain ourselves */
+	olduri = folder_to_url(si->store, old);
+	e_filename_make_safe(olduri);
+	newuri = folder_to_url(si->store, fi->full_name);
+	e_filename_make_safe(newuri);
+	oldfile = g_strdup_printf("%s/mail/config/custom_view-%s.xml", mail_component_peek_base_directory(NULL), olduri);
+	newfile = g_strdup_printf("%s/mail/config/custom_view-%s.xml", mail_component_peek_base_directory(NULL), newuri);
+	rename(oldfile, newfile);
+	g_free(oldfile);
+	g_free(newfile);
+	oldfile = g_strdup_printf("%s/mail/config/current_view-%s.xml", mail_component_peek_base_directory(NULL), olduri);
+	newfile = g_strdup_printf("%s/mail/config/current_view-%s.xml", mail_component_peek_base_directory(NULL), newuri);
+	rename(oldfile, newfile);
+	g_free(oldfile);
+	g_free(newfile);
+	g_free(olduri);
+	g_free(newuri);
+
+	g_free(old);
 }
 
 static void


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