A library for constructing UIs from XML descriptions



A couple of days ago, there was a discussion about user interface
descriptions in XML.  I said that I was working on a library to do that
with the GLADE XML save format, and now I have a working version.

It can be found at
ftp://ftp.daa.com.au/pub/james/gnome/libglade-0.0.1.tar.gz, and requires
gnome-xml and gtk+.  It currently only does the GTK+ widgets (and that is
all glade supports at the moment), but has hooks for adding new widgets.

The interface is quite simple.  You first create a GladeXML object with
the glade_xml_new(xmlfile, rootnode) function.  This will build the
interface described in the given file.  The second argument (if not
NULL) specifies a different base widget to build from, so you can build 
a subset of the interface.  You can get a widget by name with
glade_xml_get_widget, and can connect functions to the signal handlers
described in the XML file.

There is also some code that attempts to automatically connect all the
signals in a program for you.  This requires a working copy of the gmodule
library.  To do this, just call glade_xml_signal_autoconnect(xml) on a
GladeXML object.

The test program (test-libglade) takes an XML file as an argument, and
displays it.  If you look at the source, you will see that it is quite
short.  You can try this on just about any interface created with GLADE.
The example .glade file provided show some of the tricks that can be done
without any extra code.

Just out of interest, would it be appropriate to put this in CVS?

James Henstridge.

--
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/




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