status/bluetooth: Ignore devices when turned off

gnome-bluetooth clears the list of devices when the adapter goes
away, but we cannot assume that that'll happen when powered down.

We don't want to show a (potentially outdated) list of devices
that cannot be interacted with in that case, so explicitly check
for the active state when returning devices.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2658>
This commit is contained in:
Florian Müllner 2023-02-23 19:03:38 +01:00 committed by Marge Bot
parent 4920cf1eb6
commit 732d0980d8

View File

@ -134,6 +134,10 @@ const BtClient = GObject.registerClass({
} }
*getDevices() { *getDevices() {
// Ignore any lingering device references when turned off
if (!this.active)
return;
const deviceStore = this._client.get_devices(); const deviceStore = this._client.get_devices();
for (let i = 0; i < deviceStore.get_n_items(); i++) { for (let i = 0; i < deviceStore.get_n_items(); i++) {