Libglade is a library that performs a similar job to the C source output routines in the GLADE user interface builder. Whereas GLADE's output routines create C source code that must be compiled, libglade builds the interface from an XML file (GLADE's save format) at runtime. This can allow modifying the user interface without recompiling.

Libglade can also automatically connect signal handlers in the user interface. It does this by matching handler names specified in the glade file with symbols in the executable looked up with the gmodule library (this requires that applications be linked with the --export-dynamic flag).

A minimal libglade program in C looks like this:

#include <gtk/gtk.h>
#include <glade/glade.h>

some_handler(GtkWidget *widget)
    /* a handler referenced by the glade file.  Must not be static
     * so that it appears in the global symbol table. */

main(int argc, char **argv)
    GladeXML *xml;
    GtkWidget *widget;

    gtk_init(&argc, &argv);
    xml = glade_xml_new("", NULL, NULL);

    /* get a widget (useful if you want to change something) */
    widget = glade_xml_get_widget(xml, "widgetname");

    /* connect signal handlers */


    return 0;

There are also Python bindings for libglade. This makes a nice rapid application development system. The Python equivalent of the above program is:

import gtk

def some_handler(widget):

xml ='')
widget = xml.get_widget('widgetname')
  'some_handler': some_handler


Libglade can be downloaded from or its mirrors:

| Home | Software | Talks | Articles | Fractals | Photos | Diary |
Copyright © 2005 — James Henstridge <>