From: Seth Nickell Date: Sat, 29 May 2004 22:37:13 +0000 (+0000) Subject: 2004-05-29 Seth Nickell X-Git-Tag: dbus-0.22~57 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5d6113aaa0595a8eb7f3263c5679b2bd069f95ba;p=platform%2Fupstream%2Fdbus.git 2004-05-29 Seth Nickell * 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. --- diff --git a/ChangeLog b/ChangeLog index 448a5bf..d9207ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-05-29 Seth Nickell + + * 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 * bus/config-parser.c (process_test_valid_subdir): temporarily diff --git a/python/dbus.py b/python/dbus.py index 883d9e6..583c554 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 0038b2d..c1393ec 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 79fb009..d146080 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 20b79d5..9769fc5 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')