[evolution-patches] 71528, search upgrade fix
- From: Not Zed <notzed ximian com>
- To: asdf <evolution-patches lists ximian com>
- Subject: [evolution-patches] 71528, search upgrade fix
- Date: Mon, 21 Feb 2005 11:15:54 +0800
untested, it compiles, couldn't be bothered wasting time setting up a test environment
? mail/ems.diff
? mail/evolution-mail-2.0.schemas
? mail/m.diff
? mail/ma.diff
? mail/default/zh_CN/Makefile
? mail/default/zh_CN/Makefile.in
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3576
diff -u -p -r1.3576 ChangeLog
--- mail/ChangeLog 18 Feb 2005 16:43:55 -0000 1.3576
+++ mail/ChangeLog 21 Feb 2005 03:19:27 -0000
@@ -1,3 +1,10 @@
+2005-02-21 Not Zed <NotZed Ximian com>
+
+ ** See bug #71528.
+
+ * em-migrate.c (remove_system_searches, em_migrate_1_4): remove
+ all 'system' searches when upgrading from pre 2.0.
+
2005-02-18 Rodney Dawes <dobey novell com>
* mail/em-folder-view.c (emfv_popup_copy_text): New method to copy
Index: mail/em-migrate.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-migrate.c,v
retrieving revision 1.47
diff -u -p -r1.47 em-migrate.c
--- mail/em-migrate.c 3 Dec 2004 03:38:03 -0000 1.47
+++ mail/em-migrate.c 21 Feb 2005 03:19:27 -0000
@@ -2470,6 +2470,42 @@ em_migrate_imap_cmeta_1_4(const char *ev
return 0;
}
+static void
+remove_system_searches(xmlDocPtr searches)
+{
+ xmlNodePtr node;
+
+ /* in pre 2.0, system searches were stored in the user
+ * searches.xml file with the source set to 'demand'. In 2.0+
+ * the system searches are stored in the system
+ * searchtypes.xml file instead */
+
+ node = xmlDocGetRootElement(searches);
+ if (!node->name || strcmp(node->name, "filteroptions"))
+ return;
+
+ if (!(node = xml_find_node(node, "ruleset")))
+ return;
+
+ node = node->children;
+ while (node != NULL) {
+ xmlNodePtr nnode = node->next;
+
+ if (node->name && !strcmp (node->name, "rule")) {
+ char *src;
+
+ src = xmlGetProp(node, "source");
+ if (src && !strcmp(src, "demand")) {
+ xmlUnlinkNode(node);
+ xmlFreeNodeList(node);
+ }
+ xmlFree (src);
+ }
+
+ node = nnode;
+ }
+}
+
static int
em_migrate_1_4 (const char *evolution_dir, xmlDocPtr filters, xmlDocPtr vfolders, CamelException *ex)
{
@@ -2477,7 +2513,8 @@ em_migrate_1_4 (const char *evolution_di
CamelException lex;
struct stat st;
char *path;
-
+ xmlDocPtr searches;
+
path = g_build_filename (evolution_dir, "mail", NULL);
camel_init (path, TRUE);
@@ -2526,16 +2563,17 @@ em_migrate_1_4 (const char *evolution_di
upgrade_xml_uris(filters, upgrade_xml_uris_1_4);
upgrade_vfolder_sources_1_4(vfolders);
upgrade_xml_uris(vfolders, upgrade_xml_uris_1_4);
-
- path = g_build_filename (g_get_home_dir (), "evolution", "searches.xml", NULL);
- if (stat (path, &st) == 0 && S_ISREG (st.st_mode)) {
- char *dest;
-
- dest = g_build_filename (evolution_dir, "mail", "searches.xml", NULL);
- cp (path, dest, FALSE, CP_UNIQUE);
- g_free (dest);
+
+ path = g_build_filename(g_get_home_dir(), "evolution", NULL);
+ searches = emm_load_file(path, "searches.xml");
+ g_free(path);
+ if (searches) {
+ remove_system_searches(searches);
+ path = g_build_filename(evolution_dir, "mail", NULL);
+ emm_save_xml(searches, path, "searches.xml");
+ g_free(path);
+ xmlFreeDoc(searches);
}
- g_free (path);
if (em_migrate_pop_uid_caches_1_4 (evolution_dir, ex) == -1)
return -1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]