[Sugar-devel] [PATCH sugar 2/2] Listen on a IntroWindow done signal instead of blocking

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


From: Daniel Narvaez <dwnarvaez at gmail.com>

Creating multiple non-nested mainloops in gtk 3.6 breaks
at least accessibility.

See https://bugzilla.gnome.org/show_bug.cgi?id=685453
---
 bin/sugar-session          |   38 ++++++++++++++++++++++----------------
 src/jarabe/intro/window.py |    6 +++++-
 2 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/bin/sugar-session b/bin/sugar-session
index 5c72ff2..6d2435e 100755
--- a/bin/sugar-session
+++ b/bin/sugar-session
@@ -253,6 +253,22 @@ def set_theme():
     settings.set_property('gtk-theme-name', sugar_theme)
     settings.set_property('gtk-icon-theme-name', 'sugar')
 
+def start_home():
+    from jarabe.desktop import homewindow
+
+    start_ui_service()
+    start_session_manager()
+
+    # open homewindow before window_manager to let desktop appear fast
+    home_window = homewindow.get_instance()
+    home_window.show()
+
+    screen = Wnck.Screen.get_default()
+    screen.connect('window-manager-changed', __window_manager_changed_cb)
+    _check_for_window_manager(screen)
+
+def intro_window_done_cb(window):
+    start_home()
 
 def main():
     try:
@@ -275,7 +291,6 @@ def main():
     gettext.bindtextdomain('sugar-toolkit', config.locale_path)
     gettext.textdomain('sugar')
 
-    from jarabe.desktop import homewindow
     from jarabe.model import sound
     from jarabe import intro
     from jarabe.intro.window import IntroWindow
@@ -303,14 +318,6 @@ def main():
     if subprocess.call('echo $DISPLAY; xsetroot -cursor_name left_ptr', shell=True):
         logging.warning('Can not reset cursor')
 
-    if not intro.check_profile():
-        win = IntroWindow()
-        win.show_all()
-        Gtk.main()
-
-    start_ui_service()
-    start_session_manager()
-
     sound.restore()
 
     sys.path.append(config.ext_path)
@@ -318,13 +325,12 @@ def main():
     icons_path = os.path.join(config.data_path, 'icons')
     Gtk.IconTheme.get_default().append_search_path(icons_path)
 
-    # open homewindow before window_manager to let desktop appear fast
-    home_window = homewindow.get_instance()
-    home_window.show()
-
-    screen = Wnck.Screen.get_default()
-    screen.connect('window-manager-changed', __window_manager_changed_cb)
-    _check_for_window_manager(screen)
+    if not intro.check_profile():
+        win = IntroWindow()
+        win.connect("done", intro_window_done_cb)
+        win.show_all()
+    else:
+        start_home()
 
     try:
         Gtk.main()
diff --git a/src/jarabe/intro/window.py b/src/jarabe/intro/window.py
index 252870d..bebffe4 100644
--- a/src/jarabe/intro/window.py
+++ b/src/jarabe/intro/window.py
@@ -261,6 +261,10 @@ class _IntroBox(Gtk.VBox):
 class IntroWindow(Gtk.Window):
     __gtype_name__ = 'SugarIntroWindow'
 
+    __gsignals__ = {
+        'done': (GObject.SignalFlags.RUN_FIRST, None, ([])),
+    }
+    
     def __init__(self):
         Gtk.Window.__init__(self)
 
@@ -280,7 +284,7 @@ class IntroWindow(Gtk.Window):
 
     def _create_profile_cb(self, name, color):
         create_profile(name, color)
-        Gtk.main_quit()
+        self.emit("done")
 
         return False
 
-- 
1.7.10.2



More information about the Sugar-devel mailing list