[gnome-shell/wip/snwh/appgrid-regression-fixes] status/bluetooth: Bail out and hide UI when there's no adapter
- From: Sam Hewitt <snwh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/snwh/appgrid-regression-fixes] status/bluetooth: Bail out and hide UI when there's no adapter
- Date: Mon, 21 Feb 2022 19:27:36 +0000 (UTC)
commit 1d9801e9b648dd2bca1db41be2ab1e7880f65ff2
Author: Jonas Dreßler <verdre v0yd nl>
Date: Mon Jan 31 23:40:39 2022 +0100
status/bluetooth: Bail out and hide UI when there's no adapter
While _sync() does already handle the case where there's no adapter just
fine (hiding the item and the indicator), let's make the handling a bit
more obvious and add an explicit check for !this._adapter where we bail
out and hide the UI.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2188>
js/ui/status/bluetooth.js | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js
index a7768c824e..d84bc3ad56 100644
--- a/js/ui/status/bluetooth.js
+++ b/js/ui/status/bluetooth.js
@@ -130,13 +130,20 @@ class Indicator extends PanelMenu.SystemIndicator {
}
_sync() {
- let devices = this._getDeviceInfos();
+ const adapterJustAppeared = !this._adapter && this._client.default_adapter;
+ this._adapter = this._client.default_adapter ?? null;
+ if (!this._adapter) {
+ this._item.visible = false;
+ this._indicator.visible = false;
+ return;
+ }
+
+ const devices = this._getDeviceInfos();
const connectedDevices = devices.filter(dev => dev.connected);
const nConnectedDevices = connectedDevices.length;
- if (this._client.default_adapter && this._adapter)
+ if (!adapterJustAppeared)
this._setHadSetupDevices(devices.length > 0);
- this._adapter = this._client.default_adapter ?? null;
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]