25 Oct 2004 (updated 25 Oct 2004 at 23:58 UTC)
»
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.