[Pkg-sugar-commit] [sugar-toolkit] 02/05: Make sure the datastore entry is created in time OLPC #10755

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 0269f819761cfd803cf4d694298c8ab6a753e242
Author: Simon Schampijer <simon at schampijer.de>
Date:   Sun Jul 24 15:16:40 2011 +0200

    Make sure the datastore entry is created in time OLPC #10755
    
    To avoid that we try to access the datastore entry before
    it has been created we need to move the creation code up,
    before we do get the possible information from a shared
    session. If we have a shared session we do then get the
    title and icon-color information from it and adjust
    accordingly.
    
    Tested that no other operation like for example resuming
    has issues with that change.
    
    Signed-off-by: Simon Schampijer <simon at laptop.org>
    Acked-By: Sascha Silbe <silbe at activitycentral.com>
---
 src/sugar/activity/activity.py | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index 443799a..53e6062 100644
--- a/src/sugar/activity/activity.py
+++ b/src/sugar/activity/activity.py
@@ -309,7 +309,6 @@ class Activity(Window, gtk.Container):
 
         if handle.object_id:
             self._jobject = datastore.get(handle.object_id)
-            self.set_title(self._jobject.metadata['title'])
 
             if 'share-scope' in self._jobject.metadata:
                 share_scope = self._jobject.metadata['share-scope']
@@ -317,6 +316,10 @@ class Activity(Window, gtk.Container):
         self.shared_activity = None
         self._join_id = None
 
+        if handle.object_id is None and create_jobject:
+            logging.debug('Creating a jobject.')
+            self._jobject = self._initialize_journal_object()
+
         if handle.invited:
             wait_loop = gobject.MainLoop()
             self._client_handler = _ClientHandler(
@@ -332,21 +335,16 @@ class Activity(Window, gtk.Container):
                                                   warn_if_none=False)
             self._set_up_sharing(mesh_instance, share_scope)
 
-        if handle.object_id is None and create_jobject:
-            logging.debug('Creating a jobject.')
-            self._jobject = self._initialize_journal_object()
-            self.set_title(self._jobject.metadata['title'])
+        if self.shared_activity is not None:
+            self._jobject.metadata['title'] = self.shared_activity.props.name
+            self._jobject.metadata['icon-color'] = \
+                self.shared_activity.props.color
+        self.set_title(self._jobject.metadata['title'])
 
     def _initialize_journal_object(self):
         title = _('%s Activity') % get_bundle_name()
-        if self.shared_activity and self.shared_activity.props.name != title:
-            title = self.shared_activity.props.name
-
-        if self.shared_activity is not None:
-            icon_color = self.shared_activity.props.color
-        else:
-            client = gconf.client_get_default()
-            icon_color = client.get_string('/desktop/sugar/user/color')
+        client = gconf.client_get_default()
+        icon_color = client.get_string('/desktop/sugar/user/color')
 
         jobject = datastore.create()
         jobject.metadata['title'] = 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