aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-04-24 05:28:57 +0800
committerChris Lahey <clahey@src.gnome.org>2002-04-24 05:28:57 +0800
commitacb9fc2afb894e5e07ec6c2d01c34ba71b9030df (patch)
tree4f9dbb57dcba5d8023ea62cc9b28cc73b6285613 /addressbook/gui
parent34c740efa32184d79541302936e4cd7b46ff699b (diff)
downloadgsoc2013-evolution-acb9fc2afb894e5e07ec6c2d01c34ba71b9030df.tar.gz
gsoc2013-evolution-acb9fc2afb894e5e07ec6c2d01c34ba71b9030df.tar.zst
gsoc2013-evolution-acb9fc2afb894e5e07ec6c2d01c34ba71b9030df.zip
Coded handling of the select_entry to search within the displayed
2002-04-23 Christopher James Lahey <clahey@ximian.com> * gui/component/select-names/e-select-names.c, gui/component/select-names/e-select-names.h: Coded handling of the select_entry to search within the displayed contacts. * gui/component/select-names/select-names.glade: Updated this dialog to have an entry-select instead of an entry-find. svn path=/trunk/; revision=16570
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c55
-rw-r--r--addressbook/gui/component/select-names/e-select-names.h1
-rw-r--r--addressbook/gui/component/select-names/select-names.glade102
3 files changed, 90 insertions, 68 deletions
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
index b3d3891595..2cb4409b18 100644
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ b/addressbook/gui/component/select-names/e-select-names.c
@@ -511,6 +511,45 @@ categories_changed (GtkWidget *widget, gint value, ESelectNames *e_select_names)
}
static void
+select_entry_changed (GtkWidget *widget, ESelectNames *e_select_names)
+{
+ if (e_select_names->select_entry) {
+ char *select_string = gtk_entry_get_text (GTK_ENTRY (e_select_names->select_entry));
+ char *select_strcoll_string = g_utf8_collate_key (select_string, -1);
+ int count;
+ ETable *table;
+ int i;
+
+ table = e_table_scrolled_get_table (e_select_names->table);
+
+ count = e_table_model_row_count (e_select_names->without);
+
+ for (i = 0; i < count; i++) {
+ int model_row = e_table_view_to_model_row (table, i);
+ char *row_strcoll_string =
+ g_utf8_collate_key (e_table_model_value_at (e_select_names->without,
+ E_CARD_SIMPLE_FIELD_NAME_OR_ORG,
+ model_row),
+ -1);
+ if (strcmp (select_strcoll_string, row_strcoll_string) <= 0) {
+ g_free (row_strcoll_string);
+ break;
+ }
+ g_free (row_strcoll_string);
+ }
+ g_free (select_strcoll_string);
+ if (i == count)
+ i --;
+
+ if (count > 0) {
+ i = e_table_view_to_model_row (table, i);
+ e_table_set_cursor_row (table, i);
+ }
+ }
+}
+
+
+static void
hookup_listener (ESelectNames *e_select_names,
GNOME_Evolution_Storage storage,
EvolutionStorageListener *listener,
@@ -707,18 +746,26 @@ e_select_names_init (ESelectNames *e_select_names)
e_select_names->categories = glade_xml_get_widget (gui, "custom-categories");
if (e_select_names->categories && !E_IS_CATEGORIES_MASTER_LIST_OPTION_MENU (e_select_names->categories))
e_select_names->categories = NULL;
+ if (e_select_names->categories)
+ gtk_signal_connect(GTK_OBJECT(e_select_names->categories), "changed",
+ GTK_SIGNAL_FUNC(categories_changed), e_select_names);
+
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)
- gtk_signal_connect(GTK_OBJECT(e_select_names->categories), "changed",
- GTK_SIGNAL_FUNC(categories_changed), e_select_names);
+
+ e_select_names->select_entry = glade_xml_get_widget (gui, "entry-select");
+ if (e_select_names->select_entry && !GTK_IS_ENTRY (e_select_names->select_entry))
+ e_select_names->select_entry = NULL;
+ if (e_select_names->select_entry)
+ gtk_signal_connect(GTK_OBJECT(e_select_names->select_entry), "changed",
+ GTK_SIGNAL_FUNC(select_entry_changed), e_select_names);
button = glade_xml_get_widget (gui, "button-find");
- if (button)
+ if (button && GTK_IS_BUTTON (button))
gtk_signal_connect(GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(update_query), 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 a1a1daf7e6..90b0229766 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 *search_entry;
+ GtkWidget *select_entry;
GtkWidget *status_message;
EvolutionStorageListener *local_listener;
EvolutionStorageListener *other_contacts_listener;
diff --git a/addressbook/gui/component/select-names/select-names.glade b/addressbook/gui/component/select-names/select-names.glade
index 367c5b21bd..2a6f1960c9 100644
--- a/addressbook/gui/component/select-names/select-names.glade
+++ b/addressbook/gui/component/select-names/select-names.glade
@@ -265,7 +265,7 @@
<widget>
<class>GtkTable</class>
<name>table4</name>
- <rows>3</rows>
+ <rows>2</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>3</row_spacing>
@@ -277,17 +277,44 @@
</child>
<widget>
+ <class>GtkLabel</class>
+ <name>label32</name>
+ <label>Type a name into the entry, or
+select one from the list below:</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</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>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
<class>GtkAlignment</class>
<name>alignment4</name>
<xalign>7.45058e-09</xalign>
<yalign>0.5</yalign>
- <xscale>0</xscale>
+ <xscale>1</xscale>
<yscale>1</yscale>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
- <bottom_attach>3</bottom_attach>
+ <bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@@ -305,44 +332,18 @@
<spacing>3</spacing>
<widget>
- <class>GtkHBox</class>
- <name>hbox5</name>
- <homogeneous>False</homogeneous>
- <spacing>3</spacing>
+ <class>GtkEntry</class>
+ <name>entry-select</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
-
- <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>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button16</name>
- <width>50</width>
- <can_focus>True</can_focus>
- <label>F_ind</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
- </widget>
</widget>
<widget>
@@ -382,7 +383,7 @@
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
- <bottom_attach>3</bottom_attach>
+ <bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
@@ -419,33 +420,6 @@
</child>
</widget>
</widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label32</name>
- <label>Type a name into the entry, or
-select one from the list below:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</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>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
</widget>
</widget>