bluetooth: Fix showing menu when devices were set up

Since commit 26c2cb9f65, nDevices is always the actual number of
paired/trusted devices. So when bluetooth is turned off, it is
now 0 rather than forced to 1 if devices were set up previously.

Fix this by checking the property that tracks set up devices instead.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1174
This commit is contained in:
Florian Müllner 2020-04-03 14:34:21 +02:00
parent d4db5a59c1
commit f4ba3e4ab8

View File

@ -109,7 +109,6 @@ class Indicator extends PanelMenu.SystemIndicator {
let devices = this._getDeviceInfos(adapter); let devices = this._getDeviceInfos(adapter);
const connectedDevices = devices.filter(dev => dev.connected); const connectedDevices = devices.filter(dev => dev.connected);
const nConnectedDevices = connectedDevices.length; const nConnectedDevices = connectedDevices.length;
const nDevices = devices.length;
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter; let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
@ -118,7 +117,7 @@ class Indicator extends PanelMenu.SystemIndicator {
// Remember if there were setup devices and show the menu // Remember if there were setup devices and show the menu
// if we've seen setup devices and we're not hard blocked // if we've seen setup devices and we're not hard blocked
if (nDevices > 0) if (this._hadSetupDevices)
this._item.visible = !this._proxy.BluetoothHardwareAirplaneMode; this._item.visible = !this._proxy.BluetoothHardwareAirplaneMode;
else else
this._item.visible = this._proxy.BluetoothHasAirplaneMode && !this._proxy.BluetoothAirplaneMode; this._item.visible = this._proxy.BluetoothHasAirplaneMode && !this._proxy.BluetoothAirplaneMode;