aboutsummaryrefslogtreecommitdiffstats
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
parent20cff5d6ba88f6ccf22e3d4fe757fcf1310ea73b (diff)
downloadgsoc2013-evolution-99274a95701e007c22cbfc3f7d42a123b0464ea4.tar.gz
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
-rw-r--r--filter/ChangeLog14
-rw-r--r--filter/Makefile.am5
-rw-r--r--filter/filter-rule.h1
-rw-r--r--filter/rule-context.c26
4 files changed, 41 insertions, 5 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index b5931a5726..d7b721a9ce 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,17 @@
+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.
+
2003-08-05 Not Zed <NotZed@Ximian.com>
** See bug #42636.
diff --git a/filter/Makefile.am b/filter/Makefile.am
index 29fb45e32c..e3dbec3278 100644
--- a/filter/Makefile.am
+++ b/filter/Makefile.am
@@ -75,11 +75,12 @@ EXTRA_DIST = \
filter-marshal.list \
filtertypes.xml \
libfilter-i18n.h \
- vfoldertypes.xml
+ vfoldertypes.xml \
+ searchtypes.xml
# basic rules.
filterdir = $(privdatadir)
-filter_DATA = filtertypes.xml vfoldertypes.xml
+filter_DATA = filtertypes.xml vfoldertypes.xml searchtypes.xml
libfilter-i18n.h: filtertypes.xml vfoldertypes.xml
echo "/* Automatically generated. Do not edit. */" > $@; \
diff --git a/filter/filter-rule.h b/filter/filter-rule.h
index b75213d274..6f92fc01c4 100644
--- a/filter/filter-rule.h
+++ b/filter/filter-rule.h
@@ -59,6 +59,7 @@ struct _FilterRule {
char *source;
enum _filter_grouping_t grouping;
+ unsigned int system:1; /* this is a system rule, cannot be edited/deleted */
GList *parts;
};
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);
}