aboutsummaryrefslogtreecommitdiffstats
path: root/filter/rule-context.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-09-16 06:43:15 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-09-16 06:43:15 +0800
commit99274a95701e007c22cbfc3f7d42a123b0464ea4 (patch)
tree8d6eed9b859b9fe5b4e034fb76735227a8887c3f /filter/rule-context.c
parent20cff5d6ba88f6ccf22e3d4fe757fcf1310ea73b (diff)
downloadgsoc2013-evolution-99274a95701e007c22cbfc3f7d42a123b0464ea4.tar
gsoc2013-evolution-99274a95701e007c22cbfc3f7d42a123b0464ea4.tar.gz
gsoc2013-evolution-99274a95701e007c22cbfc3f7d42a123b0464ea4.tar.bz2
gsoc2013-evolution-99274a95701e007c22cbfc3f7d42a123b0464ea4.tar.lz
gsoc2013-evolution-99274a95701e007c22cbfc3f7d42a123b0464ea4.tar.xz
gsoc2013-evolution-99274a95701e007c22cbfc3f7d42a123b0464ea4.tar.zst
gsoc2013-evolution-99274a95701e007c22cbfc3f7d42a123b0464ea4.zip
** See Natzilla task #47524
2003-09-15 Not Zed <NotZed@Ximian.com> ** See Natzilla task #47524 * filter-rule.h (FilterRule): add a system bit, for rules that shouldn't be edited/saved. * rule-context.c (load): check for ruleset maps in the system file, and if they exist, load in as system rules. (save): ignore system rules if they exist. * searchtypes.xml: Added a search-specific types folder. Also contains system searches that cannot be deleted. svn path=/trunk/; revision=22581
Diffstat (limited to 'filter/rule-context.c')
-rw-r--r--filter/rule-context.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/filter/rule-context.c b/filter/rule-context.c
index f76d9fae89..c822993d36 100644
--- a/filter/rule-context.c
+++ b/filter/rule-context.c
@@ -337,6 +337,24 @@ load(RuleContext *rc, const char *system, const char *user)
}
rule = rule->next;
}
+ } else if ((rule_map = g_hash_table_lookup(rc->rule_set_map, set->name))) {
+ d(printf("loading system rules ...\n"));
+ rule = set->children;
+ while (rule) {
+ d(printf("checking node: %s\n", rule->name));
+ if (!strcmp(rule->name, "rule")) {
+ FilterRule *part = FILTER_RULE(g_object_new(rule_map->type, NULL, NULL));
+
+ if (filter_rule_xml_decode(part, rule, rc) == 0) {
+ part->system = TRUE;
+ rule_map->append(rc, part);
+ } else {
+ g_object_unref(part);
+ g_warning("Cannot load filter part");
+ }
+ }
+ rule = rule->next;
+ }
}
set = set->next;
}
@@ -412,9 +430,11 @@ save(RuleContext *rc, const char *user)
xmlAddChild(root, rules);
rule = NULL;
while ((rule = map->next(rc, rule, NULL))) {
- d(printf("processing rule %s\n", rule->name));
- work = filter_rule_xml_encode(rule);
- xmlAddChild(rules, work);
+ if (!rule->system) {
+ d(printf("processing rule %s\n", rule->name));
+ work = filter_rule_xml_encode(rule);
+ xmlAddChild(rules, work);
+ }
}
l = g_list_next(l);
}