Re: GtkTreeStore manipulation



On Thu, 18 Nov 2004 12:00:16 +1300, Tim Evans <t evans aranz com> wrote:
Tristan Van Berkom wrote:
[...]
It might be easier to write your own implementation of the GtkTreeModel
interface than to use the general-purpose GtkTreeStore.  This may remove
the need to maintain what amounts to two separate models, one in the
GtkTreeStore and one in the widget hierachy that you are displaying.
Instead, a custom tree-model implementation could get it's data directly
from the widget hierachy.

    You mean a GtkTreeModel implementation that would automagicly reparent,
reposition items when widgets are inserted ?

Sounds interesting, but it might be a little overboard for this application
(I might be wrong about that).

Right now I have:
    - Function to find the GtkTreeIter by "GladeWidget" object
      (which I use to find the parent widget so that I can append widgets
       to their parents)
    - Function to list all GtkTreeIter's which are children of that widget.
      (I now use that to remove all GtkTreeIter's that represent children 
       of the widget currently being added)
    - Function to "populate" the model from a list of widgets
      (This works recursively, starting with a list of toplevels, I call
        this at treeview construction time and also to re-add any children).

If you want, I'll have a go at writing the custom tree model for you.

If you think its worth the effort and it wont end up being more work
to achieve the same results, then you are definitly welcome to hack at
that ;-)

That being said, the glade-3 widget tree is not exactly a "widget hierarchy"
as we know it, I am currently adding support for non-widgets (i.e. GObject
derivatives) in the glade UI, this implies that there is another container
infrastructure (i.e. a GtkEntry should be able to parent a GtkEntryCompletion
etc...).

If your interested, send me a mail or come to #glade3 at irc.gnome.org

Cheers,
                                                     -Tristan



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