[gnome-shell] status/bluetooth: Clear list of connected signals on adapter changes
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] status/bluetooth: Clear list of connected signals on adapter changes
- Date: Sat, 26 Feb 2022 15:59:07 +0000 (UTC)
commit eeabdd150c70ff003a5cca60039ec8f2c4e5dbd0
Author: Jonas Dreßler <verdre v0yd nl>
Date: Thu Feb 24 19:35:06 2022 +0100
status/bluetooth: Clear list of connected signals on adapter changes
With the porting of gnome-bluetooth to the new GListModel API the
behavior regarding removing adapters changed: It now no longer
guarantees to emit "device-removed" signals for the paired devices when
the adapter gets removed.
This means we need to do that ourselves now, so clear the list of
connected signals when the default adapter changes.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2214>
js/ui/status/bluetooth.js | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js
index 187e106357..5e985dd1af 100644
--- a/js/ui/status/bluetooth.js
+++ b/js/ui/status/bluetooth.js
@@ -27,6 +27,17 @@ class Indicator extends PanelMenu.SystemIndicator {
this._hadSetupDevices = global.settings.get_boolean(HAD_BLUETOOTH_DEVICES_SETUP);
this._client = new GnomeBluetooth.Client();
+ this._client.connect('notify::default-adapter', () => {
+ const newAdapter = this._client.default_adapter ?? null;
+
+ if (newAdapter && this._adapter)
+ this._setHadSetupDevices(this._getDeviceInfos().length > 0);
+
+ this._adapter = newAdapter;
+
+ this._deviceNotifyConnected.clear();
+ this._sync();
+ });
this._client.connect('notify::default-adapter-powered', this._sync.bind(this));
this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
@@ -133,10 +144,6 @@ class Indicator extends PanelMenu.SystemIndicator {
const connectedDevices = devices.filter(dev => dev.connected);
const nConnectedDevices = connectedDevices.length;
- if (this._client.default_adapter && this._adapter)
- this._setHadSetupDevices(devices.length > 0);
- this._adapter = this._client.default_adapter ?? null;
-
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
this.menu.setSensitive(sensitive);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]