sessionMode: Add support for 'parentMode' property
Defining a mode that differs significantly from the default one can get rather cumbersome. For convenience, allow mode definitions to inherit from an existing mode. https://bugzilla.gnome.org/show_bug.cgi?id=689308
This commit is contained in:
parent
31f75e4607
commit
187dec2816
@ -14,6 +14,7 @@ const DEFAULT_MODE = 'restrictive';
|
|||||||
|
|
||||||
const _modes = {
|
const _modes = {
|
||||||
'restrictive': {
|
'restrictive': {
|
||||||
|
parentMode: null,
|
||||||
hasOverview: false,
|
hasOverview: false,
|
||||||
showCalendarEvents: false,
|
showCalendarEvents: false,
|
||||||
allowSettings: false,
|
allowSettings: false,
|
||||||
@ -197,7 +198,13 @@ const SessionMode = new Lang.Class({
|
|||||||
|
|
||||||
_sync: function() {
|
_sync: function() {
|
||||||
let params = this._modes[this.currentMode];
|
let params = this._modes[this.currentMode];
|
||||||
params = Params.parse(params, this._modes[DEFAULT_MODE]);
|
let defaults;
|
||||||
|
if (params.parentMode)
|
||||||
|
defaults = Params.parse(this._modes[params.parentMode],
|
||||||
|
this._modes[DEFAULT_MODE]);
|
||||||
|
else
|
||||||
|
defaults = this._modes[DEFAULT_MODE];
|
||||||
|
params = Params.parse(params, defaults);
|
||||||
|
|
||||||
// A simplified version of Lang.copyProperties, handles
|
// A simplified version of Lang.copyProperties, handles
|
||||||
// undefined as a special case for "no change / inherit from previous mode"
|
// undefined as a special case for "no change / inherit from previous mode"
|
||||||
|
Loading…
Reference in New Issue
Block a user