[evolution-data-server/openismus-work-3-8: 106/116] CursorExample: Added a transliterated search option to the example contact browser.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/openismus-work-3-8: 106/116] CursorExample: Added a transliterated search option to the example contact browser.
- Date: Tue, 1 Oct 2013 19:07:09 +0000 (UTC)
commit 7cf2b2746408a666b597337596fdb58c57365025
Author: Tristan Van Berkom <tristanvb openismus com>
Date: Fri Aug 30 14:27:12 2013 +0200
CursorExample: Added a transliterated search option to the example contact browser.
tests/cursor-example/cursor-search.c | 15 +++++++++++++++
tests/cursor-example/cursor-search.ui | 11 +++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/tests/cursor-example/cursor-search.c b/tests/cursor-example/cursor-search.c
index 6b2b45e..16e8f61 100644
--- a/tests/cursor-example/cursor-search.c
+++ b/tests/cursor-example/cursor-search.c
@@ -44,6 +44,7 @@ static void cursor_search_icon_press (CursorSearch *search,
typedef enum {
SEARCH_NAME,
+ SEARCH_TRANSLIT,
SEARCH_PHONE,
SEARCH_EMAIL
} SearchType;
@@ -51,6 +52,7 @@ typedef enum {
struct _CursorSearchPrivate {
GtkWidget *popup;
GtkWidget *name_radio;
+ GtkWidget *translit_radio;
GtkWidget *phone_radio;
GtkWidget *email_radio;
@@ -94,6 +96,7 @@ cursor_search_class_init (CursorSearchClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/evolution/cursor-example/cursor-search.ui");
gtk_widget_class_bind_template_child_private (widget_class, CursorSearch, popup);
gtk_widget_class_bind_template_child_private (widget_class, CursorSearch, name_radio);
+ gtk_widget_class_bind_template_child_private (widget_class, CursorSearch, translit_radio);
gtk_widget_class_bind_template_child_private (widget_class, CursorSearch, phone_radio);
gtk_widget_class_bind_template_child_private (widget_class, CursorSearch, email_radio);
gtk_widget_class_bind_template_callback (widget_class, cursor_search_option_toggled);
@@ -162,6 +165,8 @@ cursor_search_option_toggled (CursorSearch *search,
if (item == priv->name_radio)
priv->type = SEARCH_NAME;
+ else if (item == priv->translit_radio)
+ priv->type = SEARCH_TRANSLIT;
else if (item == priv->phone_radio)
priv->type = SEARCH_PHONE;
else if (item == priv->email_radio)
@@ -194,6 +199,16 @@ cursor_search_entry_changed (CursorSearch *search,
text),
NULL);
break;
+ case SEARCH_TRANSLIT:
+ query = e_book_query_orv (
+ e_book_query_field_test (E_CONTACT_FAMILY_NAME,
+ E_BOOK_QUERY_TRANSLIT_CONTAINS,
+ text),
+ e_book_query_field_test (E_CONTACT_GIVEN_NAME,
+ E_BOOK_QUERY_TRANSLIT_CONTAINS,
+ text),
+ NULL);
+ break;
case SEARCH_PHONE:
query = e_book_query_field_test (E_CONTACT_TEL,
E_BOOK_QUERY_CONTAINS,
diff --git a/tests/cursor-example/cursor-search.ui b/tests/cursor-example/cursor-search.ui
index 58abc34..6a6394b 100644
--- a/tests/cursor-example/cursor-search.ui
+++ b/tests/cursor-example/cursor-search.ui
@@ -23,6 +23,17 @@
</object>
</child>
<child>
+ <object class="GtkRadioMenuItem" id="translit_radio">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Script Insensitive Name</property>
+ <property name="use_underline">True</property>
+ <property name="draw_as_radio">True</property>
+ <property name="group">name_radio</property>
+ <signal name="toggled" handler="cursor_search_option_toggled" swapped="yes"/>
+ </object>
+ </child>
+ <child>
<object class="GtkRadioMenuItem" id="phone_radio">
<property name="visible">True</property>
<property name="can_focus">False</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]