2008-10-01 Alejandro Pinheiro <apinheiro@igalia.com>
authorAlejandro Piñeiro <apinheiro@igalia.com>
Wed, 1 Oct 2008 08:14:15 +0000 (08:14 +0000)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Wed, 1 Oct 2008 08:14:15 +0000 (08:14 +0000)
* src/hildon-touch-selector.c: added the property "text-column" to the
class HildonTouchSelectorColumn, and related get/set functions
(_default_printf_func): updated to use "text-column" property
* src/hildon-touch-selector-entry.c: mark as deprecated the property
"text-column" in his documentation, as this is now included on
HildonTouchSelectorColumn. The get/set_property can still be used,
working as a wrapper to the concrete column "text-column" property
(_text_column_modified): callback added in order to handle the signal
"notify::text-column" of the concrete HildonTouchSelectorColumn
(hildon_touch_selector_entry_get_text_column)
(hildon_touch_selector_entry_set_text_column): Added documentation, and
modified in order to use the HildonTouchSelectorColumn "text-column"
property
* src/hildon-time-selector.c:
* src/hildon-date-selector.c:
* examples/hildon-touch-selector-example.c
* examples/hildon-touch-selector-multi-cells-example.c
* examples/hildon-picker-button-multicolumn-example.c
Set the right value to "text-column" property on the creation of a new
column using hildon_touch_selector_append_column()

Fixes: NB#88644 (Hardcoded first column of the model as text column

ChangeLog
examples/hildon-picker-button-multicolumn-example.c
examples/hildon-touch-selector-example.c
examples/hildon-touch-selector-multi-cells-example.c
src/hildon-date-selector.c
src/hildon-time-selector.c
src/hildon-touch-selector-entry.c
src/hildon-touch-selector.c

index c32d210..5a19d85 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2008-10-01  Alejandro Pinheiro <apinheiro@igalia.com>
+
+       * src/hildon-touch-selector.c: added the property "text-column" to the
+       class HildonTouchSelectorColumn, and related get/set functions
+       (_default_printf_func): updated to use "text-column" property
+       * src/hildon-touch-selector-entry.c: mark as deprecated the property
+       "text-column" in his documentation, as this is now included on
+       HildonTouchSelectorColumn. The get/set_property can still be used,
+       working as a wrapper to the concrete column "text-column" property
+       (_text_column_modified): callback added in order to handle the signal
+       "notify::text-column" of the concrete HildonTouchSelectorColumn
+       (hildon_touch_selector_entry_get_text_column)
+       (hildon_touch_selector_entry_set_text_column): Added documentation, and
+       modified in order to use the HildonTouchSelectorColumn "text-column"
+       property
+       * src/hildon-time-selector.c:
+       * src/hildon-date-selector.c:
+       * examples/hildon-touch-selector-example.c
+       * examples/hildon-touch-selector-multi-cells-example.c
+       * examples/hildon-picker-button-multicolumn-example.c
+       Set the right value to "text-column" property on the creation of a new
+       column using hildon_touch_selector_append_column()
+
+       Fixes: NB#88644 (Hardcoded first column of the model as text column)
+
 2008-09-30  Alberto Garcia  <agarcia@igalia.com>
 
        * src/hildon-app-menu.c
index 225aa58..9c15435 100644 (file)
@@ -28,6 +28,7 @@ create_touch_selector (void)
   GtkWidget *selector;
   GtkListStore *model;
   GtkTreeIter iter;
+  HildonTouchSelectorColumn *column = NULL;
 
   selector = hildon_touch_selector_new ();
 
@@ -45,8 +46,9 @@ create_touch_selector (void)
   gtk_list_store_append (model, &iter);
   gtk_list_store_set (model, &iter, 0, "Mailbox", -1);
 
-  hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
-                                            GTK_TREE_MODEL (model), TRUE);
+  column = hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
+                                                     GTK_TREE_MODEL (model), TRUE);
+  g_object_set (G_OBJECT(column), "text-column", 0, NULL);
 
   model = gtk_list_store_new (1, G_TYPE_STRING);
 
