From 4fb2943ec4564c5a007de993ab9ff13a8daa3e23 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Tue, 5 Oct 2010 16:36:13 +0200 Subject: [PATCH] Fix running multiple instances of Browse by adapting to API changes #2404 * sugar/presence/presenceservice.py: Specify the D-Bus interface when calling ActivityProperties.GetActivity * sugar/activity/main.py: Set a default for the --invite option and make the create() D-Bus method accept a{sv} so we can pass the boolean value. --- src/sugar/activity/main.py | 7 ++++--- src/sugar/presence/presenceservice.py | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/sugar/activity/main.py b/src/sugar/activity/main.py index 3a3950d3..c04257a0 100644 --- a/src/sugar/activity/main.py +++ b/src/sugar/activity/main.py @@ -56,7 +56,7 @@ class SingleProcess(dbus.service.Object): object_path = get_single_process_path(name_service) dbus.service.Object.__init__(self, bus_name, object_path) - @dbus.service.method("org.laptop.SingleProcess", in_signature="a{ss}") + @dbus.service.method("org.laptop.SingleProcess", in_signature="a{sv}") def create(self, handle_dict): handle = activityhandle.create_from_dict(handle_dict) create_activity_instance(self.constructor, handle) @@ -76,7 +76,7 @@ def main(): action='store_true', help='start all the instances in the same process') parser.add_option('-i', '--invited', dest='invited', - action='store_true', + action='store_true', default=False, help='the activity is being launched for handling an ' 'invite from the network') (options, args) = parser.parse_args() @@ -146,7 +146,8 @@ def main(): SingleProcess(service_name, activity_constructor) else: single_process = sessionbus.get_object(service_name, service_path) - single_process.create(activity_handle.get_dict()) + single_process.create(activity_handle.get_dict(), + dbus_interface='org.laptop.SingleProcess') print 'Created %s in a single process.' % service_name sys.exit(0) diff --git a/src/sugar/presence/presenceservice.py b/src/sugar/presence/presenceservice.py index 862d6d01..51d8625b 100644 --- a/src/sugar/presence/presenceservice.py +++ b/src/sugar/presence/presenceservice.py @@ -42,6 +42,8 @@ _logger = logging.getLogger('sugar.presence.presenceservice') ACCOUNT_MANAGER_SERVICE = 'org.freedesktop.Telepathy.AccountManager' ACCOUNT_MANAGER_PATH = '/org/freedesktop/Telepathy/AccountManager' +CONN_INTERFACE_ACTIVITY_PROPERTIES = 'org.laptop.Telepathy.ActivityProperties' + class PresenceService(gobject.GObject): """Provides simplified access to the Telepathy framework to activities""" __gsignals__ = { @@ -80,7 +82,9 @@ class PresenceService(gobject.GObject): continue logging.debug("Calling GetActivity on %s", account_path) try: - room_handle = connection.connection.GetActivity(activity_id) + room_handle = connection.connection.GetActivity( + activity_id, + dbus_interface=CONN_INTERFACE_ACTIVITY_PROPERTIES) except dbus.exceptions.DBusException, e: name = 'org.freedesktop.Telepathy.Error.NotAvailable' if e.get_dbus_name() == name: