muppet <scott asofyet org> writes:
this patch fix the broken api of Gtk2::TreeSelection->get_selected() unlike C and gtk2-perl APIs, Gtk2::TreeSelection->get_selected() return its return values in the wrong order. <F_gtk2-perl-xs-tree_sel.diff> so it's both wrong and a regression from inline tree of gtk2-perlafter some discussion both on and off the list a while back, it was decided that the most common use for get_selected() was to find just the iter, and the ability to call the function in scalar context to retrieve that was considered more important than adhering strictly to the C API.
why not adher to both ? see below
the model is accessible in array context as well as through $selection->get_tree_view->get_model, and this change is documented in the Gtk2::api manpage.
we could compromise and have scalar context return the iter and array context return both in the C order, but i had trouble getting this to work and nobody seemed interested in it.
here it is:
Attachment:
treesel.diff
Description: Text Data
it makes the following piece of code (tested in harddrake2): my ($model, $iter) = $select->get_selected; my $iter2 = $select->get_selected; print "(mode,iter) = ($model, $iter) <---> iter = $iter2\n"; print the following: (mode,iter) = (Gtk2::TreeStore=HASH(0x87e3214), Gtk2::TreeIter=SCALAR(0x87d7dd0)) <---> iter = Gtk2::TreeIter=SCALAR(0x81a5f28) traditionnal c order is kept, and you still have the iterator only in scalar context is everybody happy ?