extensionSystem: Add support for mode-specific extensions
As currently envisioned, the fallback replacement in 3.8 should be a separate session at the login screen. As we will use extensions to implement this mode, we need a way to specify extensions per session rather than per user, so add a session-mode property for extensions that should be loaded in addition to the user-defined ones. https://bugzilla.gnome.org/show_bug.cgi?id=689305
This commit is contained in:
parent
92083eaf76
commit
31f75e4607
@ -211,8 +211,16 @@ function initExtension(uuid) {
|
|||||||
_signals.emit('extension-loaded', uuid);
|
_signals.emit('extension-loaded', uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getEnabledExtensions() {
|
||||||
|
let extensions = global.settings.get_strv(ENABLED_EXTENSIONS_KEY);
|
||||||
|
if (!Array.isArray(Main.sessionMode.enabledExtensions))
|
||||||
|
return extensions;
|
||||||
|
|
||||||
|
return Main.sessionMode.enabledExtensions.concat(extensions);
|
||||||
|
}
|
||||||
|
|
||||||
function onEnabledExtensionsChanged() {
|
function onEnabledExtensionsChanged() {
|
||||||
let newEnabledExtensions = global.settings.get_strv(ENABLED_EXTENSIONS_KEY);
|
let newEnabledExtensions = getEnabledExtensions();
|
||||||
|
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
return;
|
return;
|
||||||
@ -246,7 +254,7 @@ function onEnabledExtensionsChanged() {
|
|||||||
|
|
||||||
function _loadExtensions() {
|
function _loadExtensions() {
|
||||||
global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged);
|
global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged);
|
||||||
enabledExtensions = global.settings.get_strv(ENABLED_EXTENSIONS_KEY);
|
enabledExtensions = getEnabledExtensions();
|
||||||
|
|
||||||
let finder = new ExtensionUtils.ExtensionFinder();
|
let finder = new ExtensionUtils.ExtensionFinder();
|
||||||
finder.connect('extension-found', function(signals, extension) {
|
finder.connect('extension-found', function(signals, extension) {
|
||||||
@ -288,10 +296,17 @@ function disableAllExtensions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _sessionUpdated() {
|
function _sessionUpdated() {
|
||||||
if (Main.sessionMode.allowExtensions)
|
// For now sessionMode.allowExtensions controls extensions from both the
|
||||||
|
// 'enabled-extensions' preference and the sessionMode.enabledExtensions
|
||||||
|
// property; it might make sense to make enabledExtensions independent
|
||||||
|
// from allowExtensions in the future
|
||||||
|
if (Main.sessionMode.allowExtensions) {
|
||||||
|
if (initted)
|
||||||
|
onEnabledExtensionsChanged();
|
||||||
enableAllExtensions();
|
enableAllExtensions();
|
||||||
else
|
} else {
|
||||||
disableAllExtensions();
|
disableAllExtensions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
@ -18,6 +18,7 @@ const _modes = {
|
|||||||
showCalendarEvents: false,
|
showCalendarEvents: false,
|
||||||
allowSettings: false,
|
allowSettings: false,
|
||||||
allowExtensions: false,
|
allowExtensions: false,
|
||||||
|
enabledExtensions: [],
|
||||||
hasRunDialog: false,
|
hasRunDialog: false,
|
||||||
hasWorkspaces: false,
|
hasWorkspaces: false,
|
||||||
hasWindows: false,
|
hasWindows: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user