diff options
-rw-r--r-- | addressbook/ChangeLog | 7 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.c | 27 | ||||
-rw-r--r-- | widgets/misc/ChangeLog | 5 | ||||
-rw-r--r-- | widgets/misc/e-search-bar.c | 2 |
4 files changed, 32 insertions, 9 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 937d1fbd2c..1ac471f57d 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,10 @@ +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 Dan Winship <danw@ximian.com> * backend/pas/pas-backend-ldap.c: Fix up to match the 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, diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 52265446ea..51a95cc647 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,8 @@ +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. + 2001-08-10 Jeffrey Stedfast <fejj@ximian.com> * e-search-bar.c (impl_destroy): Oops, we didn't need to unref all diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c index ace1983371..ddaf7ed66a 100644 --- a/widgets/misc/e-search-bar.c +++ b/widgets/misc/e-search-bar.c @@ -185,7 +185,7 @@ activate_by_subitems (ESearchBar *esb, gint item_id, ESearchBarSubitem *subitems gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->suboption); - esb->suboption_choice = 0; + esb->suboption_choice = subitems[0].id; } if (esb->activate_button) { |