[gnome-shell] status/network: Keep sensitive when locked



commit dc09f990c4a007bd2ce90ec1f6cdc3cc6452e4cf
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Aug 7 02:10:22 2022 +0200

    status/network: Keep sensitive when locked
    
    Unlike the old menu that restricted almost everything on the lock
    screen, we went into the completely opposite direction with quick
    settings and kept everything that does not launch windows available.
    
    Extend that line to the network items, but still respect the
    `network-control` permission.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>

 js/ui/status/network.js | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 14df7978bc..5a351789e6 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1890,20 +1890,16 @@ class Indicator extends PanelMenu.SystemIndicator {
         try {
             this._configPermission = await Polkit.Permission.new(
                 'org.freedesktop.NetworkManager.network-control', null, null);
+
+            this._allSections.forEach(section => {
+                this._configPermission.bind_property('allowed',
+                    section, 'reactive',
+                    GObject.BindingFlags.SYNC_CREATE);
+            });
         } catch (e) {
             log(`No permission to control network connections: ${e}`);
             this._configPermission = null;
         }
-
-        Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
-        this._sessionUpdated();
-    }
-
-    _sessionUpdated() {
-        const sensitive =
-            !Main.sessionMode.isLocked &&
-            this._configPermission && this._configPermission.allowed;
-        this.menu.setSensitive(sensitive);
     }
 
     _onActivationFailed() {


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