diff options
-rw-r--r-- | widgets/misc/ChangeLog | 5 | ||||
-rw-r--r-- | widgets/misc/e-search-bar.c | 33 | ||||
-rw-r--r-- | widgets/misc/e-search-bar.h | 2 |
3 files changed, 40 insertions, 0 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 835874d6e8..b2f370fe3d 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,8 @@ +2001-08-23 Federico Mena Quintero <federico@ximian.com> + + * e-search-bar.c (e_search_bar_set_ids): New function to set the + item_id and the subitem_id simultaneously. + 2001-08-16 Damon Chaplin <damon@ximian.com> * e-dateedit.c: added e_date_edit_get/set_make_time_insensitive() diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c index 9f6d46a2bb..f96d8a8752 100644 --- a/widgets/misc/e-search-bar.c +++ b/widgets/misc/e-search-bar.c @@ -875,6 +875,39 @@ e_search_bar_get_subitem_id (ESearchBar *search_bar) } /** + * e_search_bar_set_ids: + * @search_bar: A search bar. + * @item_id: Identifier of the item to set. + * @subitem_id: Identifier of the subitem to set. + * + * Sets the item and subitem ids for a search bar. This is intended to switch + * to an item that has subitems. + **/ +void +e_search_bar_set_ids (ESearchBar *search_bar, int item_id, int subitem_id) +{ + int item_row; + GtkWidget *item_widget; + ESearchBarSubitem *subitems; + + g_return_if_fail (search_bar != NULL); + g_return_if_fail (E_IS_SEARCH_BAR (search_bar)); + + item_row = find_id (search_bar->option_menu, item_id, "EsbChoiceId", &item_widget); + g_return_if_fail (item_row != -1); + g_assert (item_widget != NULL); + + subitems = gtk_object_get_data (GTK_OBJECT (item_widget), "EsbChoiceSubitems"); + g_return_if_fail (subitems != NULL); + + search_bar->item_id = item_id; + gtk_option_menu_set_history (GTK_OPTION_MENU (search_bar->option), item_row); + + activate_by_subitems (search_bar, item_id, subitems); + e_search_bar_set_subitem_id (search_bar, subitem_id); +} + +/** * e_search_bar_set_text: * @search_bar: A search bar. * @text: Text to set in the search bar's entry line. diff --git a/widgets/misc/e-search-bar.h b/widgets/misc/e-search-bar.h index 3842fa8409..ba0dee3b62 100644 --- a/widgets/misc/e-search-bar.h +++ b/widgets/misc/e-search-bar.h @@ -119,6 +119,8 @@ int e_search_bar_get_item_id (ESearchBar *search_bar); void e_search_bar_set_subitem_id (ESearchBar *search_bar, int id); int e_search_bar_get_subitem_id (ESearchBar *search_bar); +void e_search_bar_set_ids (ESearchBar *search_bar, int item_id, int subitem_id); + void e_search_bar_set_text (ESearchBar *search_bar, const char *text); char *e_search_bar_get_text (ESearchBar *search_bar); |