aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-06-30 11:27:33 +0800
committerChris Lahey <clahey@src.gnome.org>2001-06-30 11:27:33 +0800
commit028af9687710c33e977a17039988030a0607d25c (patch)
treeacc99bb9164933741cf0e4ea122d32beec5cae99 /addressbook/gui/component
parenta0619157c26553430ae47909af1ddee1557ab7be (diff)
downloadgsoc2013-evolution-028af9687710c33e977a17039988030a0607d25c.tar.gz
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')
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c41
-rw-r--r--addressbook/gui/component/select-names/e-select-names.h1
-rw-r--r--addressbook/gui/component/select-names/select-names.glade199
3 files changed, 136 insertions, 105 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)
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 @@
<widget>
<class>GtkTable</class>
<name>table-top</name>
- <rows>6</rows>
+ <rows>7</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>6</row_spacing>
@@ -90,84 +90,6 @@
</child>
<widget>
- <class>GtkHBox</class>
- <name>hbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>4</spacing>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-find</name>
- <visible>False</visible>
- <can_focus>True</can_focus>
- <has_focus>True</has_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-find</name>
- <visible>False</visible>
- <can_focus>True</can_focus>
- <label>Find...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkAccelLabel</class>
- <name>accellabel1</name>
- <label>Select name from:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
<class>Custom</class>
<name>table-source</name>
<creation_function>e_addressbook_create_ebook_table</creation_function>
@@ -177,8 +99,8 @@
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
+ <top_attach>6</top_attach>
+ <bottom_attach>7</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
@@ -201,8 +123,8 @@
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
+ <top_attach>6</top_attach>
+ <bottom_attach>7</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
@@ -244,6 +166,7 @@
<class>GtkOptionMenu</class>
<name>optionmenu-folder</name>
<can_focus>True</can_focus>
+ <has_focus>True</has_focus>
<items></items>
<initial_choice>0</initial_choice>
<child>
@@ -263,17 +186,48 @@
</widget>
<widget>
- <class>Custom</class>
- <name>custom-categories</name>
- <creation_function>e_select_names_create_categories</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Wed, 27 Jun 2001 01:47:01 GMT</last_modification_time>
+ <class>GtkLabel</class>
+ <name>label3</name>
+ <label>Select name from _folder:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-find</focus_target>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label2</name>
+ <label>_Category:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>custom-categories</focus_target>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@@ -286,11 +240,16 @@
</widget>
<widget>
- <class>GtkButton</class>
- <name>button-update</name>
- <can_focus>True</can_focus>
- <label>Update List</label>
- <relief>GTK_RELIEF_NORMAL</relief>
+ <class>GtkLabel</class>
+ <name>label1</name>
+ <label>_Search</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-find</focus_target>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
@@ -306,6 +265,54 @@
<yfill>True</yfill>
</child>
</widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>entry-find</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>5</top_attach>
+ <bottom_attach>6</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>Custom</class>
+ <name>custom-categories</name>
+ <can_focus>True</can_focus>
+ <creation_function>e_select_names_create_categories</creation_function>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Wed, 27 Jun 2001 01:47:01 GMT</last_modification_time>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>3</top_attach>
+ <bottom_attach>4</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
</widget>
</widget>
</widget>