summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/dbus.py19
-rw-r--r--python/examples/example-client.py2
-rw-r--r--python/examples/example-service.py4
-rw-r--r--python/examples/list-system-services.py2
4 files changed, 23 insertions, 4 deletions
diff --git a/python/dbus.py b/python/dbus.py
index 883d9e66..583c5548 100644
--- a/python/dbus.py
+++ b/python/dbus.py
@@ -117,6 +117,25 @@ class Bus:
for receiver in receivers:
receiver(*args)
+class SystemBus(Bus):
+ """The system-wide message bus
+ """
+ def __init__(self):
+ Bus.__init__(self, Bus.TYPE_SYSTEM)
+
+class SessionBus(Bus):
+ """The session (current login) message bus
+ """
+ def __init__(self):
+ Bus.__init__(self, Bus.TYPE_SESSION)
+
+class ActivationBus(Bus):
+ """The bus that activated this process (if
+ this process was launched by DBus activation)
+ """
+ def __init__(self):
+ Bus.__init__(self, Bus.TYPE_ACTIVATION)
+
class RemoteObject:
"""A remote Object.
diff --git a/python/examples/example-client.py b/python/examples/example-client.py
index 0038b2db..c1393ecc 100644
--- a/python/examples/example-client.py
+++ b/python/examples/example-client.py
@@ -2,7 +2,7 @@
import dbus
-bus = dbus.Bus()
+bus = dbus.SessionBus()
remote_service = bus.get_service("org.designfu.SampleService")
remote_object = remote_service.get_object("/SomeObject",
"org.designfu.SampleInterface")
diff --git a/python/examples/example-service.py b/python/examples/example-service.py
index 79fb009d..d1460802 100644
--- a/python/examples/example-service.py
+++ b/python/examples/example-service.py
@@ -11,8 +11,8 @@ class SomeObject(dbus.Object):
print (hello_message)
return "Hello from example-service.py"
-
-service = dbus.Service("org.designfu.SampleService")
+session_bus = dbus.SessionBus()
+service = dbus.Service("org.designfu.SampleService", bus=session_bus)
object = SomeObject(service)
gtk.main()
diff --git a/python/examples/list-system-services.py b/python/examples/list-system-services.py
index 20b79d59..9769fc5a 100644
--- a/python/examples/list-system-services.py
+++ b/python/examples/list-system-services.py
@@ -3,7 +3,7 @@
import dbus
# Get a connection to the SYSTEM bus
-bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM)
+bus = dbus.SystemBus()
# Get the service provided by the dbus-daemon named org.freedesktop.DBus
dbus_service = bus.get_service('org.freedesktop.DBus')