From 68cd3e4130c5504c59a52f381ed10e6094da3456 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Fri, 6 Mar 2009 17:03:41 +0000 Subject: [PATCH] Adds a entry to search for countries in the country selector pmo-trunk-r7830 --- src/hildon2/modest-country-picker.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/hildon2/modest-country-picker.c b/src/hildon2/modest-country-picker.c index e2a4442..a05fcf8 100644 --- a/src/hildon2/modest-country-picker.c +++ b/src/hildon2/modest-country-picker.c @@ -258,6 +258,25 @@ modest_country_picker_init (ModestCountryPicker *self) priv->locale_mcc = 0; } +static gchar * +country_picker_print_func (HildonTouchSelector *selector) +{ + GtkTreeModel *model; + GtkTreeIter iter; + gchar *text = NULL; + + /* Always pick the selected country from the tree view and + never from the entry */ + model = hildon_touch_selector_get_model (selector, 0); + if (hildon_touch_selector_get_selected (selector, 0, &iter)) { + gint column; + + column = hildon_touch_selector_entry_get_text_column (HILDON_TOUCH_SELECTOR_ENTRY (selector)); + gtk_tree_model_get (model, &iter, column, &text, -1); + } + return text; +} + void modest_country_picker_load_data(ModestCountryPicker *self) { @@ -278,6 +297,7 @@ modest_country_picker_load_data(ModestCountryPicker *self) g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL); selector = hildon_touch_selector_entry_new (); + hildon_touch_selector_set_print_func (HILDON_TOUCH_SELECTOR (selector), country_picker_print_func); column = hildon_touch_selector_append_column (HILDON_TOUCH_SELECTOR (selector), GTK_TREE_MODEL (model), renderer, "text", MODEL_COL_NAME, NULL); g_object_set (G_OBJECT (column), "text-column", MODEL_COL_NAME, NULL); -- 1.7.9.5