Fix collaboration call_async

Port to Python 3 via Six aa8a5e7 did introduce a regression during
activity collaboration on both sharing and joining.

Fixes https://github.com/sugarlabs/sugar-toolkit-gtk3/issues/406
This commit is contained in:
James Cameron 2019-03-16 15:52:57 +11:00
parent 2453d13b03
commit 481e0bac80
2 changed files with 42 additions and 25 deletions

View File

@ -125,11 +125,7 @@ class Activity(GObject.GObject):
def _start_tracking_properties(self): def _start_tracking_properties(self):
bus = dbus.SessionBus() bus = dbus.SessionBus()
arg_dict = dict(reply_handler=self.__got_properties_cb,
error_handler=self.__error_handler_cb)
if six.PY2: if six.PY2:
arg_dict = arg_dict.update(utf8_strings=True)
self._get_properties_call = bus.call_async( self._get_properties_call = bus.call_async(
self.telepathy_conn.requested_bus_name, self.telepathy_conn.requested_bus_name,
self.telepathy_conn.object_path, self.telepathy_conn.object_path,
@ -137,7 +133,19 @@ class Activity(GObject.GObject):
'GetProperties', 'GetProperties',
'u', 'u',
(self.room_handle,), (self.room_handle,),
arg_dict) reply_handler=self.__got_properties_cb,
error_handler=self.__error_handler_cb,
utf8_strings=True)
else:
self._get_properties_call = bus.call_async(
self.telepathy_conn.requested_bus_name,
self.telepathy_conn.object_path,
CONN_INTERFACE_ACTIVITY_PROPERTIES,
'GetProperties',
'u',
(self.room_handle,),
reply_handler=self.__got_properties_cb,
error_handler=self.__error_handler_cb)
# As only one Activity instance is needed per activity process, # As only one Activity instance is needed per activity process,
# we can afford listening to ActivityPropertiesChanged like this. # we can afford listening to ActivityPropertiesChanged like this.

View File

@ -164,12 +164,7 @@ class Buddy(BaseBuddy):
dbus_interface=CONNECTION) dbus_interface=CONNECTION)
self.contact_handle = handles[0] self.contact_handle = handles[0]
arg_dict = dict(reply_handler=self.__got_properties_cb,
error_handler=self.__error_handler_cb,
byte_arrays = True)
if six.PY2: if six.PY2:
arg_dict = arg_dict.update(utf8_strings=True)
self._get_properties_call = bus.call_async( self._get_properties_call = bus.call_async(
connection_name, connection_name,
connection.object_path, connection.object_path,
@ -177,7 +172,21 @@ class Buddy(BaseBuddy):
'GetProperties', 'GetProperties',
'u', 'u',
(self.contact_handle,), (self.contact_handle,),
arg_dict) reply_handler=self.__got_properties_cb,
error_handler=self.__error_handler_cb,
utf8_strings=True,
byte_arrays=True)
else:
self._get_properties_call = bus.call_async(
connection_name,
connection.object_path,
CONN_INTERFACE_BUDDY_INFO,
'GetProperties',
'u',
(self.contact_handle,),
reply_handler=self.__got_properties_cb,
error_handler=self.__error_handler_cb,
byte_arrays=True)
self._get_attributes_call = bus.call_async( self._get_attributes_call = bus.call_async(
connection_name, connection_name,