g_type_from_name("GtkWindow") returns 0

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

 



What is wrong with this snippet? Isn't gtk_init supposed to set up
the type info?

#include <stdlib.h>
#include <gtk/gtk.h>
/* ... */
int main (int argc, char *argv[]){
/* Initialize GTK+ */
  g_log_set_handler(
    "Gtk", G_LOG_LEVEL_WARNING,
    (GLogFunc) gtk_false, NULL);
  gtk_init (&argc, &argv);
  g_log_set_handler(
    "Gtk", G_LOG_LEVEL_WARNING,
    g_log_default_handler, NULL);
    GType XYZ = g_type_from_name("GtkWindow");

/* ... XYZ = 0 here - why???? */

	/*A dialog is created here, this works OK*/
	/*...*/
}

I'm using the vs-gimp VC9 version.

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.

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux