Converting

This howto covers the conversion from .glade files to bond.

Converting Bond 0.4x glade files

Bond 0.4x programs use an old glade format as the user interface so this is a two step process:

  1. libglade-convert is a perl script that comes with glade2 to convert from glade1 to glade2. Be aware that this generally breaks lists (treeview), so a little hand tweaking is involved after conversion (error messages will appear if there were problems). Usage:

    libglade-convert [--no-upgrade] [--verbose] oldfile.glade

    This will print to standard output. Otherwise output to file like this:

    libglade-convert oldfile.glade >newfile.glade
  2. glade2bond.xsl (in the bond/glade2bond directory) is a stylesheet to convert from glade2 to bond (2.0) XML files. In later versions of bond there won't need to be this conversion process but for now we use xsltproc to process the stylesheet:

    xsltproc [options] stylesheet file [file...]

    Note: the option --novalid is required otherwise the output will be unusable (not sure why yet...)

    Generally this is the command line:

    xsltproc --novalid glade2bond.xsl newfile.glade >bondfile.xml

This will output the bond file which can then be hand edited and run using bond.

Converting glade-2.0 Files

Just run step 2. above. Alternatively there's a little script (in the bond/glade2bond directory) called glade2bond which will do the same as above. The command line is:

glade2bond newfile.glade >bondfile.xml

glade2bond has an option, --auto-tags to insert an attribute-value pair: auto-gen="true" for each element. Used to distinguish elements automatically generated from a glade file from ones hand-coded.

Converting Pre-release Bond Files

Some preliminary releases of Bond Version 2 had differences to the current document type definition, mainly on the uigtk side, where options were expressed as elements. As of Bond v2.0 the DTD, bond-2.0.dtd has these options as attributes. To aid in the conversion of these files, a stylesheet element2attr.xsl (in the bond/glade2bond directory) can be run on the bond xml file to get the format up to date. Take a look at it and if there are any elements you would like to convert to attributes state them in the file.

Run similar to step 2. above:

xsltproc --novalid element2attr.xsl prebond2.xml >newbond.xml

Note: This stylesheet is generic and can be used to change any elements to attributes in any XML format.