From e464ef303415e68809d28d4edb38c6e2baa325a3 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Sat, 30 Jun 2001 02:40:27 +0000 Subject: Change the query when the "Update List" button is pushed. 2001-06-29 Christopher James Lahey * gui/component/select-names/e-select-names.c (update_query): Change the query when the "Update List" button is pushed. * gui/component/select-names/e-select-names.h: Removed currently_selected field. Added categories_entry field. * gui/component/select-names/select-names.glade: Added "Update List" button. svn path=/trunk/; revision=10622 --- addressbook/ChangeLog | 11 ++++++ .../gui/component/select-names/e-select-names.c | 42 +++++++++++++++------- .../gui/component/select-names/e-select-names.h | 2 +- .../gui/component/select-names/select-names.glade | 34 ++++++++++++++---- 4 files changed, 70 insertions(+), 19 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 54ee8d1736..94cde4eefb 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,14 @@ +2001-06-29 Christopher James Lahey + + * gui/component/select-names/e-select-names.c (update_query): + Change the query when the "Update List" button is pushed. + + * gui/component/select-names/e-select-names.h: Removed + currently_selected field. Added categories_entry field. + + * gui/component/select-names/select-names.glade: Added "Update + List" button. + 2001-06-29 Chris Toshok * gui/widgets/Makefile.am (INCLUDES): add EVOLUTION_IMAGESDIR diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c index 740a65dd5d..56f5cd0817 100644 --- a/addressbook/gui/component/select-names/e-select-names.c +++ b/addressbook/gui/component/select-names/e-select-names.c @@ -210,12 +210,6 @@ e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int n return table; } -static void -set_current_selection(ETableScrolled *table, int row, ESelectNames *names) -{ - names->currently_selected = row; -} - typedef struct { char *description; char *display_name; @@ -345,6 +339,24 @@ removed_folder (EvolutionStorageListener *storage_listener, } } +static void +update_query (GtkWidget *button, ESelectNames *e_select_names) +{ + char *category = ""; + char *query; + 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\" \"\")"); + gtk_object_set (GTK_OBJECT (e_select_names->model), + "query", query, + NULL); + g_free (query); +} + static void e_select_names_hookup_shell_listener (ESelectNames *e_select_names) { @@ -438,18 +450,24 @@ e_select_names_init (ESelectNames *e_select_names) e_select_names->adapter = gtk_object_get_data(GTK_OBJECT(e_select_names->table), "adapter"); e_select_names->categories = glade_xml_get_widget (gui, "custom-categories"); - - e_select_names->currently_selected = -1; + if (e_select_names->categories && !GTK_IS_COMBO (e_select_names->categories)) + e_select_names->categories = NULL; + if (e_select_names->categories) { + e_select_names->categories_entry = GTK_COMBO (e_select_names->categories)->entry; + } else + e_select_names->categories_entry = NULL; e_select_names->folders = g_hash_table_new(g_str_hash, g_str_equal); e_select_names_hookup_shell_listener (e_select_names); - gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(e_select_names->table)), "cursor_activated", - GTK_SIGNAL_FUNC(set_current_selection), 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); - 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 14dcad325b..dce20c6bd2 100644 --- a/addressbook/gui/component/select-names/e-select-names.h +++ b/addressbook/gui/component/select-names/e-select-names.h @@ -71,7 +71,7 @@ struct _ESelectNames ETableModel *adapter; EAddressbookModel *model; GtkWidget *categories; - int currently_selected; + GtkWidget *categories_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 4c793eaeef..6f36bb4f67 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 - 5 + 6 2 False 6 @@ -118,7 +118,7 @@ True True 0 - = + 0 True @@ -177,8 +177,8 @@ 0 1 - 4 - 5 + 5 + 6 0 0 True @@ -201,8 +201,8 @@ 1 2 - 4 - 5 + 5 + 6 0 0 True @@ -284,6 +284,28 @@ True + + + GtkButton + button-update + True + + GTK_RELIEF_NORMAL + + 0 + 1 + 4 + 5 + 0 + 0 + False + False + False + False + True + True + + -- cgit