diff options
author | Milan Crha <mcrha@redhat.com> | 2008-12-10 19:05:01 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2008-12-10 19:05:01 +0800 |
commit | 65145381a69be1ac144c6e6dc7c2ab3fdb05d3b7 (patch) | |
tree | 6464b3307de194cd3326f3402a597cf09ccb4646 /e-util | |
parent | 8977778ec47a4c415884fe210e258716aa011879 (diff) | |
download | gsoc2013-evolution-65145381a69be1ac144c6e6dc7c2ab3fdb05d3b7.tar gsoc2013-evolution-65145381a69be1ac144c6e6dc7c2ab3fdb05d3b7.tar.gz gsoc2013-evolution-65145381a69be1ac144c6e6dc7c2ab3fdb05d3b7.tar.bz2 gsoc2013-evolution-65145381a69be1ac144c6e6dc7c2ab3fdb05d3b7.tar.lz gsoc2013-evolution-65145381a69be1ac144c6e6dc7c2ab3fdb05d3b7.tar.xz gsoc2013-evolution-65145381a69be1ac144c6e6dc7c2ab3fdb05d3b7.tar.zst gsoc2013-evolution-65145381a69be1ac144c6e6dc7c2ab3fdb05d3b7.zip |
** Fix for bug #563870
2008-12-10 Milan Crha <mcrha@redhat.com>
** Fix for bug #563870
* e-util/e-util-labels.h: (e_util_labels_get_filter_options):
* e-util/e-util-labels.c: (e_util_labels_get_filter_options):
New helper function to be used in FilterOption.
* filter/Makefile.am:
* filter/filter-label.h:
* filter/filter-label.c: Drop, not used anywhere.
* filter/filter-element.c:
* filter/rule-context.c: Remove dropped include and code.
* filter/filter-option.c: (get_dynamic_options), (xml_create), (get_widget):
Evaluate dynamic options even on create, to have them available for
saved searches even before the widget itself is shown.
* mail/vfoldertypes.xml:
* mail/filtertypes.xml:
* mail/searchtypes.xml: Use dynamic filter option.
* mail/message-list.c: Drop unused header include.
svn path=/trunk/; revision=36863
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/ChangeLog | 8 | ||||
-rw-r--r-- | e-util/e-util-labels.c | 37 | ||||
-rw-r--r-- | e-util/e-util-labels.h | 2 |
3 files changed, 47 insertions, 0 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 0fe2400300..b06be75c5b 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,11 @@ +2008-12-10 Milan Crha <mcrha@redhat.com> + + ** Part of fix for bug #563870 + + * e-util-labels.h: (e_util_labels_get_filter_options): + * e-util-labels.c: (e_util_labels_get_filter_options): + New helper function to be used in FilterOption. + 2008-12-09 Milan Crha <mcrha@redhat.com> ** Fix for bug #555663 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); +} diff --git a/e-util/e-util-labels.h b/e-util/e-util-labels.h index a9dd5613bc..26520ff226 100644 --- a/e-util/e-util-labels.h +++ b/e-util/e-util-labels.h @@ -52,4 +52,6 @@ const char *e_util_labels_get_name (GSList *labels, const char *tag); gboolean e_util_labels_get_color (GSList *labels, const char *tag, GdkColor *color); const char *e_util_labels_get_color_str (GSList *labels, const char *tag); +GSList * e_util_labels_get_filter_options (void); + #endif /* _E_UTIL_LABELS_H */ |