mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-22 16:00:10 +01:00
- added new type classes for hinting to the marashaler what type to send over the wire - added int16 and uint16 marshalers - Fixed a bug in the type constants that caused int32 to go out as uint16 over the wire * python/dbus.py: split up into different files and renamed _dbus.py * python/__init__.py, python/_util.py, python/decorators.py, python/exceptions.py, python/proxies.py, python/services.py, python/types.py: new files split off from dbus.py * python/Makefile.am: Add new files, remove dbus.py and install all python files to <python module dir>/dbus * python/examples/*: Added #!/usr/bin/env python to the top of every example. Patch provided by Tatavarty Kalyan
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
#!/usr/bin/env python
|
|
|
|
import dbus
|
|
|
|
import gtk
|
|
import gconf
|
|
|
|
class GConfService(dbus.Service):
|
|
|
|
def __init__(self):
|
|
dbus.Service.__init__(self, "org.gnome.GConf", dbus.SessionBus())
|
|
|
|
gconf_object_tree = self.GConfObjectTree(self)
|
|
|
|
class GConfObjectTree(dbus.ObjectTree):
|
|
def __init__(self, service):
|
|
dbus.ObjectTree.__init__(self, "/org/gnome/GConf", service, dbus_methods=[ self.getString, self.setString, self.getInt, self.setInt ])
|
|
|
|
self.client = gconf.client_get_default()
|
|
|
|
def getString(self, message, object_path):
|
|
print ("getString called on GConf key %s" % (object_path))
|
|
return self.client.get_string(object_path)
|
|
|
|
def setString(self, message, object_path, new_value):
|
|
print ("setString called on GConf key %s" % (object_path))
|
|
self.client.set_string(object_path, new_value)
|
|
|
|
def getInt(self, message, object_path):
|
|
print ("getInt called on GConf key %s" % (object_path))
|
|
return self.client.get_int(object_path)
|
|
|
|
def setInt(self, message, object_path, new_value):
|
|
print ("setInt called on GConf key %s" % (object_path))
|
|
self.client.set_int(object_path, new_value)
|
|
|
|
gconf_service = GConfService()
|
|
|
|
print ("GConf Proxy service started.")
|
|
print ("Run 'gconf-proxy-client.py' to fetch a GConf key through the proxy...")
|
|
|
|
gtk.main()
|