diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-09-10 16:52:01 (GMT) |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-09-10 16:52:01 (GMT) |
commit | 00a92091538fda9e773861e95a58be5a13bb57ec (patch) | |
tree | 8fb3ec2d852d91e9a941c935eaa51ad186c665ab | |
parent | 9f57dc4cc6d253fedeca492d590e5ffbc810a249 (diff) |
Set current activity when sharing or joining an activity. Echo this change to local processes too. Don't crash if a buddy property is None.
-rw-r--r-- | src/activity.py | 3 | ||||
-rw-r--r-- | src/buddy.py | 14 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/activity.py b/src/activity.py index c5f951c..ff2d36a 100644 --- a/src/activity.py +++ b/src/activity.py @@ -720,8 +720,7 @@ class Activity(ExportedGObject): if self._join_is_sharing: self.send_properties() self._ps.owner.add_activity(self) - else: - self._ps.owner.set_properties({'current-activity': self.props.id}) + self._ps.owner.set_properties({'current-activity': self.props.id}) self._join_cb() _logger.debug("%s of activity %s succeeded" % (verb, self._id)) except Exception, e: diff --git a/src/buddy.py b/src/buddy.py index 0552fdf..679138a 100644 --- a/src/buddy.py +++ b/src/buddy.py @@ -508,25 +508,25 @@ class Buddy(ExportedGObject): nick = unicode(nick) if nick != self._nick: self._nick = nick - changed_props[_PROP_NICK] = nick + changed_props[_PROP_NICK] = nick or u'' changed = True if _PROP_COLOR in properties: color = properties[_PROP_COLOR] if color != self._color: self._color = color - changed_props[_PROP_COLOR] = color + changed_props[_PROP_COLOR] = color or '' changed = True if _PROP_CURACT in properties: curact = properties[_PROP_CURACT] if curact != self._current_activity: self._current_activity = curact - changed_props[_PROP_CURACT] = curact + changed_props[_PROP_CURACT] = curact or '' changed = True if _PROP_IP4_ADDRESS in properties: ip4addr = properties[_PROP_IP4_ADDRESS] if ip4addr != self._ip4_address: self._ip4_address = ip4addr - changed_props[_PROP_IP4_ADDRESS] = ip4addr + changed_props[_PROP_IP4_ADDRESS] = ip4addr or '' changed = True if _PROP_KEY in properties: # don't allow key to be set more than once @@ -534,7 +534,7 @@ class Buddy(ExportedGObject): key = properties[_PROP_KEY] if key is not None: self._key = key - changed_props[_PROP_KEY] = key + changed_props[_PROP_KEY] = key or '' changed = True if not changed or not changed_props: @@ -680,7 +680,8 @@ class GenericOwner(Buddy): del id_to_act[activity_id] self._set_self_activities(tp) - self.set_properties({_PROP_CURACT: None}) + if self._current_activity == activity_id: + self.set_properties({_PROP_CURACT: None}) def _set_self_activities(self, tp): """Forward set of joined activities to network @@ -728,6 +729,7 @@ class GenericOwner(Buddy): 'set current activity' % conn.object_path) return + self.PropertyChanged({_PROP_CURACT: self._current_activity or ''}) conn[CONN_INTERFACE_BUDDY_INFO].SetCurrentActivity(cur_activity, cur_activity_handle, reply_handler=_noop, |