For me, create GTK+ custom widgets is a very common task. Using templates for them, too.
Use GTK+ widgets defined by UI XML files, may be created by Glade, is a powerful feature.
Once you create your UI file, you should add it to a gresource XML file too, in order to use glib-compile-resources
to compile an embed, if you wish, in your binaries.
Once your project is big enough, you may fall in a large gresource XML file. Regenerate compiled resources based on resources changes, can be tricky, and a hand work.
So I’ve created gresg
, a tool to generate automatically an XML gresource file based in a list of files to be compiled with glib-compile-resources
. This will help you to trigger a rebuild of compiled resources at any time you make changes in your files.
gresg
, is written in Vala and uses GXml to generate XML resources files. As you can see in gresg’s repository, is a very small program.
If you are using Meson you can create a custom target to generate your XML resources, but you need this patch applied to Vala to take all its advantages and automatic re-build of resources.