Re: [gtk-list] gtk-- wrappers



Havoc Pennington <rhpennin@midway.uchicago.edu> writes:

> - The constructors often need to do what the _new function would do 
>   but they can't call _new, sometimes resulting in a hideous
>   cut-and-paste. I noticed that some Gtk widgets have a _construct
>   method for this reason, e.g. CList. Is this considered a good solution, 
>   i.e. would it be reasonable to add _construct functions to gnome-libs
>   when appropriate?

(Just to add my 2 bits to Tero's answer on this)

Yes, this is necessary. Basically, gtk-- widgets have their own gtk
type. So, we can't call the gtk_*_new() functions, because they all
call gtk_type_new() with the "wrong type" (the original gtk one, which
we don't want).

Therefore, any initialization which is done in a gtk_*_new() has to be
duplicated. Or, as was done with GtkCList and GtkScrolledWindow, we
put all object init stuff in that seperate _construct() function.

So, it boils down to having _new() functions which would only call
gtk_type_new() and gtk_*_construct().

-- 
					Guillaume.
					http://www.worldnet.fr/~glaurent



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