From acb9fc2afb894e5e07ec6c2d01c34ba71b9030df Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Tue, 23 Apr 2002 21:28:57 +0000 Subject: Coded handling of the select_entry to search within the displayed 2002-04-23 Christopher James Lahey * gui/component/select-names/e-select-names.c, gui/component/select-names/e-select-names.h: Coded handling of the select_entry to search within the displayed contacts. * gui/component/select-names/select-names.glade: Updated this dialog to have an entry-select instead of an entry-find. svn path=/trunk/; revision=16570 --- addressbook/ChangeLog | 9 ++ .../gui/component/select-names/e-select-names.c | 55 ++++++++++- .../gui/component/select-names/e-select-names.h | 1 + .../gui/component/select-names/select-names.glade | 102 ++++++++------------- 4 files changed, 99 insertions(+), 68 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 03e0092ace..29e25d0b5e 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,12 @@ +2002-04-23 Christopher James Lahey + + * gui/component/select-names/e-select-names.c, + gui/component/select-names/e-select-names.h: Coded handling of the + select_entry to search within the displayed contacts. + + * gui/component/select-names/select-names.glade: Updated this + dialog to have an entry-select instead of an entry-find. + 2002-04-23 Christopher James Lahey * gui/component/select-names/select-names.glade: Updated this diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c index b3d3891595..2cb4409b18 100644 --- a/addressbook/gui/component/select-names/e-select-names.c +++ b/addressbook/gui/component/select-names/e-select-names.c @@ -510,6 +510,45 @@ categories_changed (GtkWidget *widget, gint value, ESelectNames *e_select_names) update_query (widget, e_select_names); } +static void +select_entry_changed (GtkWidget *widget, ESelectNames *e_select_names) +{ + if (e_select_names->select_entry) { + char *select_string = gtk_entry_get_text (GTK_ENTRY (e_select_names->select_entry)); + char *select_strcoll_string = g_utf8_collate_key (select_string, -1); + int count; + ETable *table; + int i; + + table = e_table_scrolled_get_table (e_select_names->table); + + count = e_table_model_row_count (e_select_names->without); + + for (i = 0; i < count; i++) { + int model_row = e_table_view_to_model_row (table, i); + char *row_strcoll_string = + g_utf8_collate_key (e_table_model_value_at (e_select_names->without, + E_CARD_SIMPLE_FIELD_NAME_OR_ORG, + model_row), + -1); + if (strcmp (select_strcoll_string, row_strcoll_string) <= 0) { + g_free (row_strcoll_string); + break; + } + g_free (row_strcoll_string); + } + g_free (select_strcoll_string); + if (i == count) + i --; + + if (count > 0) { + i = e_table_view_to_model_row (table, i); + e_table_set_cursor_row (table, i); + } + } +} + + static void hookup_listener (ESelectNames *e_select_names, GNOME_Evolution_Storage storage, @@ -707,18 +746,26 @@ e_select_names_init (ESelectNames *e_select_names) e_select_names->categories = glade_xml_get_widget (gui, "custom-categories"); if (e_select_names->categories && !E_IS_CATEGORIES_MASTER_LIST_OPTION_MENU (e_select_names->categories)) e_select_names->categories = NULL; + if (e_select_names->categories) + gtk_signal_connect(GTK_OBJECT(e_select_names->categories), "changed", + GTK_SIGNAL_FUNC(categories_changed), e_select_names); + e_select_names->search_entry = glade_xml_get_widget (gui, "entry-find"); if (e_select_names->search_entry && !GTK_IS_ENTRY (e_select_names->search_entry)) e_select_names->search_entry = NULL; if (e_select_names->search_entry) gtk_signal_connect(GTK_OBJECT(e_select_names->search_entry), "activate", GTK_SIGNAL_FUNC(update_query), e_select_names); - if (e_select_names->categories) - gtk_signal_connect(GTK_OBJECT(e_select_names->categories), "changed", - GTK_SIGNAL_FUNC(categories_changed), e_select_names); + + e_select_names->select_entry = glade_xml_get_widget (gui, "entry-select"); + if (e_select_names->select_entry && !GTK_IS_ENTRY (e_select_names->select_entry)) + e_select_names->select_entry = NULL; + if (e_select_names->select_entry) + gtk_signal_connect(GTK_OBJECT(e_select_names->select_entry), "changed", + GTK_SIGNAL_FUNC(select_entry_changed), e_select_names); button = glade_xml_get_widget (gui, "button-find"); - if (button) + if (button && GTK_IS_BUTTON (button)) gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(update_query), e_select_names); diff --git a/addressbook/gui/component/select-names/e-select-names.h b/addressbook/gui/component/select-names/e-select-names.h index a1a1daf7e6..90b0229766 100644 --- a/addressbook/gui/component/select-names/e-select-names.h +++ b/addressbook/gui/component/select-names/e-select-names.h @@ -72,6 +72,7 @@ struct _ESelectNames EAddressbookModel *model; GtkWidget *categories; GtkWidget *search_entry; + GtkWidget *select_entry; GtkWidget *status_message; EvolutionStorageListener *local_listener; EvolutionStorageListener *other_contacts_listener; diff --git a/addressbook/gui/component/select-names/select-names.glade b/addressbook/gui/component/select-names/select-names.glade index 367c5b21bd..2a6f1960c9 100644 --- a/addressbook/gui/component/select-names/select-names.glade +++ b/addressbook/gui/component/select-names/select-names.glade @@ -265,7 +265,7 @@ GtkTable table4 - 3 + 2 2 False 3 @@ -276,18 +276,45 @@ True + + GtkLabel + label32 + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + GtkAlignment alignment4 7.45058e-09 0.5 - 0 + 1 1 0 1 1 - 3 + 2 0 0 False @@ -305,44 +332,18 @@ 3 - GtkHBox - hbox5 - False - 3 + GtkEntry + entry-select + True + True + True + 0 + 0 False False - - - GtkEntry - entry-find - True - True - True - 0 - - - 0 - True - True - - - - - GtkButton - button16 - 50 - True - - GTK_RELIEF_NORMAL - - 0 - False - True - - @@ -382,7 +383,7 @@ 1 2 1 - 3 + 2 0 0 True @@ -419,33 +420,6 @@ - - - GtkLabel - label32 - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - -- cgit v1.2.3