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.
This commit is contained in:
Tomeu Vizoso 2010-10-05 16:36:13 +02:00
parent 7dedaeb7bb
commit 4fb2943ec4
2 changed files with 9 additions and 4 deletions

View File

@ -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)

View File

@ -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: