[Pkg-sugar-commit] [sugar-toolkit] 03/05: Update window title when the activity title changes - OLPC #10978

Jonas Smedegaard dr at jones.dk
Thu Apr 16 18:52:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag v0.92.4
in repository sugar-toolkit.

commit f0ebdd7f48619f08631de81c604206fe4565921f
Author: Simon Schampijer <simon at schampijer.de>
Date:   Sun Jul 24 18:42:48 2011 +0200

    Update window title when the activity title changes - OLPC #10978
    
    The patch updates the window title when the user changes
    the title in the toolbar or in the Journal.
    
    Signed-of-by: Gonzalo Odiard <gonzalo at laptop.org>
    Acked-By: Simon Schampijer <simon at laptop.org>
---
 src/sugar/activity/activity.py | 7 +++++++
 src/sugar/activity/widgets.py  | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index 53e6062..fce1a12 100644
--- a/src/sugar/activity/activity.py
+++ b/src/sugar/activity/activity.py
@@ -340,6 +340,8 @@ class Activity(Window, gtk.Container):
             self._jobject.metadata['icon-color'] = \
                 self.shared_activity.props.color
         self.set_title(self._jobject.metadata['title'])
+        self._jobject.metadata.connect('updated',
+                                       self.__jobject_updated_cb)
 
     def _initialize_journal_object(self):
         title = _('%s Activity') % get_bundle_name()
@@ -364,6 +366,11 @@ class Activity(Window, gtk.Container):
 
         return jobject
 
+    def __jobject_updated_cb(self, jobject):
+        if self.get_title() == jobject['title']:
+            return
+        self.set_title(jobject['title'])
+
     def _set_up_sharing(self, mesh_instance, share_scope):
         # handle activity share/join
         logging.debug('*** Act %s, mesh instance %r, scope %s',
diff --git a/src/sugar/activity/widgets.py b/src/sugar/activity/widgets.py
index e7a47cb..9503d36 100644
--- a/src/sugar/activity/widgets.py
+++ b/src/sugar/activity/widgets.py
@@ -224,6 +224,8 @@ class TitleEntry(gtk.ToolItem):
         activity.metadata['title_set_by_user'] = '1'
         activity.save()
 
+        activity.set_title(title)
+
         shared_activity = activity.get_shared_activity()
         if shared_activity is not None:
             shared_activity.props.name = title

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-toolkit.git



More information about the pkg-sugar-commit mailing list