Re: GType/GObject questions

Reinhard Müller <reinhard mueller bitsmart com> writes:
> I have some questions regarding the new GType and GObject in glib 1.3.
> If somebody could answer them or point me to some documentation that
> contains the answer, it would be of great help for me.

I'll try, Tim is the expert though.

> When should I use g_type_register_static and when ..._dynamic?

Use _static for types that are compiled into your app and never
unregistered, and dynamic for plugins that may be unloaded.
> When should I use GTypeInfo.base_init/finalize and when class_init/finalize?

I believe this is the same as GtkObject and I explain it in my book,
but I don't remember the answer. I'm pretty sure that in the GtkObject chapter tells
you what base init does.

I do remember that base init is almost never useful.

> What should I put in GObjectClass.shutdown and what in ...finalize?

finalize should have everything, unless there's some special reason to
put it in shutdown. shutdown happens while the object is still fully
constructed, in the finalize method the object may be partially
destroyed (derived class data will be freed).

> When I assign function pointers to GObjectClass.shutdown of some derived
> object type, I probably want to call the "inherited" function of the parent object
> type. What is the recommended way to do that?

Save the parent class in a pointer in class_init, then refer to it;
see some GObjects from Pango or GTK for examples.
> And - sorry to ask that ;-) - is there a roadmap when glib 1.4 will
> be released?

It will be GLib 2.0, and most likely at the very start of next year,
latest estimate. Past estimates have been incorrect however.

> And will that have signal handing like gtk_signal_* included?



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