[gnome-shell/wip/hadess/simplify-showing-bt-switch: 1/2] bluetooth: Show the Bluetooth switch in more cases




commit 58850e788790ea49d3c5d57ddf4dda820498677b
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Sep 15 18:03:22 2022 +0200

    bluetooth: Show the Bluetooth switch in more cases
    
    In older versions of GNOME, when a menu was used for Bluetooth devices,
    we tried to avoid showing the Bluetooth menu to folks who didn't use
    Bluetooth.
    
    This kept causing problems as the menu would disappear if no
    devices were setup and the platform "airplane mode" removed the
    Bluetooth device from the USB bus, making it impossible to detect
    whether a Bluetooth device existed, compared to a user unplugging a
    removable Bluetooth device.
    
    Closes: #5749

 js/ui/status/bluetooth.js | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js
index d4de597ad7..cc0f7b3b83 100644
--- a/js/ui/status/bluetooth.js
+++ b/js/ui/status/bluetooth.js
@@ -79,21 +79,19 @@ const BtClient = GObject.registerClass({
             this._connectDeviceNotify(deviceStore.get_item(i));
 
         this._client.connect('device-removed', (c, path) => {
-            this._syncHadSetupDevices();
             this._deviceNotifyConnected.delete(path);
             this.emit('devices-changed');
         });
         this._client.connect('device-added', (c, device) => {
-            this._syncHadSetupDevices();
             this._connectDeviceNotify(device);
             this.emit('devices-changed');
         });
     }
 
     get available() {
-        // If there were set up devices, assume there is an adapter
-        // that can be powered on as long as we're not hard blocked
-        return this._hadSetupDevices
+        // If we have an rfkill switch, make sure it's not a hardware
+        // one as we can't get out of it in software
+        return this._proxy.BluetoothHasAirplaneMode
             ? !this._proxy.BluetoothHardwareAirplaneMode
             : this.active;
     }


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