aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--filter/ChangeLog5
-rw-r--r--filter/filter-editor.c38
-rw-r--r--filter/filter-editor.h2
3 files changed, 21 insertions, 24 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 1d759230ef..ace9116829 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,5 +1,10 @@
2000-05-15 NotZed <NotZed@HelixCode.com>
+ * filter-editor.c (filter_editor_set_rule_files): filename based
+ interface.
+ (filter_editor_save_rules): Interface to save the options to a
+ filename.
+
* filter-xml.[ch]: Bunch of cleanup.
* filter-xml.c (filter_*_file): New interfaces to read/write files
diff --git a/filter/filter-editor.c b/filter/filter-editor.c
index 82e57afb4e..d65398872b 100644
--- a/filter/filter-editor.c
+++ b/filter/filter-editor.c
@@ -338,33 +338,23 @@ filter_editor_set_rules(FilterEditor *e, GList *rules, GList *systemoptions, GLi
filter_druid_set_rules(p->druid, useroptions, rules, NULL);
}
-#ifdef TESTING
-int main(int argc, char **argv)
+void
+filter_editor_set_rule_files(FilterEditor *e, const char *systemrules, const char *userrules)
{
GList *rules, *options, *options2;
xmlDocPtr doc, out, optionset, filteroptions;
- GString *s;
-
- gnome_init("Test", "0.0", argc, argv);
- gdk_rgb_init ();
- gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
- gtk_widget_set_default_visual (gdk_rgb_get_visual ());
-
- {
-
- GtkWidget *w = filter_editor_new();
-
- doc = xmlParseFile("filterdescription.xml");
- rules = filter_load_ruleset(doc);
- options = filter_load_optionset(doc, rules);
- options2 = options;
- out = xmlParseFile("saveoptions.xml");
- options = filter_load_optionset(out, rules);
- filter_editor_set_rules(w, rules, options2, options);
+ doc = xmlParseFile(systemrules);
+ rules = filter_load_ruleset(doc);
+ options2 = filter_load_optionset(doc, rules);
+ out = xmlParseFile(userrules);
+ options = filter_load_optionset(out, rules);
+
+ filter_editor_set_rules(e, rules, options2, options);
+}
- gtk_widget_show(w);
- gtk_main();
- }
+int
+filter_editor_save_rules(FilterEditor *e, const char *userrules)
+{
+ return filter_write_optionset_file(userrules, e->useroptions);
}
-#endif
diff --git a/filter/filter-editor.h b/filter/filter-editor.h
index 212654c4c9..66f7a81e11 100644
--- a/filter/filter-editor.h
+++ b/filter/filter-editor.h
@@ -52,5 +52,7 @@ guint filter_editor_get_type (void);
FilterEditor *filter_editor_new (void);
void filter_editor_set_rules(FilterEditor *e, GList *rules, GList *systemoptions, GList *useroptions);
+void filter_editor_set_rule_files(FilterEditor *e, const char *systemrules, const char *userrules);
+int filter_editor_save_rules(FilterEditor *e, const char *userrules);
#endif /* ! _FILTER_EDITOR_H */