GObject generator for Emacs

Hi All,

I recently  had to create many classes and as everybody knows, writing classes with GObject is quite annoying.. it involves a lot of copy/paste and a lot of search&replace. So I’ve searched and I (actually my colleague, Olivier) found these GObject class helpers : http://www.emacswiki.org/emacs/GObjectClassHelpers

Those are some helpers functions for Emacs that automatically create the .c and .h files for you with all the GObject boilerplate. They were written by Gustavo Sverzut Barbieri and they do the job quite fine.

However, they are missing a few things, so I took the liberty of modifying the script to make them more complete and make them suit my needs.

Here is the changelog :

  • Added the option to include a Private structure to the class
  • Added a dummy property and the get/set functions
  • Added a dummy signal
  • Added a ‘constructed’ method
  • Added LGPL license header to generated .c and .h files
  • Reindent the whole files to match the user’s settings.

These additions (private structure, property, signals) are optional and the script asks you if you want them or not when it generates the code.

I thought that these changes would be useful to some people so I decided to share my script with the world. you can grab it here.

Have fun!


2 thoughts on “GObject generator for Emacs

  1. Nice one ! Emacs macros/scripts to make one type less is always great, and god knows it’s useful with GObject 🙂

    Nice to see the Private structure is properly used too, and the LGPL parts are really nifty.

  2. Thanks 🙂 Glad it’s useful 🙂

    It still needs some fixing for gstreamer though, like using GST_BOILERPLATE instead of G_DEFINE_TYPE, using ‘parent_class’ instead of ‘prefix_parent_class’, having the Class argument in the _init, etc..

Comments are closed.