On Fri, 2009-08-14 at 03:07 +0200, Paweł Blokus wrote:
> 2009/8/12 Michael Drake <[email protected]>:
> > In article <[email protected]>,
> >   Pawe³ Blokus <[email protected]> wrote:
> >
> >> Since the last progress report I have completed the hotlist and added
> >> the sslcert window. I also removed all known bugs as well as
> >> unintuitive tree behaviour.
> >
> > John-Mark has a look at the way treeviews work.
> >
> > Right now, the implementation details of frontend treeview widgets need to
> > be exposed for all their clients to see.
> >
> > He suggests changing it so that the front end's treeview code creates an
> > empty tree.  This means that front end treeview widgets can be nicely
> > abstracted.
> >
> > Example: for cookies, you create a frontend treeview widget (which creates
> > a core treeview with the treeview callback vtable), can then you pass the
> > freshly created tree to cookies_initialise().
> >
> > This means that the frontend treeview implementation can be kept private.
> 
> OK, first I thought I understood everything. I've done what jmb told
> me on IRC, the front end code creates empty core trees and passed them
> to core-users.
> 
> Now I am not that sure anymore I know what is meant.Should I hide the
> gtk_treeview_window struct and add a creator function which would take
> most of its contents as parameters + getters for the necessary ones?
> Also, what do you want to get passed to the tree core-users the front
> end tree pointer or just the core one?

I can't think of a good reason why this API can't work:

struct nsgtk_treeview *nsgtk_treeview_create(void);
void nsgtk_treeview_destroy(struct nsgtk_treeview *tv);

struct tree *nsgtk_treeview_get_tree(struct nsgtk_treeview *tv);
GTKWidget *nsgtk_treeview_get_widget(struct nsgtk_treeview *tv);


Note that both the tree and the widget are owned by the nsgtk_treeview
object -- they should not be destroyed by anything else.


J.


Reply via email to