@@ -59,8 +61,10 @@ create_touch_selector (void)
   gtk_list_store_append (model, &iter);
   gtk_list_store_set (model, &iter, 0, "Smoke signals", -1);
 
-  hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
-                                            GTK_TREE_MODEL (model), TRUE);
+  column = hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
+                                                     GTK_TREE_MODEL (model), TRUE);
+  g_object_set (G_OBJECT(column), "text-column", 0, NULL);
+  
   return selector;
 }
 
index 5e07bfa..a1be5cd 100644 (file)
@@ -59,6 +59,7 @@ create_selector ()
   GtkListStore *store_icons = NULL;
   GSList *item = NULL;
   GtkCellRenderer *renderer = NULL;
+  HildonTouchSelectorColumn *column = NULL;
 
   selector = hildon_touch_selector_new ();
 
@@ -78,9 +79,10 @@ create_selector ()
   renderer = gtk_cell_renderer_pixbuf_new ();
   gtk_cell_renderer_set_fixed_size (renderer, -1, 100);
 
-  hildon_touch_selector_append_column (HILDON_TOUCH_SELECTOR (selector),
-                                       GTK_TREE_MODEL (store_icons),
-                                       renderer, "stock-id", 0, NULL);
+  column = hildon_touch_selector_append_column (HILDON_TOUCH_SELECTOR (selector),
+                                                GTK_TREE_MODEL (store_icons),
+                                                renderer, "stock-id", 0, NULL);
+  g_object_set (G_OBJECT (column), "text-column", 0, NULL);
 
   hildon_touch_selector_set_column_selection_mode (HILDON_TOUCH_SELECTOR (selector),
                                                    HILDON_TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE);
index 4cb24d9..30fa2fe 100644 (file)
@@ -83,6 +83,7 @@ create_selector ()
   column = hildon_touch_selector_append_column (HILDON_TOUCH_SELECTOR (selector),
                                                 GTK_TREE_MODEL (store_icons),
                                                 NULL, NULL);
+  g_object_set (G_OBJECT(column), "text-column", 1, NULL);
 
   renderer = gtk_cell_renderer_pixbuf_new ();
   gtk_cell_renderer_set_fixed_size (renderer, 75, 75);
index 7cc3bfd..dab0856 100644 (file)
@@ -214,6 +214,7 @@ hildon_date_selector_init (HildonDateSelector * selector)
 {
   GSList *iter = NULL;
   gint current_item = 0;
+  HildonTouchSelectorColumn *column = NULL;
 
   selector->priv = HILDON_DATE_SELECTOR_GET_PRIVATE (selector);
 
@@ -234,23 +235,26 @@ hildon_date_selector_init (HildonDateSelector * selector)
   selector->priv->month_model = _create_month_model (selector);
   selector->priv->day_model = _create_day_model (selector);
 
-  /* We add the columns: FIXME: check the locale order */
+  /* We add the columns, checking the locale order */
   iter = selector->priv->column_order;
   for (iter = selector->priv->column_order; iter; iter = g_slist_next (iter)) {
     current_item = GPOINTER_TO_INT (iter->data);
 
     switch (current_item) {
     case DAY:
-      hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
-                                                selector->priv->day_model, TRUE);
+      column = hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
+                                                         selector->priv->day_model, TRUE);
+      g_object_set (G_OBJECT (column), "text-column", 0, NULL);
       break;
     case MONTH:
-      hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
-                                                selector->priv->month_model, TRUE);
+      column = hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
+                                                         selector->priv->month_model, TRUE);
+      g_object_set (G_OBJECT (column), "text-column", 0, NULL);
       break;
     case YEAR:
-      hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
-                                                selector->priv->year_model, TRUE);
+      column = hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
+                                                         selector->priv->year_model, TRUE);
+      g_object_set (G_OBJECT (column), "text-column", 0, NULL);
       break;
     default:
       g_error ("Current column order incorrect");
