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>
This commit is contained in:
Jonas Dreßler 2022-01-31 23:40:39 +01:00 committed by Marge Bot
parent 109e2968e2
commit aaf47167b5

View File

@ -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;