2004-05-29 Seth Nickell <seth@gnome.org>
authorSeth Nickell <seth@gnome.org>
Sat, 29 May 2004 22:37:13 +0000 (22:37 +0000)
committerSeth Nickell <seth@gnome.org>
Sat, 29 May 2004 22:37:13 +0000 (22:37 +0000)
* python/dbus.py:
* python/examples/example-client.py:
* python/examples/example-service.py:
* python/examples/list-system-services.py:

Add SessionBus, SystemBus and ActivationBus classes
so you don't need to know the special little BUS_TYPE
flag.

ChangeLog
python/dbus.py
python/examples/example-client.py
python/examples/example-service.py
python/examples/list-system-services.py

index 448a5bf..d9207ac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-05-29  Seth Nickell  <seth@gnome.org>
+
+       * python/dbus.py:
+       * python/examples/example-client.py:
+       * python/examples/example-service.py:
+       * python/examples/list-system-services.py:
+
+       Add SessionBus, SystemBus and ActivationBus classes
+       so you don't need to know the special little BUS_TYPE
+       flag.
+       
 2004-05-29  Havoc Pennington  <hp@redhat.com>
 
        * bus/config-parser.c (process_test_valid_subdir): temporarily
index 883d9e6..583c554 100644 (file)
@@ -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.
index 0038b2d..c1393ec 100644 (file)
@@ -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")
index 79fb009..d146080 100644 (file)
@@ -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()
index 20b79d5..9769fc5 100644 (file)
@@ -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')