From 1b25ab52f7709a0eae7493fb933fa62376ead288 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 18 Feb 2011 15:13:06 +0100 Subject: Bug #639483 - Category list includes weather information --- e-util/e-util.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index 88fcfaebfb..8f91558823 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -1457,7 +1457,12 @@ e_util_get_category_filter_options (void) clist = e_categories_get_list (); for (l = clist; l; l = l->next) { const gchar *cname = l->data; - struct _filter_option *fo = g_new0 (struct _filter_option, 1); + struct _filter_option *fo; + + if (!e_categories_is_searchable (cname)) + continue; + + fo = g_new0 (struct _filter_option, 1); fo->title = g_strdup (cname); fo->value = g_strdup (cname); @@ -1469,6 +1474,33 @@ e_util_get_category_filter_options (void) return g_slist_reverse (res); } +/** + * e_util_get_searchable_categories: + * + * Returns list of searchable categories only. The list should + * be freed with g_list_free() when done with it, but the items + * are internal strings, names of categories, which should not + * be touched in other than read-only way, in other words the same + * restrictions as for e_categories_get_list() applies here too. + **/ +GList * +e_util_get_searchable_categories (void) +{ + GList *res = NULL, *all_categories, *l; + + all_categories = e_categories_get_list (); + for (l = all_categories; l; l = l->next) { + const gchar *cname = l->data; + + if (e_categories_is_searchable (cname)) + res = g_list_prepend (res, (gpointer) cname); + } + + g_list_free (all_categories); + + return g_list_reverse (res); +} + /** * e_util_set_source_combo_box_list: * @source_combo_box: an #ESourceComboBox -- cgit v1.2.3