Slicing Tree Models

Sometimes there is a need to take a slice of a GtkTreeModel, for example if you have a tree of data and want to show a particular layer of it in a GtkIconView. GtkIconView widgets will only work on list models so there needs to be a way of taking a slice of a tree model and presenting it as a list model. I hereby present OwlTreeModelSlice.

OwlTreeModelSlice in action

The tree view on the left is a GtkTreeStore. The icon view on the right is displaying a OwlTreeModelSlice, that has been told to use the Applications node as the root.

There are a few methods left to implement, and I need to get someone masterful in tree model fu to review the code, but hopefully I'll be releasing the source shortly.

NP: Motion, The Cinematic Orchestra

14:40 Sunday, 12 Mar 2006 [#] [computers] (3 comments)

Posted by Tim M. at Sun Mar 12 19:09:55 2006:
Can't you achieve the same thing using GtkTreeModelFilter, passing 'Applications' as root node for the filter model? (Haven't actually tried it, just thought that was already doable)
Posted by Ross at Sun Mar 12 20:32:12 2006:
Almost, GtkIconView refuses to display non-list stores and a filtered tree is still a tree.

http://bugzilla.gnome.org/show_bug.cgi?id=318669 is a relevant bug I've filed previously.
Posted by fraggle at Mon Mar 13 10:01:52 2006:
"OwlTreeModelSlice"? Do you have any idea just how wacky that sounds?

Name:


E-mail:


URL:


Add 7 and 8 (required):


Comment: