Remove from EXTRA_DIST files we'd already be distributing
[dbus-python-phuang.git] / examples / gconf-proxy-service2.py
blob36a323a31000df7335d2fe3b9f6f25e284c1cc62
1 #!/usr/bin/env python
2 print "WARNING: this hasn't been updated to current API yet, and might not work"
3 #FIXME: doesn't work with the new bindings
4 import dbus
6 import gobject
7 import gconf
9 class GConfService(dbus.Service):
11 def __init__(self):
12 dbus.Service.__init__(self, "org.gnome.GConf", dbus.SessionBus())
14 gconf_object_tree = self.GConfObjectTree(self)
16 class GConfObjectTree(dbus.ObjectTree):
17 def __init__(self, service):
18 dbus.ObjectTree.__init__(self, "/org/gnome/GConf", service)
20 self.client = gconf.client_get_default()
22 def object_method_called(self, message, object_path, method_name, argument_list):
23 print ("Method %s called on GConf key %s" % (method_name, object_path))
25 if "getString" == method_name:
26 return self.client.get_string(object_path)
27 elif "setString" == method_name:
28 self.client.set_int(object_path, argument_list[0])
29 elif "getInt" == method_name:
30 return self.client.get_int(object_path)
31 elif "setInt" == method_name:
32 self.client.set_int(object_path, argument_list[0])
34 gconf_service = GConfService()
36 print ("GConf Proxy service started.")
37 print ("Run 'gconf-proxy-client.py' to fetch a GConf key through the proxy...")
39 mainloop = gobject.MainLoop()
40 mainloop.run()