Il giorno Sun, 13 May 2012 10:37:16 +0200
Marc Balmer <m...@msys.ch> ha scritto:

> I have a (hopefully) basic question.  g_type_from_name() does not behave
> as I would it expect to behave:
> 
> When I call it with e.g. "GtkButton", I get GTK_TYPE_BUTTON.  But when I
> call it with "GtkFrame", it returns 0 (no such type found).
> 
> To add to my confusion, when I call "printf("%s\n",
> g_type_name(GTK_TYPE_FRAME)" before calling g_type_from_name(), it
> returns "GtkFrame" (as expected) and the following call to
> g_type_from_name() succeeds as well.
> 
> I am obviously missing sth here, or making a stupid mistake, so any
> pointers would be greatly appreciated.

GTK_TYPE_... macros are really a shorthand for gtk_..._get_type() calls
that register that given type. If you don't register the type,
g_type_from_name() should not return it (and in fact your snippet
returns to me that neither GtkButton or GtkFrame are defined).

If g_type_from_name("GtkButton") is non 0, you have GTK_TYPE_BUTTON or
something equivalent before it.

Ciao.
-- 
Nicola
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to