diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2008-12-11 02:30:29 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-12-11 02:30:29 +0800 |
commit | d158af8cdfa6e4bf85c1e74769e8d61bc469494c (patch) | |
tree | ba55b970ae3a23e5ade4edbddc4eb8dcaf3033bd /e-util/e-util-labels.c | |
parent | dc0d0ee010319425b19d8d8d493f0bc489d5fd07 (diff) | |
download | gsoc2013-evolution-d158af8cdfa6e4bf85c1e74769e8d61bc469494c.tar.gz gsoc2013-evolution-d158af8cdfa6e4bf85c1e74769e8d61bc469494c.tar.zst gsoc2013-evolution-d158af8cdfa6e4bf85c1e74769e8d61bc469494c.zip |
Merge revisions 36811:36865 from trunk.
svn path=/branches/kill-bonobo/; revision=36867
Diffstat (limited to 'e-util/e-util-labels.c')
-rw-r--r-- | e-util/e-util-labels.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/e-util/e-util-labels.c b/e-util/e-util-labels.c index da32f233c5..88fff080b7 100644 --- a/e-util/e-util-labels.c +++ b/e-util/e-util-labels.c @@ -29,8 +29,10 @@ #include <camel/camel-utf8.h> +#include "e-util.h" #include "e-util-labels.h" #include "e-dialog-utils.h" +#include "filter/filter-option.h" /* Note, the first element of each EUtilLabel must NOT be translated */ EUtilLabel label_defaults[LABEL_DEFAULTS_NUM] = { @@ -543,3 +545,38 @@ e_util_labels_get_color_str (GSList *labels, const char *tag) return label->colour; } + +/** + * e_util_labels_get_filter_options: + * Returns list of newly allocated struct _filter_option-s, to be used in filters. + **/ +GSList * +e_util_labels_get_filter_options (void) +{ + GSList *known = e_util_labels_parse (NULL), *l; + GSList *res = NULL; + + for (l = known; l; l = l->next) { + EUtilLabel *label = l->data; + const char *tag; + struct _filter_option *fo; + + if (!label) + continue; + + tag = label->tag; + + if (tag && strncmp (tag, "$Label", 6) == 0) + tag += 6; + + fo = g_new0 (struct _filter_option, 1); + fo->title = e_str_without_underscores (label->name); + fo->value = g_strdup (tag); + + res = g_slist_prepend (res, fo); + } + + e_util_labels_free (known); + + return g_slist_reverse (res); +} |