Ticket #1373: sugar-1373.patch

File sugar-1373.patch, 4.9 KB (added by alsroot, 15 years ago)
  • bin/sugar-session

    From cea67fa48d3ac9f4c9e5faa9ff7f781cad6cf67e Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Tue, 13 Oct 2009 14:51:13 +0000
    Subject: Suppress race condition with Journal appearing on sugar startup #1373
    
    ---
     bin/sugar-session         |   54 ++++++++++++++++++++++++++++++++++----------
     src/jarabe/model/shell.py |   18 ---------------
     2 files changed, 41 insertions(+), 31 deletions(-)
     mode change 100755 => 100644 bin/sugar-session
    
    diff --git a/bin/sugar-session b/bin/sugar-session
    old mode 100755
    new mode 100644
    index 427eeb8..7d8a96b
    a b  
    1919import os
    2020import sys
    2121import time
     22import subprocess
    2223
    2324if os.environ.get('SUGAR_LOGGER_LEVEL', '') == 'debug':
    2425    print '%r STARTUP: Starting the shell' % time.time()
    import gconf 
    3132import gtk
    3233import gobject
    3334import dbus.glib
     35import wnck
    3436
    3537try:
    3638    import xklavier
    def setup_file_transfer_cb(): 
    136138    from jarabe.model import filetransfer
    137139    filetransfer.init()
    138140
    139 def setup_keyboard_cb(gconf_client):
     141def setup_keyboard_cb():
    140142    logging.debug('STARTUP: setup_keyboard_cb')
     143
     144    gconf_client = gconf.client_get_default()
     145
    141146    try:
    142147        display = gtk.gdk.display_get_default()
    143148        if display is not None:
    def setup_keyboard_cb(gconf_client): 
    176181    except Exception:
    177182        logging.exception('Error during keyboard configuration')
    178183
     184def setup_wm():
     185    logging.debug('STARTUP: wm')
     186
     187    # have to reset cursor(metacity sets it on startup)
     188    if subprocess.call('echo $DISPLAY; xsetroot -cursor_name left_ptr', shell=True):
     189        logging.warning('Can not reset cursor')
     190
     191    if subprocess.call('metacity-message disable-keybindings',
     192            shell=True):
     193        logging.warning('Can not disable metacity keybindings')
     194
     195def bootstrap():
     196    setup_wm()
     197    launcher.setup()
     198
     199    gobject.idle_add(unfreeze_dcon_cb)
     200    gobject.idle_add(setup_frame_cb)
     201    gobject.idle_add(setup_keyhandler_cb)
     202    gobject.idle_add(setup_journal_cb)
     203    gobject.idle_add(setup_notification_service_cb)
     204    gobject.idle_add(setup_file_transfer_cb)
     205    gobject.idle_add(show_software_updates_cb)
     206
     207    if sys.modules.has_key('xklavier'):
     208        gobject.idle_add(setup_keyboard_cb)
     209
    179210def main():
    180211    cleanup_logs()
    181212    logger.start('shell')
    def main(): 
    200231    icons_path = os.path.join(config.data_path, 'icons')
    201232    gtk.icon_theme_get_default().append_search_path(icons_path)
    202233
    203     launcher.setup()
    204 
     234    # open homewindow before wm to let desktop appear fast
    205235    home_window = homewindow.get_instance()
    206236    home_window.show()
    207237
    208     gobject.idle_add(unfreeze_dcon_cb)
    209     gobject.idle_add(setup_frame_cb)
    210     gobject.idle_add(setup_keyhandler_cb)
    211     gobject.idle_add(setup_journal_cb)
    212     gobject.idle_add(setup_notification_service_cb)
    213     gobject.idle_add(setup_file_transfer_cb)
    214     gobject.idle_add(show_software_updates_cb)
    215    
    216     if sys.modules.has_key('xklavier'):
    217         gobject.idle_add(setup_keyboard_cb, client)
     238    screen = wnck.screen_get_default()
     239    screen.connect('window-manager-changed', __window_manager_changed_cb)
    218240
    219241    try:
    220242        gtk.main()
    221243    except KeyboardInterrupt:
    222244        print 'Ctrl+C pressed, exiting...'
    223245
     246def __window_manager_changed_cb(screen):
     247    wm_name = screen.get_window_manager_name()
     248    if wm_name is not None:
     249        screen.disconnect_by_func(__window_manager_changed_cb)
     250        bootstrap()
     251
    224252main()
  • src/jarabe/model/shell.py

    diff --git a/src/jarabe/model/shell.py b/src/jarabe/model/shell.py
    index 8693e26..de5a66f 100644
    a b  
    1717
    1818import logging
    1919import time
    20 import subprocess
    2120
    2221import gconf
    2322import wnck
    class ShellModel(gobject.GObject): 
    323322        self._screen.connect('window-closed', self._window_closed_cb)
    324323        self._screen.connect('active-window-changed',
    325324                             self._active_window_changed_cb)
    326         self._screen.connect('window-manager-changed',
    327                              self.__window_manager_changed_cb)
    328325
    329326        self.zoom_level_changed = dispatch.Signal()
    330327
    class ShellModel(gobject.GObject): 
    594591            self.notify_launch_failed(activity_id)
    595592        return False
    596593
    597     def __window_manager_changed_cb(self, screen):
    598         wm_name = screen.get_window_manager_name()
    599         if wm_name is not None:
    600             logging.debug('Setup %s wm', wm_name)
    601             self._setup_wm()
    602 
    603     def _setup_wm(self):
    604         # have to reset cursor(metacity sets it on startup)
    605         if subprocess.call('xsetroot -cursor_name left_ptr', shell=True):
    606             logging.warning('Can not reset cursor')
    607 
    608         if subprocess.call('metacity-message disable-keybindings',
    609                 shell=True):
    610             logging.warning('Can not disable metacity keybindings')
    611 
    612594
    613595_model = None
    614596