Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-10-13 15:13:30 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-10-13 15:13:30 (GMT)
commit26ba76b965984ddc8681a3c25ee075a6664c98ef (patch)
treed76b4b1d27e649f4e6d96412a7ea96d7e2680cb7 /bin
parentb0520607503b0876020d5e764b1a98322a2bf949 (diff)
Suppress race condition with Journal appearing on sugar startup #1373
Diffstat (limited to 'bin')
-rw-r--r--[-rwxr-xr-x]bin/sugar-session54
1 files changed, 41 insertions, 13 deletions
diff --git a/bin/sugar-session b/bin/sugar-session
index 427eeb8..f06479d 100755..100644
--- a/bin/sugar-session
+++ b/bin/sugar-session
@@ -19,6 +19,7 @@
import os
import sys
import time
+import subprocess
if os.environ.get('SUGAR_LOGGER_LEVEL', '') == 'debug':
print '%r STARTUP: Starting the shell' % time.time()
@@ -31,6 +32,7 @@ import gconf
import gtk
import gobject
import dbus.glib
+import wnck
try:
import xklavier
@@ -136,8 +138,11 @@ def setup_file_transfer_cb():
from jarabe.model import filetransfer
filetransfer.init()
-def setup_keyboard_cb(gconf_client):
+def setup_keyboard_cb():
logging.debug('STARTUP: setup_keyboard_cb')
+
+ gconf_client = gconf.client_get_default()
+
try:
display = gtk.gdk.display_get_default()
if display is not None:
@@ -176,6 +181,32 @@ def setup_keyboard_cb(gconf_client):
except Exception:
logging.exception('Error during keyboard configuration')
+def setup_window_manager():
+ logging.debug('STARTUP: window_manager')
+
+ # have to reset cursor(metacity sets it on startup)
+ if subprocess.call('echo $DISPLAY; xsetroot -cursor_name left_ptr', shell=True):
+ logging.warning('Can not reset cursor')
+
+ if subprocess.call('metacity-message disable-keybindings',
+ shell=True):
+ logging.warning('Can not disable metacity keybindings')
+
+def bootstrap():
+ setup_window_manager()
+ launcher.setup()
+
+ gobject.idle_add(unfreeze_dcon_cb)
+ gobject.idle_add(setup_frame_cb)
+ gobject.idle_add(setup_keyhandler_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)
+
+ if sys.modules.has_key('xklavier'):
+ gobject.idle_add(setup_keyboard_cb)
+
def main():
cleanup_logs()
logger.start('shell')
@@ -200,25 +231,22 @@ def main():
icons_path = os.path.join(config.data_path, 'icons')
gtk.icon_theme_get_default().append_search_path(icons_path)
- launcher.setup()
-
+ # open homewindow before window_manager to let desktop appear fast
home_window = homewindow.get_instance()
home_window.show()
- gobject.idle_add(unfreeze_dcon_cb)
- gobject.idle_add(setup_frame_cb)
- gobject.idle_add(setup_keyhandler_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)
-
- if sys.modules.has_key('xklavier'):
- gobject.idle_add(setup_keyboard_cb, client)
+ screen = wnck.screen_get_default()
+ screen.connect('window-manager-changed', __window_manager_changed_cb)
try:
gtk.main()
except KeyboardInterrupt:
print 'Ctrl+C pressed, exiting...'
+def __window_manager_changed_cb(screen):
+ wm_name = screen.get_window_manager_name()
+ if wm_name is not None:
+ screen.disconnect_by_func(__window_manager_changed_cb)
+ bootstrap()
+
main()