Bug 4640

Summary: hildon_touch_selector_get_active_iter() needed.
Product: [Maemo Official Platform] Desktop platform Reporter: Murray Cumming <murrayc>
Component: hildon-widgetsAssignee: Alberto Garcia Gonzalez <agarcia>
Status: RESOLVED FIXED QA Contact: hildon-libs-bugs
Severity: normal    
Priority: Medium CC: agarcia, andre_klapper, murrayc
Version: 5.0-beta   
Target Milestone: 5.0/(10.2010.19-1)   
Hardware: All   
OS: Linux   
Attachments: Update HildonTouchSelector documentation

Description Murray Cumming (reporter) 2009-06-06 21:30:42 UTC
HildonTouchSelector needs a get_active_iter() function, like GtkComboBox:
http://library.gnome.org/devel/gtk/unstable/GtkComboBox.html#gtk-combo-box-get-active-iter

At the moment it just has a get_active() that returns an int (which GtkComboBox
has too). But developer really need to deal with the underlying GtkTreeModel
via GtkTreeIter, not an int. That's particularly true for language bindings.

This is also inconsistent because other HildonTouchSelector functions deal with
iters.
Comment 1 Claudio Saavedra 2009-06-09 09:15:54 UTC
There is hildon_touch_selector_get_selected () for this:

/**
 * hildon_touch_selector_get_selected:
 * @selector: a #HildonTouchSelector
 * @column: the column number we want to get the element
 * @iter: #GtkTreeIter currently selected
 *
 * Sets @iter to the currently selected node on the nth-column, if selection is
 * set to %HILDON_TOUCH_SELECTOR_SINGLE or %HILDON_TOUCH_SELECTOR_MULTIPLE with
 * a column different that the first one. @iter may be %NULL if you just want
to
 * test if selection has any selected items.
 *
 * This function will not work if selection is in
 * %HILDON_TOUCH_SELECTOR_MULTIPLE mode and the column is the first one.
 *
 * See gtk_tree_selection_get_selected() for more information.
 *
 * Returns: %TRUE if @iter was correctly set, %FALSE otherwise
 *
 * Since: 2.2
 **/
gboolean
hildon_touch_selector_get_selected (HildonTouchSelector * selector,
                                    gint column, GtkTreeIter * iter)
Comment 2 Murray Cumming (reporter) 2009-10-19 11:13:03 UTC
Is hildon_touch_selector_select_iter() the setter for this? If so, I guess that
should be called hildon_touch_selector_select_iterset_selected_iter() instead.

Otherwise, to make the relationship clearer, the documentation for both
functions should mention the other function.
Comment 3 Alberto Garcia Gonzalez 2010-01-22 18:14:37 UTC
Created an attachment (id=2095) [details]
Update HildonTouchSelector documentation
Comment 4 Alberto Garcia Gonzalez 2010-01-22 18:15:17 UTC
(In reply to comment #2)
> Is hildon_touch_selector_select_iter() the setter for this? If so, I
> guess that should be called
> hildon_touch_selector_select_iterset_selected_iter() instead.
>
> Otherwise, to make the relationship clearer, the documentation for
> both functions should mention the other function.

I don't think it's a good idea to change the API at this point, so
what do you think about this patch?
Comment 5 Murray Cumming (reporter) 2010-01-22 18:20:07 UTC
Well, API additions should be OK in minor versions, as they are in GTK+. So I'd
personally keep this open in case there is ever a new minor (x.something.y)
version.

But, that's certainly a helpful hint. Thanks. I'd even deprecate these methods,
and any other index-based ones.
Comment 6 Alberto Garcia Gonzalez 2010-01-22 18:40:17 UTC
(In reply to comment #5)
> Well, API additions should be OK in minor versions, as they are in
> GTK+. So I'd personally keep this open in case there is ever a new
> minor (x.something.y) version.

You're right.

The problem is that if people start using this new function when the
next Maemo update is out, applications would not be compatible with
earlier firmwares and users would be forced to update. This has
already happened in the PR1.1 update and I wouldn't like it to happen
again without a good reason:

http://www.gossamer-threads.com/lists/maemo/developers/57488?page=last

I'd wait to change an API like this (which doesn't add new
functionality) until breaking backwards compatibility is unavoidable.

So I'll just update the docs by now.

Thanks for the report.
Comment 7 Alberto Garcia Gonzalez 2010-01-22 19:13:16 UTC
Fixed:

http://maemo.gitorious.org/hildon/hildon/commit/5b411b5332650567a320e04f7bb64a1c27eb34b0

It will be available in libhildon 2.2.12
Comment 8 Andre Klapper maemo.org 2010-03-15 20:53:27 UTC
Setting explicit PR1.2 milestone (so it's clearer in which public release the
fix will be available to users).

Sorry for the bugmail noise (you can filter on this message).