25 Oct 2004 jdahlin   » (Master)

I wrote a small GConf directory wrapper using a type and GObject properties. Using this you can just select a gconf directory and then modify the properties using the standard set/get accessors from GObject:

>>> obj = watch_directory('/apps/metacity/general)
>>> obj.get_property('theme')
'Metabox'

notify:: if you want to get notification if any/some properties changes. In Python, all it takes to get notifications for a directory is this:

>>> def notify_cb(obj, pspec):
...   print obj, pspec.name, obj.get_property(pspec.name)
...
>>> obj.connect('notify', notify_cb)
As jamesh points out, I should probably separate the type creation and instantiation of the object, so it can be possible to point the type against a schema directory and instantiate over several different configuration directories.

The code can be found here, unfortunately it requires gconf from gnome-python CVS HEAD, due to some missing functions. If there is enough interest I might port this to C, because I think it would be useful to have it, in for example GConf itself.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!