gir2glade is an XSL Transform for creating a glade catalog from a gobject-introspection gir file.
It can be used on any gir file with any XSLT processor.
gir2glade was written because I didn't want to have to maintain a glade catalog especially when all of the data is already in the gir files being built as part of my projects.
With it, you can add a build target to your build system that depends on your gir and have it create the catalog and install it into the proper place.
GPLv3
The following will create the glade catalog and output it to stdout.
xsltproc gir2glade.xsl GtkIM-0.0.gir
You can save it to a file with
xsltproc gir2glade.xsl GtkIM-0.0.gir > gtkim.xml
Then add the path you wrote it to to glade's catalog search path and you're set!
Below is a quick HOWTO, to generate the catalog with meson. You may need to
tweak the path of gir2glade.xsl
as it's assumed to be in the root of your
source directory.
This is spread a couple of files, but it can be found in the GtkIM source tree.
GLADEUI = dependency('gladeui-2.0', version: '>=3.0.0')
XSLTPROC = find_program('xsltproc', required : true)
GIR2GLADE = files('gir2glade.xsl')
gtkim_gir = gnome.generate_gir(gtkim,
sources : GTKIM_SOURCES + GTKIM_HEADERS +
GTKIM_PUBLIC_BUILT_SOURCES +
GTKIM_PUBLIC_BUILT_HEADERS,
includes : ['GModule-2.0', 'GObject-2.0', 'Gtk-3.0'],
namespace : 'GtkIM',
symbol_prefix : 'gtkim',
nsversion : '@0@.0'.format(GTKIM_MAJOR_VERSION),
install : true)
gtkim_glade_catalog = custom_target('gtkim.xml',
output : 'gtkim.xml',
input : [gtkim_gir[0], GIR2GLADE],
command : [XSLTPROC, '--output', '@OUTPUT@', '@INPUT1@', '@INPUT0@'],
install : true,
install_dir : GLADEUI.get_pkgconfig_variable('catalogdir'))