diff options
author | Marco Pesenti Gritti <mpg@redhat.com> | 2007-08-31 09:37:42 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpg@redhat.com> | 2007-08-31 09:37:42 (GMT) |
commit | 560a914997d1a728ca4f972dba3b3847b2077569 (patch) | |
tree | 8f59c65c645acd6e55033afc3a6c958077217d0e /shell | |
parent | fbf995e71dc5c3da917197f567cd5512a5052a9e (diff) |
Make Activity update the presence service activity
name and listen to the name changes in the mesh view.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/model/MeshModel.py | 27 | ||||
-rw-r--r-- | shell/view/home/MeshBox.py | 10 |
2 files changed, 18 insertions, 19 deletions
diff --git a/shell/model/MeshModel.py b/shell/model/MeshModel.py index e326634..32e213a 100644 --- a/shell/model/MeshModel.py +++ b/shell/model/MeshModel.py @@ -26,24 +26,21 @@ from hardware import hardwaremanager from hardware import nmclient class ActivityModel: - def __init__(self, activity, activity_info): - self._activity = activity - self._activity_info = activity_info + def __init__(self, activity, bundle): + self.activity = activity + self.bundle = bundle def get_id(self): - return self._activity.props.id + return self.activity.props.id def get_icon_name(self): - return self._activity_info.icon + return self.bundle.icon def get_color(self): - return XoColor(self._activity.props.color) + return XoColor(self.activity.props.color) def get_service_name(self): - return self._activity_info.service_name - - def get_title(self): - return self._activity.props.name + return self.bundle.service_name class MeshModel(gobject.GObject): __gsignals__ = { @@ -203,12 +200,12 @@ class MeshModel(gobject.GObject): def _check_activity(self, presence_activity): registry = activity.get_registry() - activity_info = registry.get_activity(presence_activity.props.type) - if not activity_info: + bundle = registry.get_activity(presence_activity.props.type) + if not bundle: return if self.has_activity(presence_activity.props.id): return - self.add_activity(activity_info, presence_activity) + self.add_activity(bundle, presence_activity) def has_activity(self, activity_id): return self._activities.has_key(activity_id) @@ -219,8 +216,8 @@ class MeshModel(gobject.GObject): else: return None - def add_activity(self, activity_info, activity): - model = ActivityModel(activity, activity_info) + def add_activity(self, bundle, activity): + model = ActivityModel(activity, bundle) self._activities[model.get_id()] = model self.emit('activity-added', model) diff --git a/shell/view/home/MeshBox.py b/shell/view/home/MeshBox.py index 0760c3c..09eb869 100644 --- a/shell/view/home/MeshBox.py +++ b/shell/view/home/MeshBox.py @@ -181,13 +181,15 @@ class ActivityView(hippo.CanvasBox): self.set_layout(self._layout) self._icon = CanvasIcon(file_name=model.get_icon_name(), - xo_color=model.get_color(), box_width=80) + xo_color=model.get_color(), box_width=80) self._icon.connect('activated', self._clicked_cb) - self._icon.set_tooltip(self._model.get_title()) + self._icon.set_tooltip(self._model.activity.props.name) self._layout.add_center(self._icon) - def _update_name(self): - self.palette.set_primary_text(self._model.get_title()) + self._model.activity.connect('notify::name', self._name_changed_cb) + + def _name_changed_cb(self, activity, pspec): + self._icon.set_tooltip(activity.props.name) def has_buddy_icon(self, key): return self._icons.has_key(key) |