+
+
+/**
+ * hildon_touch_selector_get_hildon_ui_mode
+ * @selector: a #HildonTouchSelector
+ *
+ * Gets the current hildon-ui-mode, see #HildonUIMode for more information
+ *
+ * Returns: the current hildon-ui-mode
+ *
+ * Since: 2.2
+ **/
+HildonUIMode
+hildon_touch_selector_get_hildon_ui_mode (HildonTouchSelector *selector)
+{
+ g_return_val_if_fail (HILDON_IS_TOUCH_SELECTOR (selector), HILDON_UI_MODE_EDIT);
+
+ return selector->priv->hildon_ui_mode;
+}
+
+/**
+ * hildon_touch_selector_set_hildon_ui_mode
+ * @selector: a #HildonTouchSelector
+ * @mode: a #HildonUIMode
+ *
+ * Sets the value of the property #HildonTouchSelector:hildon-ui-mode to be @mode,
+ * see #HildonUIMode for more information
+ *
+ * Note that the %HILDON_UI_MODE_NORMAL can be only used when the selector has
+ * one column, use the return value to check if the change was effective.
+ *
+ * Returns: %TRUE if #HildonTouchSelector:hildon-ui-mode was changed
+ * %FALSE otherwise
+ *
+ * Since: 2.2
+ **/
+gboolean
+hildon_touch_selector_set_hildon_ui_mode (HildonTouchSelector *selector,
+ HildonUIMode mode)
+{
+ gint num = 0;
+ GSList *iter = NULL;
+ HildonTouchSelectorColumn *column = NULL;
+ GtkTreeView *tree_view = NULL;
+
+ g_return_val_if_fail (HILDON_IS_TOUCH_SELECTOR (selector), FALSE);
+ num = hildon_touch_selector_get_num_columns (selector);
+ g_return_val_if_fail ((mode == HILDON_UI_MODE_EDIT) || (num == 1), FALSE);
+
+ if (mode == selector->priv->hildon_ui_mode) {
+ return FALSE;
+ }
+
+ for (iter = selector->priv->columns; iter; iter = g_slist_next (iter)) {
+ column = HILDON_TOUCH_SELECTOR_COLUMN (iter->data);
+ tree_view = column->priv->tree_view;
+
+ hildon_tree_view_set_hildon_ui_mode (tree_view, mode);
+
+ /* looking at the code of hildon_tree_view_set_hildon_ui_mode, it seems
+ that it call the unselect_all, but it is required anyway */
+ if (mode == HILDON_UI_MODE_NORMAL) {
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (tree_view);
+
+ gtk_tree_selection_unselect_all (selection);
+ }
+ }
+
+ selector->priv->hildon_ui_mode = mode;
+
+ return TRUE;
+}
+
+/**
+ * hildon_touch_selector_get_last_activated_row
+ * @selector: a #HildonTouchSelector
+ * @column: column number
+ *
+ * Gets a #GtkTreePath of the last row activated in a column (the last row that
+ * emitted a #GtkTreeView::row-activated signal). This is mainly useful if the
+ * @selector #HildonTouchSelector:hildon-ui-mode in set to %HILDON_UI_MODE_NORMAL,
+ * as using this state there is no real selection, so a method like
+ * hildon_touch_selector_get_selected_rows() will return always a empty
+ * selection.
+ *
+ * Anyway, this method works as well on %HILDON_UI_MODE_EDIT, but in this case
+ * is better, and more useful, to get the current selection.
+ *
+ * Returns: a newly allocated #GtkTreePath pointing to the last activated row
+ * NULL if no row were activated.
+ *
+ * Since: 2.2
+ **/
+GtkTreePath*
+hildon_touch_selector_get_last_activated_row (HildonTouchSelector *selector,
+ gint column)
+{
+ HildonTouchSelectorColumn *selector_column = NULL;
+
+ /* this method with check selector and that the column number is correct*/
+ selector_column = hildon_touch_selector_get_column (selector, column);
+
+ if (selector_column == NULL) {
+ return NULL;
+ }
+
+ if (selector_column->priv->last_activated != NULL) {
+ return gtk_tree_row_reference_get_path (selector_column->priv->last_activated);
+ } else {
+ return NULL;
+ }
+}
+
+
+/**
+ * hildon_touch_selector_center_on_index:
+ * @selector: a #HildonTouchSelector
+ * @column: column number
+ * @index: the index of the item to center on
+ *
+ * Ensures that the column number @column shows the element @index
+ *
+ * This is similar to hildon_touch_selector_center_on_selected() but with the
+ * difference that allows to center on a column item not selected.
+ *
+ * Take into account that the element is not centered until the widget is
+ * realized. If the widget is not realized when the function is called, it will
+ * be postponed. If you call this function several times before the widget is
+ * realized, only the last one will be used.
+ *
+ * This behaviour includes any call to hildon_touch_selector_center_on_selected().
+ * Check this function for more tips.
+ *
+ * Since: 2.2
+ **/
+void
+hildon_touch_selector_center_on_index (HildonTouchSelector *selector,
+ gint column,
+ gint index)
+{
+ HildonTouchSelectorColumn *current_column = NULL;
+ GtkTreePath *path = NULL;
+
+ g_return_if_fail (HILDON_IS_TOUCH_SELECTOR (selector));
+ g_return_if_fail ((column >= 0) && (column < hildon_touch_selector_get_num_columns (selector)));
+ g_return_if_fail (index >= 0);
+
+ current_column = g_slist_nth_data (selector->priv->columns, column);
+
+ path = gtk_tree_path_new_from_indices (index, -1);
+
+ hildon_touch_selector_scroll_to (current_column,
+ current_column->priv->tree_view,
+ path);
+ gtk_tree_path_free (path);
+}