Re: GtkBin as a publicly derivable abstract class please.



On Fri, 2010-11-12 at 14:50 +0900, Tristan Van Berkom wrote:
> Guys, 
>    this is the kind of thing we could probably just
> resolve on irc but I work an opposite schedule so I'm
> taking it to the list.
> 
> Today I found '_gtk_bin_set_child()'
> 
> Making that a private api render's GtkBin completely
> useless as a subclassable container outside of GTK+.
> 
> But I beg to differ, GtkBin is definitely a useful
> abstract class to derive from.
> 
> Also I noticed that the implementation takes no
> reference to the child.
> 
> Please lets not make the mistake of gtk_widget_set_window()
> again, foo_class_set_bar() apis invariably take a ref
> to the object 'bar'... accept for the awkward case of
> gtk_widget_set_window().
> 
> My recommended course of action is that gtk_bin_set_child()
> should not directly make the reference but instead do so
> implicitly by way of gtk_widget_set_parent(), thus somewhat
> further reducing the workload of GtkBin subclasses.
> 
> It should return_if_fail() if (bin->child != NULL) as well.

You can simply chain up in GtkContainer:add(), I don't
think that new API is needed at all. It would probably
be even confusing and end up being used wrongly in
user code.

ciao,
--mitch




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