Re: gtk_tree_view/store, best way to select all nodes of a branch



On Wed, Sep 12, 2012 at 10:40:11AM +0200, Arne Pagel wrote:
My current simple solution is as follows:
I use the gtk_tree_model_foreach() function and pass some user data with the current major number of the 
tree-path.
Inside the foreach-function I use gtk_tree_path_to_string, where I check if the first number is identical 
to the user data.

This works, but I have to use a lot of string functions.
Is there a smarter way to do that with less overhead?

Use gtk_tree_selection_select_range().

You already have the start path, so, how to get the end path?  Use
gtk_tree_model_iter_n_children() and gtk_tree_model_iter_nth_child()
recursively to always move to the last child in the branch.  If your
tree is only two-level (as it seems to be) you do not even need to
recurse.

Regards,

Yeti




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]