diff options
author | Peter Williams <peterw@src.gnome.org> | 2000-08-18 01:42:21 +0800 |
---|---|---|
committer | Peter Williams <peterw@src.gnome.org> | 2000-08-18 01:42:21 +0800 |
commit | 7cf30eb79276d4f255c1d603e2c203bb054cf50e (patch) | |
tree | 687a003be1d0fbcc0ff06eccd900a04c38ad7aa0 /filter/filter-rule.c | |
parent | b3f1da4f99afadb51862fe732d66b72437224b99 (diff) | |
download | gsoc2013-evolution-7cf30eb79276d4f255c1d603e2c203bb054cf50e.tar.gz gsoc2013-evolution-7cf30eb79276d4f255c1d603e2c203bb054cf50e.tar.zst gsoc2013-evolution-7cf30eb79276d4f255c1d603e2c203bb054cf50e.zip |
Filtering on demand! booyeah!
svn path=/trunk/; revision=4864
Diffstat (limited to 'filter/filter-rule.c')
-rw-r--r-- | filter/filter-rule.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/filter/filter-rule.c b/filter/filter-rule.c index 9c47af6daf..58a2d76518 100644 --- a/filter/filter-rule.c +++ b/filter/filter-rule.c @@ -158,6 +158,19 @@ static xmlNodePtr xml_encode(FilterRule *fr) xmlSetProp(node, "grouping", "any"); break; } + + switch (fr->source) { + case FILTER_SOURCE_INCOMING: + xmlSetProp(node, "source", "incoming"); + break; + case FILTER_SOURCE_DEMAND: + xmlSetProp(node, "source", "ondemand"); + break; + case FILTER_SOURCE_OUTGOING: + xmlSetProp(node, "source", "outgoing"); + break; + } + if (fr->name) { work = xmlNewNode(NULL, "title"); xmlNodeSetContent(work, fr->name); @@ -209,16 +222,34 @@ static int xml_decode(FilterRule *fr, xmlNodePtr node, RuleContext *f) { xmlNodePtr work; char *grouping; + char *source; if (fr->name) { g_free(fr->name); fr->name = NULL; } + grouping = xmlGetProp(node, "grouping"); if (!strcmp(grouping, "any")) fr->grouping = FILTER_GROUP_ANY; else fr->grouping = FILTER_GROUP_ALL; + + /* FIXME: free source and grouping? */ + source = xmlGetProp (node, "source"); + if (!source) /*default to incoming*/ + fr->source = FILTER_SOURCE_INCOMING; + else if (!strcmp (source, "outgoing")) + fr->source = FILTER_SOURCE_OUTGOING; + else if (!strcmp (source, "ondemand")) + fr->source = FILTER_SOURCE_DEMAND; + else if (!strcmp (source, "incoming")) + fr->source = FILTER_SOURCE_INCOMING; + else { + g_warning ("Unknown filter source type \"%s\"", source); + fr->source = FILTER_SOURCE_INCOMING; + } + work = node->childs; while (work) { if (!strcmp(work->name, "partset")) { |