From 5d07832e961046ee989a19661c288e2633fed1f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 15 Dec 2015 00:15:33 +0100 Subject: [PATCH] extensionPrefs: Expose kill-switch While the extension prefs tool is not meant as the primary way for users to configure extensions - that will be Tweak Tool - it still doesn't hurt to expose the extension kill switch to easily turn extensions back on after a session crash. https://bugzilla.gnome.org/show_bug.cgi?id=778664 --- js/extensionPrefs/main.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js index cdfce7870..7bbf0fa21 100644 --- a/js/extensionPrefs/main.js +++ b/js/extensionPrefs/main.js @@ -149,6 +149,14 @@ const Application = new Lang.Class({ title: _("GNOME Shell Extensions") }); this._window.set_titlebar(this._titlebar); + let killSwitch = new Gtk.Switch({ valign: Gtk.Align.CENTER }); + this._titlebar.pack_end(killSwitch); + + this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell' }); + this._settings.bind('disable-user-extensions', killSwitch, 'active', + Gio.SettingsBindFlags.BIND_DEFAULT | + Gio.SettingsBindFlags.INVERT_BOOLEAN); + let scroll = new Gtk.ScrolledWindow({ hscrollbar_policy: Gtk.PolicyType.NEVER, shadow_type: Gtk.ShadowType.IN, halign: Gtk.Align.CENTER, @@ -264,6 +272,10 @@ const ExtensionRow = new Lang.Class({ Lang.bind(this, function() { this._switch.sensitive = this._canEnable(); })); + this._settings.connect('changed::disable-user-extensions', + Lang.bind(this, function() { + this._switch.sensitive = this._canEnable(); + })); this._buildUI(); }, @@ -319,7 +331,8 @@ const ExtensionRow = new Lang.Class({ let extension = ExtensionUtils.extensions[this.uuid]; let checkVersion = !this._settings.get_boolean('disable-extension-version-validation'); - return !(checkVersion && ExtensionUtils.isOutOfDate(extension)); + return !this._settings.get_boolean('disable-user-extensions') && + !(checkVersion && ExtensionUtils.isOutOfDate(extension)); }, _isEnabled: function() {