aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--filter/ChangeLog12
-rw-r--r--filter/filter-datespec.c2
-rw-r--r--filter/filter-element.h4
-rw-r--r--filter/filter-file.c4
-rw-r--r--filter/filter-filter.c6
-rw-r--r--filter/filter-folder.c2
-rw-r--r--filter/filter-input.c4
-rw-r--r--filter/filter-option.c6
-rw-r--r--filter/filter-part.c6
-rw-r--r--filter/filter-rule.c6
-rw-r--r--filter/filter-source.c2
-rw-r--r--filter/rule-context.c16
-rw-r--r--filter/rule-context.h2
-rw-r--r--filter/rule-editor.c4
-rw-r--r--filter/score-rule.c2
-rw-r--r--filter/vfolder-rule.c4
16 files changed, 49 insertions, 33 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 12abd29ea0..815481e7a7 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,5 +1,17 @@
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
+
* vfolder-rule.c (source_add): comment out gtk_destroyed check.
* filter-label.c: Added back some of the guts. Might not work but
diff --git a/filter/filter-datespec.c b/filter/filter-datespec.c
index fb5013ca4b..8feb6d8024 100644
--- a/filter/filter-datespec.c
+++ b/filter/filter-datespec.c
@@ -233,7 +233,7 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
xmlFree (fe->name);
fe->name = xmlGetProp (node, "name");
- n = node->childs;
+ n = node->children;
while (n) {
if (!strcmp (n->name, "datespec")) {
val = xmlGetProp (n, "type");
diff --git a/filter/filter-element.h b/filter/filter-element.h
index c05d9f63a6..75627686ae 100644
--- a/filter/filter-element.h
+++ b/filter/filter-element.h
@@ -26,8 +26,8 @@
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtkwidget.h>
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
+#include <libxml/parser.h>
+#include <libxml/xmlmemory.h>
#define FILTER_TYPE_ELEMENT (filter_element_get_type ())
#define FILTER_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FILTER_TYPE_ELEMENT, FilterElement))
diff --git a/filter/filter-file.c b/filter/filter-file.c
index 0ef87f646b..2efb5dd6fa 100644
--- a/filter/filter-file.c
+++ b/filter/filter-file.c
@@ -256,7 +256,7 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
xmlFree (file->type);
file->type = type;
- n = node->childs;
+ n = node->children;
if (!strcmp (n->name, type)) {
str = xmlNodeGetContent (n);
if (str)
@@ -265,7 +265,7 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
file->path = g_strdup ("");
d(printf (" '%s'\n", file->path));
- } else {
+ } else if (n->type == XML_ELEMENT_NODE) {
g_warning ("Unknown node type '%s' encountered decoding a %s\n", n->name, type);
}
diff --git a/filter/filter-filter.c b/filter/filter-filter.c
index 84ba7875d5..1b34425188 100644
--- a/filter/filter-filter.c
+++ b/filter/filter-filter.c
@@ -244,7 +244,7 @@ load_set (xmlNodePtr node, FilterFilter *ff, RuleContext *rc)
char *rulename;
FilterPart *part;
- work = node->childs;
+ work = node->children;
while (work) {
if (!strcmp (work->name, "part")) {
rulename = xmlGetProp (work, "name");
@@ -257,7 +257,7 @@ load_set (xmlNodePtr node, FilterFilter *ff, RuleContext *rc)
g_warning ("cannot find rule part '%s'\n", rulename);
}
xmlFree (rulename);
- } else {
+ } else if (work->type == XML_ELEMENT_NODE) {
g_warning ("Unknown xml node in part: %s", work->name);
}
work = work->next;
@@ -275,7 +275,7 @@ xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *rc)
if (result != 0)
return result;
- work = node->childs;
+ work = node->children;
while (work) {
if (!strcmp (work->name, "actionset")) {
load_set (work, ff, rc);
diff --git a/filter/filter-folder.c b/filter/filter-folder.c
index 13f6cf24d6..04dd09e859 100644
--- a/filter/filter-folder.c
+++ b/filter/filter-folder.c
@@ -202,7 +202,7 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
xmlFree (fe->name);
fe->name = xmlGetProp (node, "name");
- n = node->childs;
+ n = node->children;
while (n) {
if (!strcmp (n->name, "folder")) {
char *uri;
diff --git a/filter/filter-input.c b/filter/filter-input.c
index 4846aeefe5..ddbcfc8dc9 100644
--- a/filter/filter-input.c
+++ b/filter/filter-input.c
@@ -279,7 +279,7 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
fe->name = name;
xmlFree (fi->type);
fi->type = type;
- n = node->childs;
+ n = node->children;
while (n) {
if (!strcmp (n->name, type)) {
if (!(str = xmlNodeGetContent (n)))
@@ -288,7 +288,7 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
d(printf (" '%s'\n", str));
fi->values = g_list_append (fi->values, g_strdup (str));
xmlFree (str);
- } else {
+ } else if (n->type == XML_ELEMENT_NODE) {
g_warning ("Unknown node type '%s' encountered decoding a %s\n", n->name, type);
}
n = n->next;
diff --git a/filter/filter-option.c b/filter/filter-option.c
index 90b909d650..e5acdd7bd0 100644
--- a/filter/filter-option.c
+++ b/filter/filter-option.c
@@ -200,13 +200,13 @@ xml_create (FilterElement *fe, xmlNodePtr node)
/* parent implementation */
FILTER_ELEMENT_CLASS (parent_class)->xml_create (fe, node);
- n = node->childs;
+ n = node->children;
while (n) {
if (!strcmp (n->name, "option")) {
char *tmp, *value, *title = NULL, *code = NULL;
value = xmlGetProp (n, "value");
- work = n->childs;
+ work = n->children;
while (work) {
if (!strcmp (work->name, "title")) {
if (!title) {
@@ -232,7 +232,7 @@ xml_create (FilterElement *fe, xmlNodePtr node)
xmlFree (value);
g_free (title);
g_free (code);
- } else {
+ } else if (n->type == XML_ELEMENT_NODE) {
g_warning ("Unknown xml node within optionlist: %s\n", n->name);
}
n = n->next;
diff --git a/filter/filter-part.c b/filter/filter-part.c
index abe06b462c..1e8c74c3f4 100644
--- a/filter/filter-part.c
+++ b/filter/filter-part.c
@@ -175,7 +175,7 @@ filter_part_xml_create (FilterPart *ff, xmlNodePtr node)
if (str)
xmlFree (str);
- n = node->childs;
+ n = node->children;
while (n) {
if (!strcmp (n->name, "input")) {
type = xmlGetProp (n, "type");
@@ -203,7 +203,7 @@ filter_part_xml_create (FilterPart *ff, xmlNodePtr node)
if (str)
xmlFree (str);
}
- } else {
+ } else if (n->type == XML_ELEMENT_NODE) {
g_warning ("Unknown part element in xml: %s\n", n->name);
}
n = n->next;
@@ -245,7 +245,7 @@ filter_part_xml_decode (FilterPart *fp, xmlNodePtr node)
g_return_val_if_fail (fp != NULL, -1);
g_return_val_if_fail (node != NULL, -1);
- n = node->childs;
+ n = node->children;
while (n) {
if (!strcmp (n->name, "value")) {
name = xmlGetProp (n, "name");
diff --git a/filter/filter-rule.c b/filter/filter-rule.c
index de7a7de64c..66c4d5bf73 100644
--- a/filter/filter-rule.c
+++ b/filter/filter-rule.c
@@ -326,7 +326,7 @@ load_set (xmlNodePtr node, FilterRule *fr, RuleContext *f)
char *rulename;
FilterPart *part;
- work = node->childs;
+ work = node->children;
while (work) {
if (!strcmp (work->name, "part")) {
rulename = xmlGetProp (work, "name");
@@ -339,7 +339,7 @@ load_set (xmlNodePtr node, FilterRule *fr, RuleContext *f)
g_warning ("cannot find rule part '%s'\n", rulename);
}
xmlFree (rulename);
- } else {
+ } else if (work->type == XML_ELEMENT_NODE) {
g_warning ("Unknown xml node in part: %s", work->name);
}
work = work->next;
@@ -393,7 +393,7 @@ xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f)
fr->source = g_strdup ("incoming");
}
- work = node->childs;
+ work = node->children;
while (work) {
if (!strcmp (work->name, "partset")) {
load_set (work, fr, f);
diff --git a/filter/filter-source.c b/filter/filter-source.c
index ff63eb0920..83c2f4f831 100644
--- a/filter/filter-source.c
+++ b/filter/filter-source.c
@@ -191,7 +191,7 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
CamelURL *url;
char *uri;
- node = node->childs;
+ node = node->children;
if (node && node->name && !strcmp (node->name, "uri")) {
uri = xmlNodeGetContent (node);
url = camel_url_new (uri, NULL);
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);
diff --git a/filter/rule-context.h b/filter/rule-context.h
index 96bc06b00d..9a7fcae837 100644
--- a/filter/rule-context.h
+++ b/filter/rule-context.h
@@ -26,7 +26,7 @@
#include <glib.h>
#include <glib-object.h>
-#include <gnome-xml/parser.h>
+#include <libxml/parser.h>
#include "filter-part.h"
#include "filter-rule.h"
diff --git a/filter/rule-editor.c b/filter/rule-editor.c
index a31246bb75..b1f465eab3 100644
--- a/filter/rule-editor.c
+++ b/filter/rule-editor.c
@@ -291,7 +291,7 @@ rule_add (GtkWidget *widget, RuleEditor *re)
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (re->dialog)->vbox), rules, TRUE, TRUE, 0);
g_signal_connect (re->dialog, "response", GTK_SIGNAL_FUNC (add_editor_response), re);
- g_object_weak_ref (re->dialog, (GWeakNotify) editor_destroy, re);
+ g_object_weak_ref ((GObject *)re->dialog, (GWeakNotify) editor_destroy, re);
gtk_widget_set_sensitive (GTK_WIDGET (re), FALSE);
@@ -363,7 +363,7 @@ rule_edit (GtkWidget *widget, RuleEditor *re)
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (re->dialog)->vbox), rules, TRUE, TRUE, 0);
g_signal_connect (re->dialog, "clicked", GTK_SIGNAL_FUNC (edit_editor_response), re);
- g_object_weak_ref (re->dialog, (GWeakNotify) editor_destroy, re);
+ g_object_weak_ref ((GObject *)re->dialog, (GWeakNotify) editor_destroy, re);
gtk_widget_set_sensitive (GTK_WIDGET (re), FALSE);
diff --git a/filter/score-rule.c b/filter/score-rule.c
index 55c25d7a24..7ba443594c 100644
--- a/filter/score-rule.c
+++ b/filter/score-rule.c
@@ -139,7 +139,7 @@ xml_decode (FilterRule *fr, xmlNodePtr node, struct _RuleContext *f)
if (result != 0)
return result;
- value = node->childs;
+ value = node->children;
while (value) {
if (!strcmp (value->name, "score")) {
str = xmlGetProp (value, "value");
diff --git a/filter/vfolder-rule.c b/filter/vfolder-rule.c
index d634c0c6f8..ad31490188 100644
--- a/filter/vfolder-rule.c
+++ b/filter/vfolder-rule.c
@@ -285,10 +285,10 @@ xml_decode (FilterRule *fr, xmlNodePtr node, struct _RuleContext *f)
if (result != 0)
return result;
- set = node->childs;
+ set = node->children;
while (set) {
if (!strcmp (set->name, "sources")) {
- work = set->childs;
+ work = set->children;
while (work) {
if (!strcmp (work->name, "folder")) {
uri = xmlGetProp (work, "uri");