diff --git a/shell/model/MeshModel.py b/shell/model/MeshModel.py index e326634d..32e213aa 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 0760c3c7..09eb8693 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) diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index 85f660c6..3691a5ec 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -137,9 +137,16 @@ class ActivityToolbar(gtk.Toolbar): self._update_title_sid = gobject.timeout_add(1000, self._update_title_cb) def _update_title_cb(self): - self._activity.metadata['title'] = self.title.get_text() + title = self.title.get_text() + + self._activity.metadata['title'] = title self._activity.metadata['title_set_by_user'] = '1' self._activity.save() + + shared_activity = self._activity._shared_activity + if shared_activity: + shared_activity.props.name = title + self._update_title_sid = None return False @@ -499,6 +506,9 @@ class Activity(Window, gtk.Container): logging.debug('Share of activity %s failed: %s.' % (self._activity_id, err)) return logging.debug('Share of activity %s successful.' % self._activity_id) + + activity.props.name = self._jobject.metadata['title'] + self._shared_activity = activity self.emit('shared') if self._jobject: