diff options
-rw-r--r-- | doc/hildon-sections.txt | 2 | ||||
-rw-r--r-- | hildon/hildon-picker-button.c | 54 | ||||
-rw-r--r-- | hildon/hildon-picker-button.h | 8 |
3 files changed, 64 insertions, 0 deletions
diff --git a/doc/hildon-sections.txt b/doc/hildon-sections.txt index 5cd15f2..1072122 100644 --- a/doc/hildon-sections.txt +++ b/doc/hildon-sections.txt @@ -1192,6 +1192,8 @@ hildon_picker_button_set_selector hildon_picker_button_get_selector hildon_picker_button_set_active hildon_picker_button_get_active +hildon_picker_button_set_active_iter +hildon_picker_button_get_active_iter hildon_picker_button_get_done_button_text hildon_picker_button_set_done_button_text hildon_picker_button_value_changed diff --git a/hildon/hildon-picker-button.c b/hildon/hildon-picker-button.c index 82a6288..59f315a 100644 --- a/hildon/hildon-picker-button.c +++ b/hildon/hildon-picker-button.c @@ -569,6 +569,60 @@ hildon_picker_button_set_active (HildonPickerButton * button, } /** + * hildon_picker_button_set_active_iter: + * @button: a #HildonPickerButton + * @iter: the #GtkTreeIter + * + * Sets the active item of the #HildonTouchSelector associated to + * @button to @iter. If the selector has several columns, only the + * first one is used. + * + * See hildon_touch_selector_set_active() for more details. + * + * Since: 3.0 + **/ +void +hildon_picker_button_set_active_iter (HildonPickerButton *button, + GtkTreeIter *iter) +{ + HildonTouchSelector *sel; + + g_return_if_fail (HILDON_IS_PICKER_BUTTON (button)); + + sel = hildon_picker_button_get_selector (button); + + hildon_touch_selector_unselect_all (sel, 0); + hildon_touch_selector_select_iter (sel, 0, iter, FALSE); +} + +/** + * hildon_picker_button_get_active_iter: + * @button: a #HildonPickerButton + * @iter: a #GtkTreeIter + * + * Sets @iter to the current active item, if it exists. If the + * selector has several columns, only the first one is used. + * + * See hildon_touch_selector_get_selected() for more details. + * + * Returns: %TRUE if there is an active item, %FALSE otherwise + * + * Since: 3.0 + **/ +gboolean +hildon_picker_button_get_active_iter (HildonPickerButton *button, + GtkTreeIter *iter) +{ + HildonTouchSelector *sel; + + g_return_val_if_fail (HILDON_IS_PICKER_BUTTON (button), FALSE); + + sel = hildon_picker_button_get_selector (button); + + return hildon_touch_selector_get_selected (sel, 0, iter); +} + +/** * hildon_picker_button_get_done_button_text: * @button: a #HildonPickerButton * diff --git a/hildon/hildon-picker-button.h b/hildon/hildon-picker-button.h index cecc7a5..187a7b3 100644 --- a/hildon/hildon-picker-button.h +++ b/hildon/hildon-picker-button.h @@ -79,6 +79,14 @@ hildon_picker_button_set_active (HildonPickerButton * button, gint hildon_picker_button_get_active (HildonPickerButton * button); +void +hildon_picker_button_set_active_iter (HildonPickerButton *button, + GtkTreeIter *iter); + +gboolean +hildon_picker_button_get_active_iter (HildonPickerButton *button, + GtkTreeIter *iter); + const gchar * hildon_picker_button_get_done_button_text (HildonPickerButton * button); |