aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-08-14 23:48:39 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-08-14 23:48:39 +0800
commit9086989f207a11e7edb50177662539bd75da0370 (patch)
tree6c389c0e96ff99b65f6d6ddaad8540c7af72fc09 /addressbook/gui
parent866a960fd9dba9c3c7162c61b1e12feca6d12668 (diff)
downloadgsoc2013-evolution-9086989f207a11e7edb50177662539bd75da0370.tar
gsoc2013-evolution-9086989f207a11e7edb50177662539bd75da0370.tar.gz
gsoc2013-evolution-9086989f207a11e7edb50177662539bd75da0370.tar.bz2
gsoc2013-evolution-9086989f207a11e7edb50177662539bd75da0370.tar.lz
gsoc2013-evolution-9086989f207a11e7edb50177662539bd75da0370.tar.xz
gsoc2013-evolution-9086989f207a11e7edb50177662539bd75da0370.tar.zst
gsoc2013-evolution-9086989f207a11e7edb50177662539bd75da0370.zip
Add "Any Category" option for category searches.
2001-08-14 Jon Trowbridge <trow@ximian.com> * gui/component/addressbook.c (addressbook_factory_new_control): Add "Any Category" option for category searches. (addressbook_query_changed): Do the right thing on an "Any Category" search. 2001-08-14 Jon Trowbridge <trow@ximian.com> * e-search-bar.c (activate_by_subitems): Oops... initial suboption_choice should be subitems[0].id, not 0. svn path=/trunk/; revision=12013
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/addressbook.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index d523c1fc4a..790205d953 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -686,9 +686,17 @@ addressbook_query_changed (ESearchBar *esb, AddressbookView *view)
break;
case ESB_CATEGORY:
subopt = e_search_bar_get_suboption_choice (esb);
- master_list = get_master_list ();
- category_name = e_categories_master_list_nth (master_list, subopt);
- search_query = g_strdup_printf ("(contains \"category\" \"%s\")", category_name);
+ g_message ("subopt: %d", subopt);
+ if (subopt >= 0) {
+ if (subopt == G_MAXINT) {
+ /* match everything */
+ search_query = g_strdup ("(contains \"full_name\" \"\")");
+ } else {
+ master_list = get_master_list ();
+ category_name = e_categories_master_list_nth (master_list, subopt);
+ search_query = g_strdup_printf ("(contains \"category\" \"%s\")", category_name);
+ }
+ }
break;
default:
search_query = g_strdup ("(contains \"full_name\" \"\")");
@@ -796,14 +804,17 @@ addressbook_factory_new_control (void)
master_list = get_master_list ();
N = e_categories_master_list_count (master_list);
- addressbook_search_option_items[ESB_CATEGORY].subitems = subitems = g_new (ESearchBarSubitem, N+1);
+ addressbook_search_option_items[ESB_CATEGORY].subitems = subitems = g_new (ESearchBarSubitem, N+2);
+
+ subitems[0].id = G_MAXINT;
+ subitems[0].text = g_strdup (_("Any Category"));
for (i=0; i<N; ++i) {
- subitems[i].id = i;
- subitems[i].text = (char *) e_categories_master_list_nth (master_list, i);
+ subitems[i+1].id = i;
+ subitems[i+1].text = (char *) e_categories_master_list_nth (master_list, i);
}
- subitems[N].id = -1;
- subitems[N].text = NULL;
+ subitems[N+1].id = -1;
+ subitems[N+1].text = NULL;
}
view->search = E_SEARCH_BAR(e_search_bar_new(addressbook_search_menu_items,