[gnome-shell] rfkill: Consider HasAirplaneMode



commit e062e96ae6c09bc4d981a491af8a986d5c451fa5
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Jul 18 20:47:47 2022 +0200

    rfkill: Consider HasAirplaneMode
    
    `ShouldShowAirplaneMode` only considers whether airplane mode
    should be shown for the form factor, not whether there are
    any actual kill switches available.
    
    That's tracked in a separate property, `HasAirplaneMode`.
    
    Take that into account for our `:show-airplane-mode` property,
    so that it reflects when airplane mode should and *can* be shown.
    
    Right now we only show airplane mode when it is enabled (and
    therefore available), but this will change in the future.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2385>

 data/dbus-interfaces/org.gnome.SettingsDaemon.Rfkill.xml | 1 +
 js/ui/status/rfkill.js                                   | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/data/dbus-interfaces/org.gnome.SettingsDaemon.Rfkill.xml 
b/data/dbus-interfaces/org.gnome.SettingsDaemon.Rfkill.xml
index 628b17ff98..bde65f9571 100644
--- a/data/dbus-interfaces/org.gnome.SettingsDaemon.Rfkill.xml
+++ b/data/dbus-interfaces/org.gnome.SettingsDaemon.Rfkill.xml
@@ -1,6 +1,7 @@
 <node>
   <interface name="org.gnome.SettingsDaemon.Rfkill">
     <property name="AirplaneMode" type="b" access="readwrite"/>
+    <property name="HasAirplaneMode" type="b" access="read"/>
     <property name="HardwareAirplaneMode" type="b" access="read"/>
     <property name="BluetoothAirplaneMode" type="b" access="readwrite"/>
     <property name="BluetoothHasAirplaneMode" type="b" access="read"/>
diff --git a/js/ui/status/rfkill.js b/js/ui/status/rfkill.js
index 332d1643f4..798d771cd0 100644
--- a/js/ui/status/rfkill.js
+++ b/js/ui/status/rfkill.js
@@ -60,7 +60,7 @@ const RfkillManager = GObject.registerClass({
     }
 
     get show_airplane_mode() {
-        return this._proxy.ShouldShowAirplaneMode;
+        return this._proxy.HasAirplaneMode && this._proxy.ShouldShowAirplaneMode;
     }
     /* eslint-enable camelcase */
 
@@ -73,6 +73,7 @@ const RfkillManager = GObject.registerClass({
             case 'HardwareAirplaneMode':
                 this.notify('hw-airplane-mode');
                 break;
+            case 'HasAirplaneMode':
             case 'ShouldShowAirplaneMode':
                 this.notify('show-airplane-mode');
                 break;


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