Re: where did the _construct functions go?



On Wed, 1 Aug 2001, Oskar Liljeblad wrote:

> Some gtk_XYZ_construct functions in gtk 1.2.x have been removed
> from gtk 1.3.x. These functions allow classes to be instantiated
> by g_type_create_instance and then "constructed" with additional
> parameters with gtk_XYZ_construct. (See gtk_plug_construct.)

you're _not_ allowed to call g_type_create_instance() on any type
whatsoever, look at the header file, it's grouped together with a
couple of other functions under:
"/* --- protected (for fundamental type implementations) --- */"

do i need to change it's name to
g_type_create_instance_dont_call_this() in order for people to get it?

> E.g. if you have subclassed GtkButton, and want to use a stock
> image by default, you can't use gtk_button_new_from_stock because
> that would create a GtkButton instance. It would be necessary to
> do g_type_create_instance(MY_BUTTON_TYPE) then
> gtk_button_construct_from_stock. The latter function does not
> yet exist.
> 
> Would a patch against gtk 1.3/cvs that
> 
>   1. Added new functions gtk_XYZ_construct[_..] to all
>      classes with _new functions that do more than just
>      calling gtk_type_new/g_type_create_instance?
>   2. Updated those _new functions to use _construct instead.
> 
> be accepteped?

no, we could get rid of the _construct variants because you can
generically create all objects with g_object_new() or, for LBs,
with g_object_newv() now. if you want/need to, you can pass in
any construct properties in to these function.

> Date: Tue, 29 Aug 2000 05:14:46 +0200 (CEST)
> To: Gtk+ Developers <gtk-devel-list gnome org>
> Subject: Object Construction

gives the original rationale for this change.

> 
> Oskar Liljeblad (osk hem passagen se
> 

---
ciaoTJ






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