aboutsummaryrefslogtreecommitdiffstats
path: root/filter/rule-context.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-11-13 17:31:06 +0800
committerMichael Zucci <zucchi@src.gnome.org>2002-11-13 17:31:06 +0800
commitac1de7eaf96bb7adbf0c58ca2c3a3466654aaead (patch)
tree95fb67eb0a7c115f03fb7cf0199ebc0d13712d3c /filter/rule-context.c
parent9e4f25d532f59d85034cbef768bb941f748fb1f2 (diff)
downloadgsoc2013-evolution-ac1de7eaf96bb7adbf0c58ca2c3a3466654aaead.tar
gsoc2013-evolution-ac1de7eaf96bb7adbf0c58ca2c3a3466654aaead.tar.gz
gsoc2013-evolution-ac1de7eaf96bb7adbf0c58ca2c3a3466654aaead.tar.bz2
gsoc2013-evolution-ac1de7eaf96bb7adbf0c58ca2c3a3466654aaead.tar.lz
gsoc2013-evolution-ac1de7eaf96bb7adbf0c58ca2c3a3466654aaead.tar.xz
gsoc2013-evolution-ac1de7eaf96bb7adbf0c58ca2c3a3466654aaead.tar.zst
gsoc2013-evolution-ac1de7eaf96bb7adbf0c58ca2c3a3466654aaead.zip
Get the root node properly.
2002-11-13 Not Zed <NotZed@Ximian.com> * rule-context.c (load): Get the root node properly. * rule-editor.c (rule_add): cast g_object_weak_ref (rule_edit): " * all: xml2 node change - childs->children. Also, ignore 'text' nodes while scanning tree. * rule-context.h: gnome-xml->libxml. * filter-element.h: gnome-xml->libxml svn path=/trunk/; revision=18732
Diffstat (limited to 'filter/rule-context.c')
-rw-r--r--filter/rule-context.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/filter/rule-context.c b/filter/rule-context.c
index aefc20b935..fe23831807 100644
--- a/filter/rule-context.c
+++ b/filter/rule-context.c
@@ -286,7 +286,7 @@ rule_context_load (RuleContext *rc, const char *system, const char *user)
static int
load (RuleContext *rc, const char *system, const char *user)
{
- xmlNodePtr set, rule;
+ xmlNodePtr set, rule, root;
struct _part_set_map *part_map;
struct _rule_set_map *rule_map;
@@ -300,8 +300,9 @@ load (RuleContext *rc, const char *system, const char *user)
system, g_strerror (errno)));
return -1;
}
-
- if (strcmp (rc->system->name, "filterdescription")) {
+
+ root = xmlDocGetRootElement(rc->system);
+ if (root == NULL || strcmp (root->name, "filterdescription")) {
rule_context_set_error (rc, g_strdup_printf ("Unable to load system rules '%s': Invalid format", system));
xmlFreeDoc (rc->system);
rc->system = NULL;
@@ -312,7 +313,7 @@ load (RuleContext *rc, const char *system, const char *user)
/* now parse structure */
/* get rule parts */
- set = rc->system->children;
+ set = root->children;
while (set) {
d(printf("set name = %s\n", set->name));
part_map = g_hash_table_lookup (rc->part_set_map, set->name);
@@ -338,7 +339,8 @@ load (RuleContext *rc, const char *system, const char *user)
/* now load actual rules */
if (rc->user) {
- set = rc->user->children;
+ root = xmlDocGetRootElement(rc->user);
+ set = root?root->children:NULL;
while (set) {
d(printf("set name = %s\n", set->name));
rule_map = g_hash_table_lookup (rc->rule_set_map, set->name);
@@ -413,7 +415,9 @@ save (RuleContext *rc, const char *user)
l = g_list_next (l);
}
- ret = e_xml_save_file (user, doc);
+#warning "xmlSaveFile used here"
+ ret = xmlSaveFile (user, doc);
+ /*ret = e_xml_save_file (user, doc);*/
xmlFreeDoc (doc);