From 593acb954d096dcc656176eefb8ef55dcf9b2394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 6 Sep 2014 15:27:52 +0200 Subject: [PATCH] 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 --- js/extensionPrefs/main.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js index f56e5b6d4..e4d2e96bd 100644 --- a/js/extensionPrefs/main.js +++ b/js/extensionPrefs/main.js @@ -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;