diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-06-30 11:27:33 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-06-30 11:27:33 +0800 |
commit | 028af9687710c33e977a17039988030a0607d25c (patch) | |
tree | acc99bb9164933741cf0e4ea122d32beec5cae99 /addressbook/gui/component/select-names/e-select-names.c | |
parent | a0619157c26553430ae47909af1ddee1557ab7be (diff) | |
download | gsoc2013-evolution-028af9687710c33e977a17039988030a0607d25c.tar gsoc2013-evolution-028af9687710c33e977a17039988030a0607d25c.tar.gz gsoc2013-evolution-028af9687710c33e977a17039988030a0607d25c.tar.bz2 gsoc2013-evolution-028af9687710c33e977a17039988030a0607d25c.tar.lz gsoc2013-evolution-028af9687710c33e977a17039988030a0607d25c.tar.xz gsoc2013-evolution-028af9687710c33e977a17039988030a0607d25c.tar.zst gsoc2013-evolution-028af9687710c33e977a17039988030a0607d25c.zip |
Added a search field to the query here. (e_select_names_init): Update the
2001-06-29 Christopher James Lahey <clahey@ximian.com>
* 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
Diffstat (limited to 'addressbook/gui/component/select-names/e-select-names.c')
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names.c | 41 |
1 files changed, 32 insertions, 9 deletions
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) |