From 9086989f207a11e7edb50177662539bd75da0370 Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Tue, 14 Aug 2001 15:48:39 +0000 Subject: Add "Any Category" option for category searches. 2001-08-14 Jon Trowbridge * 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 * e-search-bar.c (activate_by_subitems): Oops... initial suboption_choice should be subitems[0].id, not 0. svn path=/trunk/; revision=12013 --- addressbook/gui/component/addressbook.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'addressbook/gui/component') 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; isearch = E_SEARCH_BAR(e_search_bar_new(addressbook_search_menu_items, -- cgit v1.2.3