Re: g_type_from_name("GtkWindow") returns 0



On Fri, 2007-12-07 at 01:03 +0100, ole nielsby pils org wrote:
> What is wrong with this snippet? Isn't gtk_init supposed to set up
> the type info?
> ...
> I can create a window object with gtk_window_new()
> and G_OBJECT_TYPE_NAME(w) returns "GtkWindow" ...
> but I need creation based on the name.
> I tried to call g_type_init() before gtk_init() but
> this did not help.

Types are registered on first use; there's no "big list" of GTK+ types
that gets registered at gtk_init.  To force type registration, use e.g.:

  volatile GType gtk_type_window = GTK_TYPE_WINDOW;

Ed



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