diff options
author | Christopher James Lahey <clahey@ximian.com> | 2002-01-11 15:24:08 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2002-01-11 15:24:08 +0800 |
commit | 5027f2008badcb8d8056190dac1403335754f202 (patch) | |
tree | 768d6583b3a3b86e104e59a828eb442907d26680 /addressbook/gui/component | |
parent | d17adcedf443dde2018070d868e53e75790d5936 (diff) | |
download | gsoc2013-evolution-5027f2008badcb8d8056190dac1403335754f202.tar gsoc2013-evolution-5027f2008badcb8d8056190dac1403335754f202.tar.gz gsoc2013-evolution-5027f2008badcb8d8056190dac1403335754f202.tar.bz2 gsoc2013-evolution-5027f2008badcb8d8056190dac1403335754f202.tar.lz gsoc2013-evolution-5027f2008badcb8d8056190dac1403335754f202.tar.xz gsoc2013-evolution-5027f2008badcb8d8056190dac1403335754f202.tar.zst gsoc2013-evolution-5027f2008badcb8d8056190dac1403335754f202.zip |
Handle setting the search bar to "Advanced..." when the alphabet buttons
2002-01-11 Christopher James Lahey <clahey@ximian.com>
* gui/component/addressbook.c (alphabet_state_changed): Handle
setting the search bar to "Advanced..." when the alphabet buttons
are pushed and back when they're cleared. Fixes Ximian bug
#12904.
(addressbook_menu_activated): When the user calls Search->clear,
set the search to ESB_ANY and "", don't just set the text. This
is especially useful when it's set to ESB_ADVANCED.
* gui/widgets/e-addressbook-view.c,
gui/widgets/e-addressbook-view.h (alphabet_state_change): Added
this signal which gets emitted when the alphabet buttons are
pushed.
(command_state_change): Removed the ref pair here. It's not
necessary. gtk_signal_emit refs the object itself.
svn path=/trunk/; revision=15295
Diffstat (limited to 'addressbook/gui/component')
-rw-r--r-- | addressbook/gui/component/addressbook.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index 619a89cdd5..38d44727ed 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -66,6 +66,7 @@ typedef struct { BonoboPropertyBag *properties; char *uri; char *passwd; + gboolean ignore_search_changes; } AddressbookView; static void addressbook_view_ref (AddressbookView *); @@ -814,23 +815,28 @@ static ESearchBarItem addressbook_search_option_items[] = { }; static void +alphabet_state_changed (EAddressbookView *eav, gunichar letter, AddressbookView *view) +{ + view->ignore_search_changes = TRUE; + if (letter == 0) { + e_search_bar_set_item_id (view->search, ESB_ANY); + e_search_bar_set_text (view->search, ""); + } else { + e_search_bar_set_item_id (view->search, ESB_ADVANCED); + } + view->ignore_search_changes = FALSE; +} + +static void addressbook_menu_activated (ESearchBar *esb, int id, AddressbookView *view) { switch (id) { case E_FILTERBAR_RESET_ID: /* e_addressbook_view_show_all(view->view); */ - - /* Fix option menu if we are using "Category is" */ - if (e_search_bar_get_item_id (esb) == ESB_CATEGORY) { - - e_search_bar_set_subitem_id (esb, G_MAXINT); - - } else { - - e_search_bar_set_text (esb, ""); - - } - + view->ignore_search_changes = TRUE; + e_search_bar_set_item_id (view->search, ESB_ANY); + view->ignore_search_changes = FALSE; + e_search_bar_set_text (esb, ""); break; } } @@ -843,6 +849,10 @@ addressbook_query_changed (ESearchBar *esb, AddressbookView *view) const char *category_name; int search_type, subid; + if (view->ignore_search_changes) { + return; + } + gtk_object_get(GTK_OBJECT(esb), "text", &search_word, "item_id", &search_type, @@ -1070,6 +1080,7 @@ addressbook_factory_new_control (void) view = g_new0 (AddressbookView, 1); view->refs = 1; + view->ignore_search_changes = FALSE; view->vbox = gtk_vbox_new (FALSE, 0); @@ -1129,6 +1140,11 @@ addressbook_factory_new_control (void) GTK_SIGNAL_FUNC(update_command_state), view); + gtk_signal_connect (GTK_OBJECT (view->view), + "alphabet_state_change", + GTK_SIGNAL_FUNC(alphabet_state_changed), + view); + view->uri = NULL; gtk_signal_connect (GTK_OBJECT (view->control), "activate", |