aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui/component')
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c42
-rw-r--r--addressbook/gui/component/select-names/e-select-names.h2
-rw-r--r--addressbook/gui/component/select-names/select-names.glade34
3 files changed, 59 insertions, 19 deletions
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;
@@ -346,6 +340,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)
{
GNOME_Evolution_Storage storage;
@@ -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 @@
<widget>
<class>GtkTable</class>
<name>table-top</name>
- <rows>5</rows>
+ <rows>6</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>6</row_spacing>
@@ -118,7 +118,7 @@
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
- <text>=</text>
+ <text></text>
<child>
<padding>0</padding>
<expand>True</expand>
@@ -177,8 +177,8 @@
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
+ <top_attach>5</top_attach>
+ <bottom_attach>6</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
@@ -201,8 +201,8 @@
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
+ <top_attach>5</top_attach>
+ <bottom_attach>6</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
@@ -284,6 +284,28 @@
<yfill>True</yfill>
</child>
</widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button-update</name>
+ <can_focus>True</can_focus>
+ <label>Update List</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>4</top_attach>
+ <bottom_attach>5</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
</widget>
</widget>
</widget>