sessionMode: Add stylesheetName property

This will allow to visually differentiate modes by providing
separate styling.

https://bugzilla.gnome.org/show_bug.cgi?id=693219
This commit is contained in:
Florian Müllner 2013-02-05 04:13:44 +01:00
parent 7f587fd4da
commit fcc32fca7e
2 changed files with 16 additions and 2 deletions

View File

@ -95,6 +95,8 @@ function start() {
Gio.DesktopAppInfo.set_desktop_env('GNOME'); Gio.DesktopAppInfo.set_desktop_env('GNOME');
sessionMode = new SessionMode.SessionMode(); sessionMode = new SessionMode.SessionMode();
sessionMode.connect('updated', _loadDefaultStylesheet);
shellDBusService = new ShellDBus.GnomeShell(); shellDBusService = new ShellDBus.GnomeShell();
shellMountOpDBusService = new ShellMountOperation.GnomeShellMountOpHandler(); shellMountOpDBusService = new ShellMountOperation.GnomeShellMountOpHandler();
@ -117,8 +119,7 @@ function start() {
global.stage.color = DEFAULT_BACKGROUND_COLOR; global.stage.color = DEFAULT_BACKGROUND_COLOR;
global.stage.no_clear_hint = true; global.stage.no_clear_hint = true;
_defaultCssStylesheet = global.datadir + '/theme/gnome-shell.css'; _loadDefaultStylesheet();
loadTheme();
// Set up stage hierarchy to group all UI actors under one container. // Set up stage hierarchy to group all UI actors under one container.
uiGroup = new Shell.GenericContainer({ name: 'uiGroup' }); uiGroup = new Shell.GenericContainer({ name: 'uiGroup' });
@ -379,6 +380,18 @@ function _nWorkspacesChanged() {
return false; return false;
} }
function _loadDefaultStylesheet() {
if (!Main.sessionMode.isPrimary)
return;
let stylesheet = global.datadir + '/theme/' + sessionMode.stylesheetName;
if (_defaultCssStylesheet == stylesheet)
return;
_defaultCssStylesheet = stylesheet;
loadTheme();
}
/** /**
* getThemeStylesheet: * getThemeStylesheet:
* *

View File

@ -15,6 +15,7 @@ const DEFAULT_MODE = 'restrictive';
const _modes = { const _modes = {
'restrictive': { 'restrictive': {
parentMode: null, parentMode: null,
stylesheetName: 'gnome-shell.css',
hasOverview: false, hasOverview: false,
showCalendarEvents: false, showCalendarEvents: false,
allowSettings: false, allowSettings: false,