[evolution/gnome-2-32] Bug #639483 - Category list includes weather information (cherry picked from commit 1b25ab52f7709a0e



commit c0ce55c05aec70cfd9efc8b0a45d88f50fd79d0f
Author: Milan Crha <mcrha redhat com>
Date:   Fri Feb 18 15:13:06 2011 +0100

    Bug #639483 - Category list includes weather information
    (cherry picked from commit 1b25ab52f7709a0eae7493fb933fa62376ead288)

 e-util/e-util.c                                 |   34 ++++++++++++++++++++++-
 e-util/e-util.h                                 |    1 +
 modules/addressbook/e-book-shell-view-actions.c |    2 +-
 modules/addressbook/e-book-shell-view.c         |    2 +-
 modules/calendar/e-cal-shell-view-actions.c     |    2 +-
 modules/calendar/e-cal-shell-view.c             |    2 +-
 modules/calendar/e-memo-shell-view-actions.c    |    2 +-
 modules/calendar/e-memo-shell-view.c            |    2 +-
 modules/calendar/e-task-shell-view-actions.c    |    2 +-
 modules/calendar/e-task-shell-view.c            |    2 +-
 10 files changed, 42 insertions(+), 9 deletions(-)
---
diff --git a/e-util/e-util.c b/e-util/e-util.c
index c5360f9..b604c84 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -1419,7 +1419,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);
@@ -1432,6 +1437,33 @@ e_util_get_category_filter_options (void)
 }
 
 /**
+ * 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
  * @source_gconf_path: GConf path with sources to use in an #ESourceList
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 42749c1..51c29ff 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -140,6 +140,7 @@ gchar *		e_util_guess_mime_type		(const gchar *filename,
 
 GSList *	e_util_get_category_filter_options
 						(void);
+GList *		e_util_get_searchable_categories(void);
 
 void		e_util_set_source_combo_box_list
 						(GtkWidget *source_combo_box,
diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c
index 9008002..5502d5f 100644
--- a/modules/addressbook/e-book-shell-view-actions.c
+++ b/modules/addressbook/e-book-shell-view-actions.c
@@ -1122,7 +1122,7 @@ e_book_shell_view_update_search_filter (EBookShellView *book_shell_view)
 
 	/* Build the category actions. */
 
-	list = e_categories_get_list ();
+	list = e_util_get_searchable_categories ();
 	for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
 		const gchar *category_name = iter->data;
 		const gchar *filename;
diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c
index 2ac5d98..8b5d816 100644
--- a/modules/addressbook/e-book-shell-view.c
+++ b/modules/addressbook/e-book-shell-view.c
@@ -223,7 +223,7 @@ book_shell_view_execute_search (EShellView *shell_view)
 			GList *categories;
 			const gchar *category_name;
 
-			categories = e_categories_get_list ();
+			categories = e_util_get_searchable_categories ();
 			category_name = g_list_nth_data (categories, filter_id);
 			g_list_free (categories);
 
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 16b5ecf..74a46a0 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -1852,7 +1852,7 @@ e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view)
 
 	/* Build the category actions. */
 
-	list = e_categories_get_list ();
+	list = e_util_get_searchable_categories ();
 	for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
 		const gchar *category_name = iter->data;
 		const gchar *filename;
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c
index f9985f5..3776741 100644
--- a/modules/calendar/e-cal-shell-view.c
+++ b/modules/calendar/e-cal-shell-view.c
@@ -185,7 +185,7 @@ cal_shell_view_execute_search (EShellView *shell_view)
 			GList *categories;
 			const gchar *category_name;
 
-			categories = e_categories_get_list ();
+			categories = e_util_get_searchable_categories ();
 			category_name = g_list_nth_data (categories, value);
 			g_list_free (categories);
 
diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c
index 2ed1f9c..402ccb7 100644
--- a/modules/calendar/e-memo-shell-view-actions.c
+++ b/modules/calendar/e-memo-shell-view-actions.c
@@ -969,7 +969,7 @@ e_memo_shell_view_update_search_filter (EMemoShellView *memo_shell_view)
 
 	/* Build the category actions. */
 
-	list = e_categories_get_list ();
+	list = e_util_get_searchable_categories ();
 	for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
 		const gchar *category_name = iter->data;
 		const gchar *filename;
diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c
index 870d5ae..2194975 100644
--- a/modules/calendar/e-memo-shell-view.c
+++ b/modules/calendar/e-memo-shell-view.c
@@ -139,7 +139,7 @@ memo_shell_view_execute_search (EShellView *shell_view)
 			GList *categories;
 			const gchar *category_name;
 
-			categories = e_categories_get_list ();
+			categories = e_util_get_searchable_categories ();
 			category_name = g_list_nth_data (categories, value);
 			g_list_free (categories);
 
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index 66cf26a..2624aa4 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -1168,7 +1168,7 @@ e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view)
 
 	/* Build the category actions. */
 
-	list = e_categories_get_list ();
+	list = e_util_get_searchable_categories ();
 	for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
 		const gchar *category_name = iter->data;
 		const gchar *filename;
diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c
index 3bf0eb6..ed23307 100644
--- a/modules/calendar/e-task-shell-view.c
+++ b/modules/calendar/e-task-shell-view.c
@@ -245,7 +245,7 @@ task_shell_view_execute_search (EShellView *shell_view)
 			GList *categories;
 			const gchar *category_name;
 
-			categories = e_categories_get_list ();
+			categories = e_util_get_searchable_categories ();
 			category_name = g_list_nth_data (categories, value);
 			g_list_free (categories);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]