* @short_description: A selector widget with one column and a text entry
* @see_also: #HildonTouchSelector, #HildonPickerButton
*
- * #HildonTouchSelectorEntry is a selector widget with a text entry, similar in behaviour
- * to #GtkComboBoxEntry, that allows user to select an item from a predefined list
- * or to enter a different one in a #GtkEntry. Items can also be searched and selected
- * by typing in the entry.
+ * #HildonTouchSelectorEntry is a selector widget with a text entry, similar in
+ * behaviour to #GtkComboBoxEntry, that allows user to select an item from a
+ * predefined list or to enter a different one in a #GtkEntry. Items can also
+ * be searched and selected by typing in the entry.
*
* The main difference between the #GtkTreeModel used by #HildonTouchSelector
- * and #HildonTouchSelectorEntry, is that the latter must always include a text column.
- * You should set it with hildon_touch_selector_entry_set_text_column().
+ * and #HildonTouchSelectorEntry, is that the latter must always include a text
+ * column. You should set it with hildon_touch_selector_entry_set_text_column().
*
* Normally, you would use #HildonTouchSelectorEntry together with a
* #HildonPickerDialog activated from a button. For the most common
object_class->get_property = hildon_touch_selector_entry_get_property;
object_class->set_property = hildon_touch_selector_entry_set_property;
+ /**
+ * HildonTouchSelectorEntry:text-column:
+ *
+ * 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.
+ *
+ **/
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."
- "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",
+ "A column in the data source model to get the strings from.",
-1,
G_MAXINT,
-1,
hildon_touch_selector_entry_print_func (HildonTouchSelector * selector)
{
HildonTouchSelectorEntryPrivate *priv;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint column;
+ gchar *text = NULL;
priv = HILDON_TOUCH_SELECTOR_ENTRY_GET_PRIVATE (selector);
- return g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->entry)));
+ if (*(gtk_entry_get_text (GTK_ENTRY (priv->entry))) != '\0') {
+ text = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->entry)));
+ } else {
+ model = hildon_touch_selector_get_model (selector, 0);
+ if (hildon_touch_selector_get_selected (selector, 0, &iter)) {
+ column = hildon_touch_selector_entry_get_text_column (HILDON_TOUCH_SELECTOR_ENTRY (selector));
+ gtk_tree_model_get (model, &iter, column, &text, -1);
+ }
+ }
+
+ return text;
}
static void
* @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.
+ * from to be @text_column.
*
**/
void
* hildon_touch_selector_entry_get_text_column:
* @selector: A #HildonTouchSelectorEntry
*
- * Returns the @column which the touch selector is using to get the strings from
+ * Gets the text column that @selector is using as a text column.
+ *
+ * Returns: the number of the column used as a text column.
*
**/
gint