[gnome-shell/gnome-3-36] extensions-app: Reset switch handle when it becomes insensitive



commit 28407c95b328d18ecc67d7ad097b3dce9efaa365
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon May 18 12:24:16 2020 +0000

    extensions-app: Reset switch handle when it becomes insensitive
    
    Currently the switches handle position reflects the requested
    extension state (as in: the user (de)activated the switch),
    while the actual extension state is reflected by the underlying
    state.
    
    That doesn't work well when the switch is insensitive though (for
    example on error), because the desaturation neuters the color
    that reflects the state.
    
    Address this by resetting the switch handle to the state when
    making it insensitive.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1263
    
    
    (cherry picked from commit d2583aa47bd716f196bd1d171d9d134e2bed5d80)

 subprojects/extensions-app/data/ui/extension-row.ui | 2 +-
 subprojects/extensions-app/js/main.js               | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/subprojects/extensions-app/data/ui/extension-row.ui 
b/subprojects/extensions-app/data/ui/extension-row.ui
index f54ab3c760..4753cbc239 100644
--- a/subprojects/extensions-app/data/ui/extension-row.ui
+++ b/subprojects/extensions-app/data/ui/extension-row.ui
@@ -54,7 +54,7 @@
           </object>
         </child>
         <child>
-          <object class="GtkSwitch">
+          <object class="GtkSwitch" id="switch">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="valign">center</property>
diff --git a/subprojects/extensions-app/js/main.js b/subprojects/extensions-app/js/main.js
index 8b47c7b031..431be326b5 100644
--- a/subprojects/extensions-app/js/main.js
+++ b/subprojects/extensions-app/js/main.js
@@ -334,6 +334,7 @@ var ExtensionRow = GObject.registerClass({
         'versionLabel',
         'authorLabel',
         'updatesIcon',
+        'switch',
         'revealButton',
         'revealer',
     ],
@@ -453,6 +454,9 @@ var ExtensionRow = GObject.registerClass({
         action.set_state(new GLib.Variant('b', state));
         action.enabled = this._canToggle();
 
+        if (!action.enabled)
+            this._switch.active = state;
+
         this._updatesIcon.visible = this.hasUpdate;
 
         this._versionLabel.label = this.version.toString();


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