[gnome-shell] sessionMode: Add createSession() hook
- From: Florian MÃllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] sessionMode: Add createSession() hook
- Date: Tue, 22 May 2012 17:47:10 +0000 (UTC)
commit c25e7f3c41704ecb31c31c9a25e3ce2e5e863e8b
Author: Florian MÃllner <fmuellner gnome org>
Date: Thu May 17 15:50:51 2012 +0200
sessionMode: Add createSession() hook
Add a sessionMode.createSession() hook, which is executed during
startup to setup mode-specific stuff.
https://bugzilla.gnome.org/show_bug.cgi?id=676156
js/ui/main.js | 9 +++------
js/ui/sessionMode.js | 12 ++++++++++++
2 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 21d7bc5..47fd833 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -76,7 +76,7 @@ let _overridesSettings = null;
let background = null;
-function _createUserSession() {
+function createUserSession() {
// Load the calendar server. Note that we are careful about
// not loading any events until the user presses the clock
global.launch_calendar_server();
@@ -89,7 +89,7 @@ function _createUserSession() {
_initRecorder();
}
-function _createGDMSession() {
+function createGDMSession() {
// We do this this here instead of at the top to prevent GDM
// related code from getting loaded in normal user sessions
const LoginDialog = imports.gdm.loginDialog;
@@ -204,10 +204,7 @@ function start() {
notificationDaemon = new NotificationDaemon.NotificationDaemon();
windowAttentionHandler = new WindowAttentionHandler.WindowAttentionHandler();
- if (sessionMode.sessionType == Shell.SessionType.USER)
- _createUserSession();
- else if (sessionMode.sessionType == Shell.SessionType.GDM)
- _createGDMSession();
+ sessionMode.createSession();
panel.startStatusArea();
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
index 88d33c7..ebc7ab9 100644
--- a/js/ui/sessionMode.js
+++ b/js/ui/sessionMode.js
@@ -3,6 +3,7 @@
const Lang = imports.lang;
const Shell = imports.gi.Shell;
+const Main = imports.ui.main;
const Params = imports.misc.params;
const DEFAULT_MODE = 'user';
@@ -16,6 +17,7 @@ const _modes = {
allowKeybindingsWhenModal: true,
hasRunDialog: false,
hasWorkspaces: false,
+ createSession: Main.createGDMSession,
sessionType: Shell.SessionType.GDM },
'user': { hasOverview: true,
@@ -26,6 +28,7 @@ const _modes = {
allowKeybindingsWhenModal: false,
hasRunDialog: true,
hasWorkspaces: true,
+ createSession: Main.createUserSession,
sessionType: Shell.SessionType.USER }
};
@@ -41,6 +44,15 @@ const SessionMode = new Lang.Class({
let params = _modes[global.session_mode];
params = Params.parse(params, _modes[DEFAULT_MODE]);
+
+ this._createSession = params.createSession;
+ delete params.createSession;
+
Lang.copyProperties(params, this);
+ },
+
+ createSession: function() {
+ if (this._createSession)
+ this._createSession();
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]