7. April 2009
Some instructions here because the porting guide in the Gtk+ docs is quite short at the moment:
Convert the files
gtk_builder_convert <old_glade_file> <new_gtkbuilder_file>
- Remove #include <glade/glade.h>
- GladeXML* => GtkBuilder*
- glade_xml_new (FILE, “first_widget”, NULL) becomes
GError* error = NULL;
GtkBuilder* builder = gtk_builder_new();
if (!gtk_builder_add_from_file (builder, FILE, &error)
g_warning ("Couldn't load builder file: %s", error->message);
- glade_xml_get_widget (gxml, “widget_name”) becomes GTK_WIDGET (gtk_builder_get_object (builder, “widget_name”))
- glade_get_widget_name (widget) can be replaced by gtk_widget_get_name(widget)
- glade_xml_get_widget_prefix (gxml, “prefix”) can be emulated by gtk_builder_get_objects(builder) together with manual filtering. It returns a GSList* instead of a GList* though.
That’s it basically. Don’t forget to adjust your Makefile.am to install the correct files and update POTFILES.in!