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:
parent
7dedaeb7bb
commit
4fb2943ec4
@ -56,7 +56,7 @@ class SingleProcess(dbus.service.Object):
|
|||||||
object_path = get_single_process_path(name_service)
|
object_path = get_single_process_path(name_service)
|
||||||
dbus.service.Object.__init__(self, bus_name, object_path)
|
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):
|
def create(self, handle_dict):
|
||||||
handle = activityhandle.create_from_dict(handle_dict)
|
handle = activityhandle.create_from_dict(handle_dict)
|
||||||
create_activity_instance(self.constructor, handle)
|
create_activity_instance(self.constructor, handle)
|
||||||
@ -76,7 +76,7 @@ def main():
|
|||||||
action='store_true',
|
action='store_true',
|
||||||
help='start all the instances in the same process')
|
help='start all the instances in the same process')
|
||||||
parser.add_option('-i', '--invited', dest='invited',
|
parser.add_option('-i', '--invited', dest='invited',
|
||||||
action='store_true',
|
action='store_true', default=False,
|
||||||
help='the activity is being launched for handling an '
|
help='the activity is being launched for handling an '
|
||||||
'invite from the network')
|
'invite from the network')
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
@ -146,7 +146,8 @@ def main():
|
|||||||
SingleProcess(service_name, activity_constructor)
|
SingleProcess(service_name, activity_constructor)
|
||||||
else:
|
else:
|
||||||
single_process = sessionbus.get_object(service_name, service_path)
|
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
|
print 'Created %s in a single process.' % service_name
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
@ -42,6 +42,8 @@ _logger = logging.getLogger('sugar.presence.presenceservice')
|
|||||||
ACCOUNT_MANAGER_SERVICE = 'org.freedesktop.Telepathy.AccountManager'
|
ACCOUNT_MANAGER_SERVICE = 'org.freedesktop.Telepathy.AccountManager'
|
||||||
ACCOUNT_MANAGER_PATH = '/org/freedesktop/Telepathy/AccountManager'
|
ACCOUNT_MANAGER_PATH = '/org/freedesktop/Telepathy/AccountManager'
|
||||||
|
|
||||||
|
CONN_INTERFACE_ACTIVITY_PROPERTIES = 'org.laptop.Telepathy.ActivityProperties'
|
||||||
|
|
||||||
class PresenceService(gobject.GObject):
|
class PresenceService(gobject.GObject):
|
||||||
"""Provides simplified access to the Telepathy framework to activities"""
|
"""Provides simplified access to the Telepathy framework to activities"""
|
||||||
__gsignals__ = {
|
__gsignals__ = {
|
||||||
@ -80,7 +82,9 @@ class PresenceService(gobject.GObject):
|
|||||||
continue
|
continue
|
||||||
logging.debug("Calling GetActivity on %s", account_path)
|
logging.debug("Calling GetActivity on %s", account_path)
|
||||||
try:
|
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:
|
except dbus.exceptions.DBusException, e:
|
||||||
name = 'org.freedesktop.Telepathy.Error.NotAvailable'
|
name = 'org.freedesktop.Telepathy.Error.NotAvailable'
|
||||||
if e.get_dbus_name() == name:
|
if e.get_dbus_name() == name:
|
||||||
|
Loading…
Reference in New Issue
Block a user