def _share_cb(self, button): if not self._setup_has_been_called: return properties = {} properties['id'] = self._get_activity_id() properties['type'] = self._get_bundle_id() properties['name'] = self._get_title() properties['color'] = self.get_colors() properties['private'] = False connection_manager = get_connection_manager() account_path, connection = \ connection_manager.get_preferred_connection() if connection is None: print('No active connection available') return try: self._parent.shared_activity = Activity(account_path, connection, properties=properties) # FIXME: this should be unified, no need to keep 2 references self.shared_activity = self._parent.shared_activity except BaseException: traceback.print_exc(file=sys.stdout) if self._parent._shared_parent.props.joined: raise RuntimeError('Activity %s is already shared.' % self._parent._get_activity_id()) self._parent._shared_parent.share(self.__share_activity_cb, self.__share_activity_error_cb)
def _join_activity_cb(self, widget, activity): print('Lets try to join...') connection_manager = get_connection_manager() account_path, connection = \ connection_manager.get_preferred_connection() if connection is None: print('No active connection available') return properties = {} properties['id'] = activity.activity_id properties['color'] = activity.get_color() print('room handle according to activity %s' % activity.room_handle) properties['private'] = True try: room_handle = connection.GetActivity( activity.activity_id, dbus_interface=CONNECTION_INTERFACE_ACTIVITY_PROPERTIES) print('room_handle = %s' % str(room_handle)) self._joined_activity = Activity( account_path, connection, room_handle, properties=properties) # FIXME: this should be unified, no need to keep 2 references self.shared_activity = self._joined_activity except BaseException: traceback.print_exc(file=sys.stdout) if self._joined_activity.props.joined: raise RuntimeError('Activity %s is already shared.' % activity.activity_id) self._joined_activity.connect('joined', self.__joined_cb) self._joined_activity.join()