I needed a way to emit the
notify signal of one of my objects from another place, and Vala didn’t show me a straightforward way to do it. If you need it for some reason, here’s a code snippet showing you how:
There was a time when Vala was really popular, and a plethora of Vala apps spawned. A lot of them are dead right now, so since i don’t have time to revive any of them, i’ll publish this list of interesting projects in case someone is interested in bringing back one of them:
When you run to use that glorious composite templates in vala, please remember : you have to use a GResource. The syntax is not so hard, it looks like this:
<?xml version="1.0" encoding="UTF-8"?>
Which is pretty simple. Let’s say you called that file project.gresource.xml, so to include it, you do (at compile time)
valac --target-glib=2.38 --gresources project.gresource.xml --pkg your_package1 --pkg you_package2 ...
Of course, it can’t be that simple, so first you have to _compile_ that xml file (crazy, isn’t it?), doing
and then include the generated C file. As this won’t scale, and you probably aren’t compiling that way, the documentation suggest to include a make rule for this. So, our make rule should look like this:
project-gresource.c: project.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies project.gresource.xml)
and we can include the generated c file in our valac call:
valac --target-glib=2.38 --gresources project.gresource.xml --pkg your_package1 --pkg you_package2 file1.vala file2.vala project-gresource.c ...
Please don’t forget to read the announcement here for more info.