diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2004-03-05 05:07:00 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-03-05 05:07:00 +0800 |
commit | 018866693e09f835b137b25f255d795f69d4a50e (patch) | |
tree | 1f6067064c09729fbbbc723d5060d9e469df6ce3 /mail/em-migrate.c | |
parent | 7a0455fc2b247575cb6fe7199a7494fa812503c4 (diff) | |
download | gsoc2013-evolution-018866693e09f835b137b25f255d795f69d4a50e.tar.gz gsoc2013-evolution-018866693e09f835b137b25f255d795f69d4a50e.tar.zst gsoc2013-evolution-018866693e09f835b137b25f255d795f69d4a50e.zip |
If event == NULL, don't try to use event->key.time
2004-03-04 Jeffrey Stedfast <fejj@ximian.com>
* em-folder-view.c (emfv_popup): If event == NULL, don't try to
use event->key.time
* em-migrate.c (upgrade_vfolder_sources_1_4): New function to
upgrade vfolder sources.
(em_upgrade_xml_1_4): If the doc is vfolders.xml, upgrade the
sources nodes.
svn path=/trunk/; revision=24971
Diffstat (limited to 'mail/em-migrate.c')
-rw-r--r-- | mail/em-migrate.c | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/mail/em-migrate.c b/mail/em-migrate.c index 8096e2ef99..19d44387d7 100644 --- a/mail/em-migrate.c +++ b/mail/em-migrate.c @@ -1737,9 +1737,52 @@ upgrade_xml_uris_1_4 (const char *uri) } } +static void +upgrade_vfolder_sources_1_4 (xmlDocPtr doc) +{ + xmlNodePtr root, node; + + if (!doc || !(root = xmlDocGetRootElement (doc))) + return; + + if (!root->name || strcmp (root->name, "filteroptions") != 0) { + /* root node is not <filteroptions>, nothing to upgrade */ + return; + } + + if (!(node = xml_find_node (root, "ruleset"))) { + /* no ruleset node, nothing to upgrade */ + return; + } + + node = node->children; + while (node != NULL) { + if (node->name && !strcmp (node->name, "rule")) { + xmlNodePtr sources; + char *src; + + if (!(src = xmlGetProp (node, "source"))) + src = xmlStrdup ("local"); /* default to all local folders? */ + + xmlSetProp (node, "source", "incoming"); + + if (!(sources = xml_find_node (node, "sources"))) + sources = xmlNewChild (node, NULL, "sources", NULL); + + xmlSetProp (sources, "with", src); + xmlFree (src); + } + + node = node->next; + } +} + static int -em_upgrade_xml_1_4 (xmlDocPtr doc) +em_upgrade_xml_1_4 (xmlDocPtr doc, gboolean vfolders_xml) { + if (vfolders_xml) + upgrade_vfolder_sources_1_4 (doc); + return upgrade_xml_uris (doc, upgrade_xml_uris_1_4); } @@ -2157,10 +2200,10 @@ em_migrate_1_4 (const char *evolution_dir, xmlDocPtr filters, xmlDocPtr vfolders if (em_upgrade_accounts_1_4 () == -1) return -1; - if (em_upgrade_xml_1_4 (filters) == -1) + if (em_upgrade_xml_1_4 (filters, FALSE) == -1) return -1; - if (em_upgrade_xml_1_4 (vfolders) == -1) + if (em_upgrade_xml_1_4 (vfolders, TRUE) == -1) return -1; path = g_build_filename (g_get_home_dir (), "evolution", "searches.xml", NULL); |