[gnome-shell] Defer initializing UI until after the global session has loaded
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Defer initializing UI until after the global session has loaded
- Date: Thu, 7 Mar 2013 21:50:33 +0000 (UTC)
commit 7cdb75e7ce763d4149835e61e170b44368a70fd9
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Feb 18 05:26:25 2013 -0500
Defer initializing UI until after the global session has loaded
https://bugzilla.gnome.org/show_bug.cgi?id=694321
js/ui/main.js | 20 +++++++++++---------
js/ui/sessionMode.js | 9 +++------
2 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 015b4b6..936d74e 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -98,19 +98,21 @@ function start() {
Gio.DesktopAppInfo.set_desktop_env('GNOME');
- sessionMode = new SessionMode.SessionMode();
+ shellDBusService = new ShellDBus.GnomeShell();
+ shellMountOpDBusService = new ShellMountOperation.GnomeShellMountOpHandler();
- // start session after we know what mode we're running in
- let signalId = sessionMode.connect('updated', function() {
- sessionMode.disconnect(signalId);
- startSession();
- });
+ sessionMode = new SessionMode.SessionMode();
+ sessionMode.connect('sessions-loaded', _sessionsLoaded);
+ sessionMode.init();
}
-function startSession() {
- shellDBusService = new ShellDBus.GnomeShell();
- shellMountOpDBusService = new ShellMountOperation.GnomeShellMountOpHandler();
+function _sessionsLoaded() {
+ sessionMode.connect('updated', _sessionUpdated);
+ _initializeUI();
+ _sessionUpdated();
+}
+function _initializeUI() {
// Ensure ShellWindowTracker and ShellAppUsage are initialized; this will
// also initialize ShellAppSystem first. ShellAppSystem
// needs to load all the .desktop files, and ShellWindowTracker
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
index e926ba2..7d6b2e4 100644
--- a/js/ui/sessionMode.js
+++ b/js/ui/sessionMode.js
@@ -158,12 +158,7 @@ function listModes() {
const SessionMode = new Lang.Class({
Name: 'SessionMode',
- _init: function() {
- global.connect('notify::session-mode', Lang.bind(this, this._sync));
- this._modes = _modes;
- this._modeStack = [DEFAULT_MODE];
- this._sync();
-
+ init: function() {
_getModes(Lang.bind(this, function(modes) {
this._modes = modes;
let primary = modes[global.session_mode] &&
@@ -171,6 +166,8 @@ const SessionMode = new Lang.Class({
let mode = primary ? global.session_mode : 'user';
this._modeStack = [mode];
this._sync();
+
+ this.emit('sessions-loaded');
}));
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]