index 78c9c4b..912da10 100644 (file)
@@ -131,6 +131,8 @@ hildon_time_selector_class_init (HildonTimeSelectorClass * class)
 static void
 hildon_time_selector_init (HildonTimeSelector * selector)
 {
+  HildonTouchSelectorColumn *column = NULL;
+
   selector->priv = HILDON_TIME_SELECTOR_GET_PRIVATE (selector);
 
   GTK_WIDGET_SET_FLAGS (GTK_WIDGET (selector), GTK_NO_WINDOW);
@@ -147,11 +149,13 @@ hildon_time_selector_init (HildonTimeSelector * selector)
   selector->priv->hours_model = _create_hours_model (selector);
   selector->priv->minutes_model = _create_minutes_model (selector);
 
-  hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
-                                            selector->priv->hours_model, TRUE);
+  column = hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
+                                                     selector->priv->hours_model, TRUE);
+  g_object_set (column, "text-column", 0, NULL);
 
-  hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
-                                            selector->priv->minutes_model, TRUE);
+  column = hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
+                                                     selector->priv->minutes_model, TRUE);
+  g_object_set (column, "text-column", 0, NULL);
 
   if (selector->priv->ampm_format) {
     selector->priv->ampm_model = _create_ampm_model (selector);
index b426f38..376399f 100644 (file)
@@ -61,8 +61,11 @@ static void hildon_touch_selector_entry_set_model (HildonTouchSelector * selecto
                                                    gint column, GtkTreeModel *model);
 static gboolean hildon_touch_selector_entry_has_multiple_selection (HildonTouchSelector * selector);
 
+static void
+_text_column_modified (GObject *pspec, GParamSpec *gobject, gpointer data);
+
+
 struct _HildonTouchSelectorEntryPrivate {
-  gint text_column;
   gulong signal_id;
   GtkWidget *entry;
 };
@@ -115,7 +118,11 @@ hildon_touch_selector_entry_class_init (HildonTouchSelectorEntryClass *klass)
                                    PROP_TEXT_COLUMN,
                                    g_param_spec_int ("text-column",
                                                      "Text Column",
-                                                     "A column in the data source model to get the strings from.",
+                                                     "A column in the data source model to get the strings from."
+                                                     "Deprecated: now this property is in HildonTouchSelectorColumn"
+                                                     "use hildon_touch_selector_entry_set_text_column() and"
+                                                     "hildon_touch_selector_entry_get_text_column() to manage"
+                                                     "this in a easy way",
                                                      -1,
                                                      G_MAXINT,
                                                      -1,
@@ -180,6 +187,7 @@ hildon_touch_selector_entry_new_text (void)
   GtkWidget *selector;
   GtkEntryCompletion *completion;
   HildonTouchSelectorEntryPrivate *priv;
+  HildonTouchSelectorColumn *column = NULL;
 
   selector = hildon_touch_selector_entry_new ();
 
@@ -188,41 +196,79 @@ hildon_touch_selector_entry_new_text (void)
   model = gtk_list_store_new (1, G_TYPE_STRING);
   completion = gtk_entry_get_completion (GTK_ENTRY (priv->entry));
   gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (model));
+  column = hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
+                                                     GTK_TREE_MODEL (model), FALSE);
 
-  hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
-                                            GTK_TREE_MODEL (model), FALSE);
+  g_signal_connect (column, "notify::text-column", G_CALLBACK (_text_column_modified),
+                    selector);
   hildon_touch_selector_entry_set_text_column (HILDON_TOUCH_SELECTOR_ENTRY (selector), 0);
 
   return selector;
 }
 
