From 028af9687710c33e977a17039988030a0607d25c Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Sat, 30 Jun 2001 03:27:33 +0000 Subject: Added a search field to the query here. (e_select_names_init): Update the 2001-06-29 Christopher James Lahey * gui/component/select-names/e-select-names.c (update_query): Added a search field to the query here. (e_select_names_init): Update the query on a number of signals here. * gui/component/select-names/e-select-names.h: Added search_entry here. * gui/component/select-names/select-names.glade: Added the search entry here. Added some labels. Removed the update button. svn path=/trunk/; revision=10624 --- .../gui/component/select-names/e-select-names.c | 41 ++++- .../gui/component/select-names/e-select-names.h | 1 + .../gui/component/select-names/select-names.glade | 199 +++++++++++---------- 3 files changed, 136 insertions(+), 105 deletions(-) (limited to 'addressbook/gui/component') diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c index 7d36676bcd..581c5a635f 100644 --- a/addressbook/gui/component/select-names/e-select-names.c +++ b/addressbook/gui/component/select-names/e-select-names.c @@ -346,17 +346,36 @@ static void update_query (GtkWidget *button, ESelectNames *e_select_names) { char *category = ""; + char *search = ""; char *query; + char *q_array[4]; + int i; if (e_select_names->categories_entry) { category = gtk_entry_get_text (GTK_ENTRY (e_select_names->categories_entry)); } - if (category && *category) { - query = g_strdup_printf ("(and (contains \"email\" \"\") (is \"category\" \"%s\"))", category); - } else - query = g_strdup ("(contains \"email\" \"\")"); + if (e_select_names->search_entry) { + search = gtk_entry_get_text (GTK_ENTRY (e_select_names->search_entry)); + } + i = 0; + q_array[i++] = "(contains \"email\" \"\")"; + if (category && *category) + q_array[i++] = g_strdup_printf ("(is \"category\" \"%s\")", category); + if (search && *search) + q_array[i++] = g_strdup_printf ("(contains \"x-evolution-any-field\" \"%s\")", search); + q_array[i++] = NULL; + if (i > 2) { + char *temp = g_strjoinv (" ", q_array); + query = g_strdup_printf ("(and %s)", temp); + g_free (temp); + } else { + query = g_strdup (q_array[0]); + } gtk_object_set (GTK_OBJECT (e_select_names->model), "query", query, NULL); + for (i = 1; q_array[i]; i++) { + g_free (q_array[i]); + } g_free (query); } @@ -459,6 +478,15 @@ e_select_names_init (ESelectNames *e_select_names) e_select_names->categories_entry = GTK_COMBO (e_select_names->categories)->entry; } else e_select_names->categories_entry = NULL; + 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_entry) + gtk_signal_connect(GTK_OBJECT(e_select_names->categories_entry), "changed", + GTK_SIGNAL_FUNC(update_query), e_select_names); e_select_names->folders = g_hash_table_new(g_str_hash, g_str_equal); @@ -466,11 +494,6 @@ e_select_names_init (ESelectNames *e_select_names) gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table (e_select_names->table)), "double_click", GTK_SIGNAL_FUNC (add_address), e_select_names); - - widget = glade_xml_get_widget (gui, "button-update"); - if (widget && GTK_IS_BUTTON (widget)) - gtk_signal_connect (GTK_OBJECT (widget), "clicked", - GTK_SIGNAL_FUNC (update_query), e_select_names); } static void e_select_names_child_free(char *key, ESelectNamesChild *child, ESelectNames *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 dce20c6bd2..918dbc5794 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 *categories_entry; + GtkWidget *search_entry; EvolutionStorageListener *listener; GHashTable *folders; char *def; diff --git a/addressbook/gui/component/select-names/select-names.glade b/addressbook/gui/component/select-names/select-names.glade index 46804fc334..e15a70b4ad 100644 --- a/addressbook/gui/component/select-names/select-names.glade +++ b/addressbook/gui/component/select-names/select-names.glade @@ -78,7 +78,7 @@ GtkTable table-top - 6 + 7 2 False 6 @@ -89,84 +89,6 @@ True - - GtkHBox - hbox1 - False - 4 - - 0 - 1 - 2 - 3 - 0 - 0 - True - False - False - False - True - True - - - - GtkEntry - entry-find - False - True - True - True - True - 0 - - - 0 - True - True - - - - - GtkButton - button-find - False - True - - GTK_RELIEF_NORMAL - - 0 - False - False - - - - - - GtkAccelLabel - accellabel1 - - GTK_JUSTIFY_LEFT - False - 0 - 0 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - True - False - False - False - True - True - - - Custom table-source @@ -177,8 +99,8 @@ 0 1 - 5 - 6 + 6 + 7 0 0 True @@ -201,8 +123,8 @@ 1 2 - 5 - 6 + 6 + 7 0 0 True @@ -244,6 +166,7 @@ GtkOptionMenu optionmenu-folder True + True 0 @@ -263,17 +186,48 @@ - Custom - custom-categories - e_select_names_create_categories - 0 - 0 - Wed, 27 Jun 2001 01:47:01 GMT + GtkLabel + label3 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-find 0 1 - 3 - 4 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label2 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + custom-categories + + 0 + 1 + 2 + 3 0 0 False @@ -286,11 +240,16 @@ - GtkButton - button-update - True - - GTK_RELIEF_NORMAL + GtkLabel + label1 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-find 0 1 @@ -306,6 +265,54 @@ True + + + GtkEntry + entry-find + True + True + True + 0 + + + 0 + 1 + 5 + 6 + 0 + 0 + True + False + False + False + True + True + + + + + Custom + custom-categories + True + e_select_names_create_categories + 0 + 0 + Wed, 27 Jun 2001 01:47:01 GMT + + 0 + 1 + 3 + 4 + 0 + 0 + True + False + False + False + True + True + + -- cgit