[gnome-shell/wip/rstrode/login-screen-extensions: 25/134] status/network: Disable modem connection when windows aren't allowed




commit b67774827a095455b46ebe139249f4404159b0ab
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Jun 7 17:49:57 2021 +0200

    status/network: Disable modem connection when windows aren't allowed
    
    The item launches the corresponding Settings panel when activated, which
    doesn't work when windows are disabled by the session mode. Rather than
    failing silently, turn the item insensitive.

 js/ui/status/network.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 421d2e7d23..99cabc256c 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -523,6 +523,10 @@ var NMDeviceModem = class extends NMConnectionDevice {
                 this._iconChanged();
             });
         }
+
+        this._sessionUpdatedId =
+            Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
+        this._sessionUpdated();
     }
 
     get category() {
@@ -534,6 +538,10 @@ var NMDeviceModem = class extends NMConnectionDevice {
                     'connect-3g', this._device.get_path()]);
     }
 
+    _sessionUpdated() {
+        this._autoConnectItem.sensitive = Main.sessionMode.hasWindows;
+    }
+
     destroy() {
         if (this._operatorNameId) {
             this._mobileDevice.disconnect(this._operatorNameId);
@@ -543,6 +551,10 @@ var NMDeviceModem = class extends NMConnectionDevice {
             this._mobileDevice.disconnect(this._signalQualityId);
             this._signalQualityId = 0;
         }
+        if (this._sessionUpdatedId) {
+            Main.sessionMode.disconnect(this._sessionUpdatedId);
+            this._sessionUpdatedId = 0;
+        }
 
         super.destroy();
     }


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