From 0dcba50f68341983943cdeddc8043a78f25b4fd5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Fri, 8 Mar 2013 21:04:15 +0100
Subject: [PATCH] main: Do not export DBus interfaces before initializing the
 UI

Since commit 7cdb75e7ce76, initializing UI is deferred until the session
mode has been loaded. However DBus is still initialized immediately,
which means that for DBus methods that access properties in Main, there
is now a window between the method being exposed on the bus and the
method being ready to be called. At least g-s-d grabbing global keybindings
is likely to fall in this window on session startup, and almost guaranteed
when regrabbing bindings after a shell restart.
To fix, defer initializing DBus as well.

https://bugzilla.gnome.org/show_bug.cgi?id=694321
---
 js/ui/main.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/js/ui/main.js b/js/ui/main.js
index b0a8c2d..6d5061b 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -96,9 +96,6 @@ function start() {
 
     Gio.DesktopAppInfo.set_desktop_env('GNOME');
 
-    shellDBusService = new ShellDBus.GnomeShell();
-    shellMountOpDBusService = new ShellMountOperation.GnomeShellMountOpHandler();
-
     sessionMode = new SessionMode.SessionMode();
     sessionMode.connect('sessions-loaded', _sessionsLoaded);
     sessionMode.init();
@@ -107,6 +104,10 @@ function start() {
 function _sessionsLoaded() {
     sessionMode.connect('updated', _sessionUpdated);
     _initializeUI();
+
+    shellDBusService = new ShellDBus.GnomeShell();
+    shellMountOpDBusService = new ShellMountOperation.GnomeShellMountOpHandler();
+
     _sessionUpdated();
 }
 
-- 
1.8.1.4