I branched Thomas Wood's GObject generator code the other day and started adding some desired features.
- Select a license including LGPL-2, GPL-2, MIT-X11, Apache 2.0, or no license
- Generate gtk-doc in-code documentation
- Generate and install GObject properties including proper switch casements for basic glib types
- Generate getter and setter methods for GObject properties
- Generate methods and include guards in the stubs (such as g_return_if_fail)
- Generate and install GObject signals including default handlers in the class VTable
- Write coding using a Dialect class which can be inherited for adding different code styling or output language
- Installable using pythons distutils
You can see some sample output as foo-person.c and foo-person.h.
git clone git://git.dronelabs.com/gobject-gen
cd gobject-gen
git checkout -b codewriter origin/codewriter





Comments (5)
Looking good, but wouldn’t it be better to have the cases in set_property call the setter functions to reduce code duplication. It would also be an idea to include the g_object_notify() calls in the setter functions.
Finally, you should use “FooPerson:name:” for GObject property documentation, rather than “FooPerson::name:”, which is for signals.
Ooops, thanks for the doc info. I like the notify idea as well.
The reason I didn’t do the calling of the get/set methods was due to them being optional. I guess I could remove that option and call them instead. Thoughts?
Fixed the documentation issue and added g_object_notify() to the setter. I think I’ll go ahead and remove the include getter/setter option tomorrow and use them to keep it DRY.
Dia (UML) integration would be nice.
I just committed support to generate python instead of C.