[gnome-shell/benzea/systemd-user-units: 7/12] extensionPrefs: Allow disabling extensions when globally disabled



commit a36134dae3eb336a7387674949b5d7a609007b41
Author: Benjamin Berg <bberg redhat com>
Date:   Thu Aug 1 16:48:56 2019 +0200

    extensionPrefs: Allow disabling extensions when globally disabled
    
    To do this, simply use the new isEnabled property to properly reflect
    the underlying settings key rather than the actual loaded state of the
    extension.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/507

 js/extensionPrefs/main.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js
index 158ab1a5b..fa6cded5d 100644
--- a/js/extensionPrefs/main.js
+++ b/js/extensionPrefs/main.js
@@ -602,8 +602,11 @@ class ExtensionRow extends Gtk.ListBoxRow {
 
                 this._extension = ExtensionUtils.deserializeExtension(newState);
                 let state = (this._extension.state == ExtensionState.ENABLED);
+                this._switch.freeze_notify();
                 this._switch.state = state;
+                this._switch.active = this._extension.isEnabled;
                 this._switch.sensitive = this._canToggle();
+                this._switch.thaw_notify();
             });
 
         this.connect('destroy', this._onDestroy.bind(this));
@@ -672,7 +675,6 @@ class ExtensionRow extends Gtk.ListBoxRow {
         this._switch = new Gtk.Switch({
             valign: Gtk.Align.CENTER,
             sensitive: this._canToggle(),
-            state: this._extension.state === ExtensionState.ENABLED
         });
         this._switch.connect('notify::active', () => {
             if (this._switch.active)
@@ -681,6 +683,11 @@ class ExtensionRow extends Gtk.ListBoxRow {
                 this._app.shellProxy.DisableExtensionRemote(this.uuid);
         });
         this._switch.connect('state-set', () => true);
+        this._switch.freeze_notify();
+        this._switch.state = this._extension.state === ExtensionState.ENABLED;
+        this._switch.active = this._extension.isEnabled;
+        this._switch.thaw_notify();
+
         hbox.add(this._switch);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]