[Sugar-devel] [PATCH sugar 14/20] Don't run trivial initializations on idle

Daniel Narvaez dwnarvaez at gmail.com
Mon Dec 10 14:11:40 EST 2012


From: Daniel Narvaez <dwnarvaez at gmail.com>

They shouldn't really take any noticable time and they
makes the code a mess.
---
 src/jarabe/main.py |   49 ++++++++++++-------------------------------------
 1 file changed, 12 insertions(+), 37 deletions(-)

diff --git a/src/jarabe/main.py b/src/jarabe/main.py
index d1b1fc3..9b3417f 100755
--- a/src/jarabe/main.py
+++ b/src/jarabe/main.py
@@ -67,38 +67,12 @@ from jarabe.intro.window import IntroWindow
 from jarabe import frame
 from jarabe.view.service import UIService
 
-def setup_frame_cb():
-    logging.debug('STARTUP: setup_frame_cb')
-    frame.get_view()
-
-def setup_keyhandler_cb():
-    logging.debug('STARTUP: setup_keyhandler_cb')
-    keyhandler.setup(frame.get_view())
-
-def setup_gesturehandler_cb():
-    logging.debug('STARTUP: setup_gesturehandler_cb')
-    gesturehandler.setup(frame.get_view())
-
-def setup_cursortracker_cb():
-    logging.debug('STARTUP: setup_cursortracker_cb')
-    cursortracker.setup()
-
-def setup_journal_cb():
-    logging.debug('STARTUP: setup_journal_cb')
-    journalactivity.start()
-
-def show_software_updates_cb():
-    logging.debug('STARTUP: show_software_updates_cb')
+def check_software_updates():
+    logging.debug('STARTUP: check_software_updates')
     if os.path.isfile(os.path.expanduser('~/.sugar-update')):
         home_window = homewindow.get_instance()
         home_window.get_home_box().show_software_updates_alert()
 
-def setup_notification_service_cb():
-    notifications.init()
-
-def setup_file_transfer_cb():
-    filetransfer.init()
-
 def setup_window_manager():
     logging.debug('STARTUP: window_manager')
 
@@ -119,16 +93,17 @@ def bootstrap():
     setup_window_manager()
 
     launcher.setup()
+    keyboard.setup()
 
-    GObject.idle_add(setup_frame_cb)
-    GObject.idle_add(setup_keyhandler_cb)
-    GObject.idle_add(setup_gesturehandler_cb)
-    GObject.idle_add(setup_journal_cb)
-    GObject.idle_add(setup_notification_service_cb)
-    GObject.idle_add(setup_file_transfer_cb)
-    GObject.idle_add(show_software_updates_cb)
+    frame_view = frame.get_view()
+    keyhandler.setup(frame_view)
+    gesturehandler.setup(frame_view)
+    notifications.init()
+    filetransfer.init()
 
-    keyboard.setup()
+    journalactivity.start()
+
+    check_software_updates()
 
 def set_fonts():
     client = GConf.Client.get_default()
@@ -210,7 +185,7 @@ def main():
     # even when we initially get blocked on the intro screen
     screen.set_dcon_freeze(0)
 
-    GObject.idle_add(setup_cursortracker_cb)
+    cursortracker.setup()
     # make sure we have the correct cursor in the intro screen
     # TODO #3204
     if subprocess.call('echo $DISPLAY; xsetroot -cursor_name left_ptr',
-- 
1.7.10.4



More information about the Sugar-devel mailing list