From 122bca49ea99f3102a140d14a27d9c0b69564b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 17 May 2012 00:59:02 +0200 Subject: [PATCH] sessionMode: Add hasOverview property Add a sessionMode.hasOverview property, which determines whether the mode should give access to the overview or not. https://bugzilla.gnome.org/show_bug.cgi?id=676156 --- js/ui/main.js | 20 +++++++++++--------- js/ui/overview.js | 6 ++---- js/ui/panel.js | 4 +++- js/ui/sessionMode.js | 6 ++++-- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/js/ui/main.js b/js/ui/main.js index b91ee4154..247200a9c 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -142,13 +142,6 @@ function _initUserSession() { Meta.keybindings_set_custom_handler('panel-run-dialog', function() { getRunDialog().open(); }); - - Meta.keybindings_set_custom_handler('panel-main-menu', function () { - overview.toggle(); - }); - - global.display.connect('overlay-key', Lang.bind(overview, overview.toggle)); - } function start() { @@ -212,8 +205,7 @@ function start() { layoutManager = new Layout.LayoutManager(); xdndHandler = new XdndHandler.XdndHandler(); ctrlAltTabManager = new CtrlAltTab.CtrlAltTabManager(); - // This overview object is just a stub for non-user sessions - overview = new Overview.Overview({ isDummy: sessionMode.sessionType != Shell.SessionType.USER }); + overview = new Overview.Overview(); magnifier = new Magnifier.Magnifier(); statusIconDispatcher = new StatusIconDispatcher.StatusIconDispatcher(); panel = new Panel.Panel(); @@ -236,6 +228,16 @@ function start() { if (sessionMode.sessionType == Shell.SessionType.USER) _initUserSession(); + + if (sessionMode.hasOverview) { + Meta.keybindings_set_custom_handler('panel-main-menu', function () { + overview.toggle(); + }); + + global.display.connect('overlay-key', + Lang.bind(overview, overview.toggle)); + } + statusIconDispatcher.start(messageTray.actor); // Provide the bus object for gnome-session to diff --git a/js/ui/overview.js b/js/ui/overview.js index c1a4d5c0d..59dc71c42 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -99,10 +99,8 @@ const ShellInfo = new Lang.Class({ const Overview = new Lang.Class({ Name: 'Overview', - _init : function(params) { - params = Params.parse(params, { isDummy: false }); - - this.isDummy = params.isDummy; + _init : function() { + this.isDummy = !Main.sessionMode.hasOverview; // We only have an overview in user sessions, so // create a dummy overview in other cases diff --git a/js/ui/panel.js b/js/ui/panel.js index ab00237f4..45aabb218 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -962,7 +962,7 @@ const Panel = new Lang.Class({ this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress)); /* Button on the left side of the panel. */ - if (Main.sessionMode.sessionType == Shell.SessionType.USER) { + if (Main.sessionMode.hasOverview) { this._activitiesButton = new ActivitiesButton(); this._activities = this._activitiesButton.actor; this._leftBox.add(this._activities); @@ -970,7 +970,9 @@ const Panel = new Lang.Class({ // The activities button has a pretend menu, so as to integrate // more cleanly with the rest of the panel this._menus.addMenu(this._activitiesButton.menu); + } + if (Main.sessionMode.sessionType == Shell.SessionType.USER) { this._appMenu = new AppMenuButton(this._menus); this._leftBox.add(this._appMenu.actor); } diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js index 1ed5aaa21..3ab89c182 100644 --- a/js/ui/sessionMode.js +++ b/js/ui/sessionMode.js @@ -8,9 +8,11 @@ const Params = imports.misc.params; const DEFAULT_MODE = 'user'; const _modes = { - 'gdm': { sessionType: Shell.SessionType.GDM }, + 'gdm': { hasOverview: false, + sessionType: Shell.SessionType.GDM }, - 'user': { sessionType: Shell.SessionType.USER } + 'user': { hasOverview: true, + sessionType: Shell.SessionType.USER } }; function modeExists(mode) {