+static void
+_text_column_modified (GObject *pspec, GParamSpec *gobject, gpointer data)
+{
+  HildonTouchSelectorEntry *selector;
+  HildonTouchSelectorEntryPrivate *priv;
+  GtkEntryCompletion *completion;
+  gint text_column = -1;
+
+  g_return_if_fail (HILDON_IS_TOUCH_SELECTOR_ENTRY (data));
+  selector = HILDON_TOUCH_SELECTOR_ENTRY (data);
+
+  priv = HILDON_TOUCH_SELECTOR_ENTRY_GET_PRIVATE (HILDON_TOUCH_SELECTOR_ENTRY(selector));
+  completion = gtk_entry_get_completion (GTK_ENTRY (priv->entry));
+
+  text_column = hildon_touch_selector_entry_get_text_column (selector);
+
+  gtk_entry_completion_set_text_column (completion, text_column);
+}
+
+/**
+ * hildon_touch_selector_entry_set_text_column:
+ * @selector: A #HildonTouchSelectorEntry
+ * @text_column: A column in model to get the strings from
+ *
+ * Sets the model column which touch selector box should use to get strings
+ * from to be text_column.
+ *
+ **/
 void
 hildon_touch_selector_entry_set_text_column (HildonTouchSelectorEntry *selector,
                                              gint text_column)
 {
-  HildonTouchSelectorEntryPrivate *priv;
-  GtkEntryCompletion *completion;
+  HildonTouchSelectorColumn *column = NULL;
 
   g_return_if_fail (HILDON_IS_TOUCH_SELECTOR_ENTRY (selector));
   g_return_if_fail (text_column >= -1);
 
-  priv = HILDON_TOUCH_SELECTOR_ENTRY_GET_PRIVATE (selector);
-  completion = gtk_entry_get_completion (GTK_ENTRY (priv->entry));
+  column = hildon_touch_selector_get_column (HILDON_TOUCH_SELECTOR (selector), 0);
 
-  gtk_entry_completion_set_text_column (completion, text_column);
-  priv->text_column = text_column;
+  g_object_set (G_OBJECT (column), "text-column", text_column, NULL);
 }
 
+/**
+ * hildon_touch_selector_entry_get_text_column:
+ * @selector: A #HildonTouchSelectorEntry
+ *
+ * Returns the @column which the touch selector is using to get the strings from
+ *
+ **/
 gint
 hildon_touch_selector_entry_get_text_column (HildonTouchSelectorEntry *selector)
 {
-  HildonTouchSelectorEntryPrivate *priv;
+  HildonTouchSelectorColumn *column = NULL;
+  gint text_column = -1;
 
   g_return_val_if_fail (HILDON_IS_TOUCH_SELECTOR_ENTRY (selector), -1);
 
-  priv = HILDON_TOUCH_SELECTOR_ENTRY_GET_PRIVATE (selector);
+  column = hildon_touch_selector_get_column (HILDON_TOUCH_SELECTOR (selector),
+                                             0);
 
-  return priv->text_column;
+  g_object_get (G_OBJECT (column), "text-column", &text_column, NULL);
+
+  return text_column;
 }
 
 static void
