** 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
This commit is contained in:
@ -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.
|
||||
|
@ -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. */" > $@; \
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user