extensionPrefs: Improve handling of OutOfDate extensions
Our current UI is horrible in dealing with outdated extensions - we don't give users any indication at all that something is not working as expected (unless hiding the prefs button as we did until the last commit counts). To fix this, make the enable switch insensitive to indicate OutOfDate extensions. https://bugzilla.gnome.org/show_bug.cgi?id=736185
This commit is contained in:
parent
d209bc69b6
commit
593acb954d
@ -281,6 +281,10 @@ const ExtensionRow = new Lang.Class({
|
||||
function() {
|
||||
this._switch.state = this._isEnabled();
|
||||
}));
|
||||
this._settings.connect('changed::disable-extension-version-validation',
|
||||
Lang.bind(this, function() {
|
||||
this._switch.sensitive = this._canEnable();
|
||||
}));
|
||||
|
||||
this._buildUI();
|
||||
},
|
||||
@ -319,6 +323,7 @@ const ExtensionRow = new Lang.Class({
|
||||
this.prefsButton = button;
|
||||
|
||||
this._switch = new Gtk.Switch({ valign: Gtk.Align.CENTER,
|
||||
sensitive: this._canEnable(),
|
||||
state: this._isEnabled() });
|
||||
this._switch.connect('notify::active', Lang.bind(this,
|
||||
function() {
|
||||
@ -331,6 +336,13 @@ const ExtensionRow = new Lang.Class({
|
||||
hbox.add(this._switch);
|
||||
},
|
||||
|
||||
_canEnable: function() {
|
||||
let extension = ExtensionUtils.extensions[this.uuid];
|
||||
let checkVersion = !this._settings.get_boolean('disable-extension-version-validation');
|
||||
|
||||
return !(checkVersion && ExtensionUtils.isOutOfDate(extension));
|
||||
},
|
||||
|
||||
_isEnabled: function() {
|
||||
let extensions = this._settings.get_strv('enabled-extensions');
|
||||
return extensions.indexOf(this.uuid) != -1;
|
||||
|
Loading…
Reference in New Issue
Block a user