@@ -237,20 +283,24 @@ entry_on_text_changed (GtkEditable * editable,
   const gchar *prefix;
   gchar *text;
   gboolean found = FALSE;
+  gint text_column = -1;
 
   entry = GTK_ENTRY (editable);
   selector = HILDON_TOUCH_SELECTOR (userdata);
   priv = HILDON_TOUCH_SELECTOR_ENTRY_GET_PRIVATE (selector);
 
+  text_column =
+    hildon_touch_selector_entry_get_text_column (HILDON_TOUCH_SELECTOR_ENTRY (selector));
+
   prefix = gtk_entry_get_text (entry);
-  model = hildon_touch_selector_get_model (HILDON_TOUCH_SELECTOR (selector), 0);
+  model = hildon_touch_selector_get_model (selector, 0);
 
   if (!gtk_tree_model_get_iter_first (model, &iter)) {
     return;
   }
 
   do {
-    gtk_tree_model_get (model, &iter, priv->text_column, &text, -1);
+    gtk_tree_model_get (model, &iter, text_column, &text, -1);
     found = g_str_has_prefix (text, prefix);
     g_free (text);
   } while (found != TRUE && gtk_tree_model_iter_next (model, &iter));
@@ -282,10 +332,12 @@ hildon_touch_selector_get_text_from_model (HildonTouchSelectorEntry * selector)
   GtkTreePath *path;
   GList *selected_rows;
   gchar *text;
+  gint text_column = -1;
 
   priv = HILDON_TOUCH_SELECTOR_ENTRY_GET_PRIVATE (selector);
 
   model = hildon_touch_selector_get_model (HILDON_TOUCH_SELECTOR (selector), 0);
+  text_column = hildon_touch_selector_entry_get_text_column (selector);
   selected_rows = hildon_touch_selector_get_selected_rows (HILDON_TOUCH_SELECTOR (selector), 0);
 
   if (selected_rows == NULL) {
@@ -297,7 +349,7 @@ hildon_touch_selector_get_text_from_model (HildonTouchSelectorEntry * selector)
 
   path = (GtkTreePath *)selected_rows->data;
   gtk_tree_model_get_iter (model, &iter, path);
-  gtk_tree_model_get (model, &iter, priv->text_column, &text, -1);
+  gtk_tree_model_get (model, &iter, text_column, &text, -1);
 
   gtk_tree_path_free (path);
   g_list_free (selected_rows);
@@ -328,6 +380,7 @@ hildon_touch_selector_entry_set_model (HildonTouchSelector * selector,
 {
   GtkEntryCompletion *completion;
   HildonTouchSelectorEntryPrivate *priv;
+  gint text_column = -1;
 
   g_return_if_fail (HILDON_IS_TOUCH_SELECTOR_ENTRY (selector));
   g_return_if_fail (column == 0);
@@ -339,7 +392,10 @@ hildon_touch_selector_entry_set_model (HildonTouchSelector * selector,
 
   completion = gtk_entry_get_completion (GTK_ENTRY (priv->entry));
   gtk_entry_completion_set_model (completion, model);
-  gtk_entry_completion_set_text_column (completion, priv->text_column);
+
+  text_column = hildon_touch_selector_entry_get_text_column (HILDON_TOUCH_SELECTOR_ENTRY (selector));
+
+  gtk_entry_completion_set_text_column (completion, text_column);
 }
 
 static gboolean
index 9c1536d..8bb87ac 100644 (file)
  * If you need a selector widget that also accepts user inputs, you
  * can use #HildonTouchSelectorEntry.
  *
- * Internally it uses a #GtkTreeView, but each one has only a #GtkTreeViewColumn,
- * as the column management is made by #HildonTouchSelector
+ * The current selection has a string representation. In the most common cases,
+ * each column model will contain a text column. You can configure
+ * which column in particular using the #HildonTouchSelectorColumn property
+ * \"text-column\"
+ *
+ * You can get this string representation using
+ * hildon_touch_selector_get_current_text().
+ * You can configure how the selection is printed with
+ * hildon_touch_selector_set_print_func(), that sets the current hildon touch
+ * selector print function. The widget has a default print function, that
+ * uses the \"text-column\" property on each #HildonTouchSelectorColumn to
+ * compose the final representation.
+ *
+ * If you create the selector using hildon_touch_selector_new_text() you
+ * don't need to take care of this property, as the model is created internally.
+ * If you create the selector using hildon_touch_selector_new(), you
+ * need to specify properly the property for your custom model in order to get a
+ * non-empty string representation, or define your custom print function.
+ *
  */
 
 #ifdef HAVE_CONFIG_H
@@ -80,6 +97,7 @@ struct _HildonTouchSelectorColumnPrivate
 {
   HildonTouchSelector *parent;    /* the selector that contains this column */
   GtkTreeModel *model;
+  gint text_column;
   GtkTreeView *tree_view;
 
   GtkWidget *panarea;           /* the pannable widget */
@@ -170,10 +188,10 @@ hildon_touch_selector_class_init (HildonTouchSelectorClass * class)
   GtkWidgetClass *widget_class;
   GtkContainerClass *container_class;
 
-  gobject_class = (GObjectClass *) class;
-  object_class = (GtkObjectClass *) class;
-  widget_class = (GtkWidgetClass *) class;
-  container_class = (GtkContainerClass *) class;
+  gobject_class = G_OBJECT_CLASS (class);
+  object_class = GTK_OBJECT_CLASS (class);
+  widget_class = GTK_WIDGET_CLASS (class);
+  container_class = GTK_CONTAINER_CLASS (class);
 
   /* GObject */
 
@@ -250,6 +268,7 @@ hildon_touch_selector_get_property (GObject * object,
   }
 }
 
+
 static void
 hildon_touch_selector_init (HildonTouchSelector * selector)
 {
@@ -350,6 +369,8 @@ _default_print_func (HildonTouchSelector * selector)
   GtkTreePath *current_path = NULL;
   GList *selected_rows = NULL;
   gint initial_value = 0;
+  gint text_column = -1; 
+  HildonTouchSelectorColumn *column = NULL;
 
   num_columns = hildon_touch_selector_get_num_columns (selector);
 
@@ -360,6 +381,8 @@ _default_print_func (HildonTouchSelector * selector)
     /* In this case we get the first column first */
     selected_rows = hildon_touch_selector_get_selected_rows (selector, 0);
     model = hildon_touch_selector_get_model (selector, 0);
+    column = hildon_touch_selector_get_column (selector, 0);
+    g_object_get (G_OBJECT(column), "text-column", &text_column, NULL);
 
     result = g_strdup_printf ("(");
     i = 0;
@@ -367,7 +390,9 @@ _default_print_func (HildonTouchSelector * selector)
       current_path = item->data;
       gtk_tree_model_get_iter (model, &iter, current_path);
 
-      gtk_tree_model_get (model, &iter, 0, &current_string, -1);
+      if (text_column != -1) {
+        gtk_tree_model_get (model, &iter, text_column, &current_string, -1);
+      }
 
       if (i < g_list_length (selected_rows) - 1) {
         aux = g_strconcat (result, current_string, ",", NULL);
@@ -394,9 +419,14 @@ _default_print_func (HildonTouchSelector * selector)
 
   for (i = initial_value; i < num_columns; i++) {
     model = hildon_touch_selector_get_model (selector, i);
+    column = hildon_touch_selector_get_column (selector, 0);
+    g_object_get (G_OBJECT(column), "text-column", &text_column, NULL);
+
     if (hildon_touch_selector_get_selected (selector, i, &iter)) {
 
-      gtk_tree_model_get (model, &iter, 0, &current_string, -1);
+      if (text_column != -1 ) {
+        gtk_tree_model_get (model, &iter, text_column, &current_string, -1);
+      }
       if (i != 0) {
         aux = g_strconcat (result, ":", current_string, NULL);
         g_free (result);
@@ -499,14 +529,51 @@ G_DEFINE_TYPE_WITH_CODE (HildonTouchSelectorColumn, hildon_touch_selector_column
                         G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT,
                                                hildon_touch_selector_column_cell_layout_init))
 
+enum
+{
+  PROP_TEXT_COLUMN = 1
+};
+
 static void
-hildon_touch_selector_column_class_init (HildonTouchSelectorColumnClass *class)
+hildon_touch_selector_column_class_init (HildonTouchSelectorColumnClass *klass);
+
+static void
+hildon_touch_selector_column_get_property (GObject *object, guint property_id,
+                                           GValue *value, GParamSpec *pspec);
+
+static void
+hildon_touch_selector_column_set_property  (GObject *object, guint property_id,
+                                            const GValue *value, GParamSpec *pspec);
+
+static void
+hildon_touch_selector_column_set_text_column (HildonTouchSelectorColumn *column,
+                                              gint text_column);
+static gint
+hildon_touch_selector_column_get_text_column (HildonTouchSelectorColumn *column);
+
+
+static void
+hildon_touch_selector_column_class_init (HildonTouchSelectorColumnClass *klass)
 {
-  GObjectClass *object_class;
+  GObjectClass *gobject_class = NULL;
 
-  object_class = (GObjectClass*) class;
+  gobject_class = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (object_class, sizeof (HildonTouchSelectorColumnPrivate));
+  g_type_class_add_private (gobject_class, sizeof (HildonTouchSelectorColumnPrivate));
+
+  /* GObject */
+  gobject_class->get_property = hildon_touch_selector_column_get_property;
+  gobject_class->set_property = hildon_touch_selector_column_set_property;
+
+  g_object_class_install_property (G_OBJECT_CLASS(klass),
+                                   PROP_TEXT_COLUMN,
+                                   g_param_spec_int ("text-column",
+                                                     "Text Column",
+                                                     "A column in the data source model to get the strings from.",
+                                                     -1,
+                                                     G_MAXINT,
+                                                     -1,
+                                                     G_PARAM_READWRITE));
 }
 
 static void
@@ -514,10 +581,59 @@ hildon_touch_selector_column_init (HildonTouchSelectorColumn *column)
 {
   column->priv = G_TYPE_INSTANCE_GET_PRIVATE (column, HILDON_TYPE_TOUCH_SELECTOR_COLUMN,
                                               HildonTouchSelectorColumnPrivate);
+  column->priv->text_column = -1;
+}
+
+static void
+hildon_touch_selector_column_set_text_column (HildonTouchSelectorColumn *column,
+                                              gint text_column)
+{
+  g_return_if_fail (HILDON_IS_TOUCH_SELECTOR_COLUMN (column));
+  g_return_if_fail (text_column >= -1);
+
+  column->priv->text_column = text_column;
+
+  g_object_notify (G_OBJECT (column), "text-column");
 }
 
+static gint
+hildon_touch_selector_column_get_text_column (HildonTouchSelectorColumn *column)
+{
+  g_return_val_if_fail (HILDON_IS_TOUCH_SELECTOR_COLUMN (column), -1);
+
+  return column->priv->text_column;
+}
 
 static void
+hildon_touch_selector_column_get_property (GObject *object, guint property_id,
+                                           GValue *value, GParamSpec *pspec)
+{
+  switch (property_id) {
+  case PROP_TEXT_COLUMN:
+    g_value_set_int (value,
+                     hildon_touch_selector_column_get_text_column (HILDON_TOUCH_SELECTOR_COLUMN (object)));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+  }
+}
+
+static void
+hildon_touch_selector_column_set_property (GObject *object, guint property_id,
+                                           const GValue *value, GParamSpec *pspec)
+{
+  switch (property_id) {
+  case PROP_TEXT_COLUMN:
+    hildon_touch_selector_column_set_text_column (HILDON_TOUCH_SELECTOR_COLUMN (object),
+                                                  g_value_get_int (value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+  }
+}
+
+/* ------------------------ GtkCellLayout implementation -------------------- */
+static void
 hildon_touch_selector_column_cell_layout_init (GtkCellLayoutIface      *iface)
 {
   iface->pack_start         = hildon_touch_selector_column_cell_layout_pack_start;
@@ -688,12 +804,15 @@ hildon_touch_selector_new_text (void)
 {
   GtkWidget *selector;
   GtkListStore *store;
+  HildonTouchSelectorColumn *column = NULL;
 
   selector = hildon_touch_selector_new ();
   store = gtk_list_store_new (1, G_TYPE_STRING);
 
-  hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
-                                            GTK_TREE_MODEL (store), TRUE);
+  column = hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
+                                                     GTK_TREE_MODEL (store), TRUE);
+
+  g_object_set (G_OBJECT (column), "text-column", 0, NULL);
 
   return selector;
 }
@@ -859,8 +978,8 @@ hildon_touch_selector_append_text_column (HildonTouchSelector * selector,
   GtkCellRenderer *renderer = NULL;
   GValue val = { 0, };
 
-  g_return_val_if_fail (HILDON_IS_TOUCH_SELECTOR (selector), FALSE);
-  g_return_val_if_fail (GTK_IS_TREE_MODEL (model), FALSE);
+  g_return_val_if_fail (HILDON_IS_TOUCH_SELECTOR (selector), NULL);
+  g_return_val_if_fail (GTK_IS_TREE_MODEL (model), NULL);
 
   if (model != NULL) {
     renderer = gtk_cell_renderer_text_new ();
@@ -874,7 +993,7 @@ hildon_touch_selector_append_text_column (HildonTouchSelector * selector,
     return hildon_touch_selector_append_column (selector, model, renderer,
                                                 "text", 0, NULL);
   } else {
-    return FALSE;
+    return NULL;
   }
 }