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
This commit is contained in:
Florian Müllner 2012-05-17 00:59:02 +02:00
parent 19318a1eeb
commit 122bca49ea
4 changed files with 20 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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) {