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
This commit is contained in:
Florian Müllner 2015-12-15 00:15:33 +01:00
parent 7395aaf9b4
commit 5d07832e96

View File

@ -149,6 +149,14 @@ const Application = new Lang.Class({
title: _("GNOME Shell Extensions") }); title: _("GNOME Shell Extensions") });
this._window.set_titlebar(this._titlebar); 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, let scroll = new Gtk.ScrolledWindow({ hscrollbar_policy: Gtk.PolicyType.NEVER,
shadow_type: Gtk.ShadowType.IN, shadow_type: Gtk.ShadowType.IN,
halign: Gtk.Align.CENTER, halign: Gtk.Align.CENTER,
@ -264,6 +272,10 @@ const ExtensionRow = new Lang.Class({
Lang.bind(this, function() { Lang.bind(this, function() {
this._switch.sensitive = this._canEnable(); this._switch.sensitive = this._canEnable();
})); }));
this._settings.connect('changed::disable-user-extensions',
Lang.bind(this, function() {
this._switch.sensitive = this._canEnable();
}));
this._buildUI(); this._buildUI();
}, },
@ -319,7 +331,8 @@ const ExtensionRow = new Lang.Class({
let extension = ExtensionUtils.extensions[this.uuid]; let extension = ExtensionUtils.extensions[this.uuid];
let checkVersion = !this._settings.get_boolean('disable-extension-version-validation'); 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() { _isEnabled: function() {