[Glade-devel] Glade and GObject introspection
- From: nathanr at nathanr.net (Nathan Robertson)
- Subject: [Glade-devel] Glade and GObject introspection
- Date: Tue, 26 Feb 2008 06:48:17 -0600
Hi,
I've been looking at the Glade source code for the last few days, as I'm
trying to get GObject introspection working, and I knew that Glade would be
a good example to look at for how to do this. Basically, in Java I would do:
Class sc = Class.forName("java.lang.String").getSuperclass();
System.out.println("Superclass is: " + sc.getName());
After a bit of reading the documentation and GTK+, libglade and Glade source
code I've so far come up with:
GType button_type, parent_type;
gtk_init(&argc, &argv);
button_type = g_type_from_name("GtkButton");
parent_type = g_type_parent(button_type);
printf("%s, %s\n", g_type_name(button_type), g_type_name(parent_type));
Now, I'm guessing that Glade reads in gtk+.xml, and looks up the name=""
types for each of the <glade-widget-class> entries, and then looks up the
GType from the name. However, the above code returns NULL on line 3 unless I
put before it:
button_type = GTK_TYPE_BUTTON;
So obviously I'm missing some initialization that reads in all the types,
which is what the documentation for g_type_from_name() hints at.
My question is what is this missing initialization code? I've been looking
through the Glade source code and must have missed it, and I'd appreciate
if someone could point me in the direction of the code that implements it in
Glade.
Many thanks,
Nathan.
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]