2012-05-16 22:26:44 +00:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
|
|
|
|
|
|
|
const Lang = imports.lang;
|
|
|
|
|
2012-05-17 14:09:02 +00:00
|
|
|
const Config = imports.misc.config;
|
2012-05-17 13:50:51 +00:00
|
|
|
const Main = imports.ui.main;
|
2012-05-16 22:26:44 +00:00
|
|
|
const Params = imports.misc.params;
|
|
|
|
|
2012-05-17 14:09:02 +00:00
|
|
|
|
|
|
|
const STANDARD_STATUS_AREA_SHELL_IMPLEMENTATION = {
|
|
|
|
'a11y': imports.ui.status.accessibility.ATIndicator,
|
|
|
|
'volume': imports.ui.status.volume.Indicator,
|
|
|
|
'battery': imports.ui.status.power.Indicator,
|
2012-04-19 02:01:29 +00:00
|
|
|
'keyboard': imports.ui.status.keyboard.InputSourceIndicator,
|
2012-05-17 14:09:02 +00:00
|
|
|
'userMenu': imports.ui.userMenu.UserMenuButton
|
|
|
|
};
|
|
|
|
|
|
|
|
if (Config.HAVE_BLUETOOTH)
|
|
|
|
STANDARD_STATUS_AREA_SHELL_IMPLEMENTATION['bluetooth'] =
|
|
|
|
imports.ui.status.bluetooth.Indicator;
|
|
|
|
|
|
|
|
try {
|
|
|
|
STANDARD_STATUS_AREA_SHELL_IMPLEMENTATION['network'] =
|
|
|
|
imports.ui.status.network.NMApplet;
|
|
|
|
} catch(e) {
|
|
|
|
log('NMApplet is not supported. It is possible that your NetworkManager version is too old');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-16 22:26:44 +00:00
|
|
|
const DEFAULT_MODE = 'user';
|
|
|
|
|
|
|
|
const _modes = {
|
2012-05-16 22:59:02 +00:00
|
|
|
'gdm': { hasOverview: false,
|
2012-05-16 23:12:39 +00:00
|
|
|
hasAppMenu: false,
|
2012-05-17 22:32:04 +00:00
|
|
|
showCalendarEvents: false,
|
2012-05-16 23:43:59 +00:00
|
|
|
allowSettings: false,
|
2012-05-17 00:08:56 +00:00
|
|
|
allowExtensions: false,
|
2012-05-17 13:55:35 +00:00
|
|
|
allowKeybindingsWhenModal: true,
|
2012-05-17 11:41:02 +00:00
|
|
|
hasRunDialog: false,
|
2012-05-17 13:32:32 +00:00
|
|
|
hasWorkspaces: false,
|
2012-05-17 13:50:51 +00:00
|
|
|
createSession: Main.createGDMSession,
|
2012-05-26 15:04:25 +00:00
|
|
|
createUnlockDialog: Main.createGDMLoginDialog,
|
2012-05-20 16:30:14 +00:00
|
|
|
extraStylesheet: null,
|
2012-05-17 14:09:02 +00:00
|
|
|
statusArea: {
|
|
|
|
order: [
|
|
|
|
'a11y', 'display', 'keyboard',
|
|
|
|
'volume', 'battery', 'powerMenu'
|
|
|
|
],
|
|
|
|
implementation: {
|
|
|
|
'a11y': imports.ui.status.accessibility.ATIndicator,
|
|
|
|
'volume': imports.ui.status.volume.Indicator,
|
|
|
|
'battery': imports.ui.status.power.Indicator,
|
2012-04-19 02:01:29 +00:00
|
|
|
'keyboard': imports.ui.status.keyboard.InputSourceIndicator,
|
2012-05-17 14:09:02 +00:00
|
|
|
'powerMenu': imports.gdm.powerMenu.PowerMenuButton
|
|
|
|
}
|
2012-05-17 14:11:54 +00:00
|
|
|
}
|
|
|
|
},
|
2012-05-16 22:26:44 +00:00
|
|
|
|
2012-05-24 03:37:09 +00:00
|
|
|
'initial-setup': { hasOverview: false,
|
|
|
|
hasAppMenu: false,
|
|
|
|
showCalendarEvents: false,
|
|
|
|
allowSettings: false,
|
|
|
|
allowExtensions: false,
|
|
|
|
allowKeybindingsWhenModal: false,
|
|
|
|
hasRunDialog: false,
|
|
|
|
hasWorkspaces: false,
|
|
|
|
createSession: Main.createInitialSetupSession,
|
|
|
|
extraStylesheet: null,
|
|
|
|
statusArea: {
|
|
|
|
order: [
|
|
|
|
'a11y', 'keyboard', 'volume'
|
|
|
|
],
|
|
|
|
implementation: {
|
|
|
|
'a11y': imports.ui.status.accessibility.ATIndicator,
|
|
|
|
'keyboard': imports.ui.status.keyboard.XKBIndicator,
|
|
|
|
'volume': imports.ui.status.volume.Indicator
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2012-05-16 22:59:02 +00:00
|
|
|
'user': { hasOverview: true,
|
2012-05-16 23:12:39 +00:00
|
|
|
hasAppMenu: true,
|
2012-05-17 22:32:04 +00:00
|
|
|
showCalendarEvents: true,
|
2012-05-16 23:43:59 +00:00
|
|
|
allowSettings: true,
|
2012-05-17 00:08:56 +00:00
|
|
|
allowExtensions: true,
|
2012-05-17 13:55:35 +00:00
|
|
|
allowKeybindingsWhenModal: false,
|
2012-05-17 11:41:02 +00:00
|
|
|
hasRunDialog: true,
|
2012-05-17 13:32:32 +00:00
|
|
|
hasWorkspaces: true,
|
2012-05-17 13:50:51 +00:00
|
|
|
createSession: Main.createUserSession,
|
2012-05-26 15:04:25 +00:00
|
|
|
createUnlockDialog: Main.createSessionUnlockDialog,
|
2012-05-17 13:52:02 +00:00
|
|
|
extraStylesheet: null,
|
2012-05-17 14:09:02 +00:00
|
|
|
statusArea: {
|
|
|
|
order: [
|
2012-05-29 19:31:02 +00:00
|
|
|
'input-method', 'a11y', 'keyboard', 'volume', 'bluetooth',
|
2012-05-17 14:09:02 +00:00
|
|
|
'network', 'battery', 'userMenu'
|
|
|
|
],
|
|
|
|
implementation: STANDARD_STATUS_AREA_SHELL_IMPLEMENTATION
|
2012-05-17 14:11:54 +00:00
|
|
|
}
|
|
|
|
}
|
2012-05-16 22:26:44 +00:00
|
|
|
};
|
|
|
|
|
2012-05-18 01:52:57 +00:00
|
|
|
function listModes() {
|
|
|
|
let modes = Object.getOwnPropertyNames(_modes);
|
|
|
|
for (let i = 0; i < modes.length; i++)
|
|
|
|
print(modes[i]);
|
|
|
|
}
|
|
|
|
|
2012-05-16 22:26:44 +00:00
|
|
|
const SessionMode = new Lang.Class({
|
|
|
|
Name: 'SessionMode',
|
|
|
|
|
|
|
|
_init: function() {
|
|
|
|
let params = _modes[global.session_mode];
|
|
|
|
|
|
|
|
params = Params.parse(params, _modes[DEFAULT_MODE]);
|
2012-05-17 13:50:51 +00:00
|
|
|
|
|
|
|
this._createSession = params.createSession;
|
|
|
|
delete params.createSession;
|
2012-05-26 15:04:25 +00:00
|
|
|
this._createUnlockDialog = params.createUnlockDialog;
|
|
|
|
delete params.createUnlockDialog;
|
2012-05-17 13:50:51 +00:00
|
|
|
|
2012-05-16 22:26:44 +00:00
|
|
|
Lang.copyProperties(params, this);
|
2012-05-17 13:50:51 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
createSession: function() {
|
|
|
|
if (this._createSession)
|
|
|
|
this._createSession();
|
2012-05-26 15:04:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
createUnlockDialog: function() {
|
|
|
|
if (this._createUnlockDialog)
|
|
|
|
return this._createUnlockDialog.apply(this, arguments);
|
|
|
|
else
|
|
|
|
return null;
|
|
|
|
},
|
2012-05-16 22:26:44 +00:00
|
|
|
});
|