[Sugar-devel] [PATCH sugar 1/2] Move IntroWindow creation to sugar-session

Daniel Narvaez dwnarvaez at gmail.com
Tue Nov 6 07:43:03 EST 2012


From: Daniel Narvaez <dwnarvaez at gmail.com>

It avoids the unexpected side effect (showing the intro UI
implicityly when we are just checking the profile existence).

It also prepares for listening to an IntroWindow done signal
instead of blocking in a mainloop.
---
 bin/sugar-session            |    7 ++++++-
 src/jarabe/intro/__init__.py |    8 +-------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/bin/sugar-session b/bin/sugar-session
index 23f88a1..5c72ff2 100755
--- a/bin/sugar-session
+++ b/bin/sugar-session
@@ -278,6 +278,7 @@ def main():
     from jarabe.desktop import homewindow
     from jarabe.model import sound
     from jarabe import intro
+    from jarabe.intro.window import IntroWindow
 
     logger.start('shell')
 
@@ -301,7 +302,11 @@ def main():
     # TODO #3204
     if subprocess.call('echo $DISPLAY; xsetroot -cursor_name left_ptr', shell=True):
         logging.warning('Can not reset cursor')
-    intro.check_profile()
+
+    if not intro.check_profile():
+        win = IntroWindow()
+        win.show_all()
+        Gtk.main()
 
     start_ui_service()
     start_session_manager()
diff --git a/src/jarabe/intro/__init__.py b/src/jarabe/intro/__init__.py
index d2e9276..0045c74 100644
--- a/src/jarabe/intro/__init__.py
+++ b/src/jarabe/intro/__init__.py
@@ -1,11 +1,8 @@
 import os
 
-from gi.repository import Gtk
-
 from sugar3 import env
 from sugar3.profile import get_profile
 
-from jarabe.intro.window import IntroWindow
 from jarabe.intro.window import create_profile
 
 
@@ -20,7 +17,4 @@ def check_profile():
     if os.path.exists(path):
         profile.convert_profile()
 
-    if not profile.is_valid():
-        win = IntroWindow()
-        win.show_all()
-        Gtk.main()
+    return profile.is_valid()
-- 
1.7.10.2



More information about the Sugar-devel mailing list