So, I can’t use Gtk::TreeIter.n_children(whatever arguments).
And, as I said : “we can only call n_children from an instanced
Gtk::TreeIter object”
The important word here is “instanced”. Because, I cannot instance a
pseudo root iter above the ones in the liststore. It would be the same
for the top level nodes in a treestore.
I should have pasted the doc of the C function, which clearly says :
Returns the number of children that iter has. As a special case, if iter
is NULL, then the number of toplevel nodes is returned.
“if iter is NULL” is not possible in the ruby gnome2 bindings, afaik.
and first_iter.parent.n_children wil error, since the parent of
first_iter is nil.
I agree, it would be silly in the TreeIter class.
However, it could prove usefull in TreeModel, like :
Gtk::TreeModel#root_n_children => Integer
or
Gtk::TreeModel#n_children(Gtk::TreeIter = nil) => Integer (juste like
the C function)
or
Gtk::TreeModel#nb_toplevel_iters
And it’s very easy to implement for ListStore, as in my first post, but
there is already a C function, I don’t see a good reason not to use it
:).