From 7395aaf9b45690bbee232852a39d3b3595aa6d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 14 Dec 2015 23:52:38 +0100 Subject: [PATCH] extensionSystem: Add kill-switch setting to disable user extensions When gnome-shell fails to start on login, gnome-session tries to re-launch it again with all extensions disabled. This is currently implemented by clearing the list of enabled extensions, which means the user needs to re-enable their extensions manually again. To make this process less annoying, add a single 'kill-switch' setting gnome-session can use without interfering with the user setting. https://bugzilla.gnome.org/show_bug.cgi?id=778664 --- data/org.gnome.shell.gschema.xml.in | 8 ++++++++ js/ui/extensionSystem.js | 13 ++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/data/org.gnome.shell.gschema.xml.in b/data/org.gnome.shell.gschema.xml.in index c1e6b21da..7348d0908 100644 --- a/data/org.gnome.shell.gschema.xml.in +++ b/data/org.gnome.shell.gschema.xml.in @@ -21,6 +21,14 @@ EnableExtension and DisableExtension D-Bus methods on org.gnome.Shell. + + false + Disable user extensions + + Disable all extensions the user has enabled without affecting + the 'enabled-extension' setting. + + true Disables the validation of extension version compatibility diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js index ba332220b..a4dc29eea 100644 --- a/js/ui/extensionSystem.js +++ b/js/ui/extensionSystem.js @@ -38,6 +38,7 @@ const connect = Lang.bind(_signals, _signals.connect); const disconnect = Lang.bind(_signals, _signals.disconnect); const ENABLED_EXTENSIONS_KEY = 'enabled-extensions'; +const DISABLE_USER_EXTENSIONS_KEY = 'disable-user-extensions'; const EXTENSION_DISABLE_VERSION_CHECK_KEY = 'disable-extension-version-validation'; var initted = false; @@ -238,11 +239,16 @@ function initExtension(uuid) { } function getEnabledExtensions() { - let extensions = global.settings.get_strv(ENABLED_EXTENSIONS_KEY); - if (!Array.isArray(Main.sessionMode.enabledExtensions)) + let extensions; + if (Array.isArray(Main.sessionMode.enabledExtensions)) + extensions = Main.sessionMode.enabledExtensions; + else + extensions = []; + + if (global.settings.get_boolean(DISABLE_USER_EXTENSIONS_KEY)) return extensions; - return Main.sessionMode.enabledExtensions.concat(extensions); + return extensions.concat(global.settings.get_strv(ENABLED_EXTENSIONS_KEY)); } function onEnabledExtensionsChanged() { @@ -288,6 +294,7 @@ function _onVersionValidationChanged() { function _loadExtensions() { global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged); + global.settings.connect('changed::' + DISABLE_USER_EXTENSIONS_KEY, onEnabledExtensionsChanged); global.settings.connect('changed::' + EXTENSION_DISABLE_VERSION_CHECK_KEY, _onVersionValidationChanged); enabledExtensions = getEnabledExtensions();