[gnome-shell/wip/hadess/new-gnome-bluetooth: 2/2] status/bluetooth: Fix wedged state
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/hadess/new-gnome-bluetooth: 2/2] status/bluetooth: Fix wedged state
- Date: Wed, 19 Jan 2022 12:12:52 +0000 (UTC)
commit 20a97beed0e0f5c4c88f82cef20e3d5e1c0d37b3
Author: Bastien Nocera <hadess hadess net>
Date: Tue Jan 18 11:14:47 2022 +0100
status/bluetooth: Fix wedged state
Fix a state where toggling the main Bluetooth switch in the header will
always show the "Bluetooth Off" menu header with "Turn Off" as the only
option.
To reproduce, with Bluetooth enabled and working, run
"hciconfig hci0 down" as root, and check the status menu.
See gnome-bluetooth!102 and gnome-control-center!1148
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4857
js/ui/status/bluetooth.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js
index 8cd577cbb3..6c1e46febb 100644
--- a/js/ui/status/bluetooth.js
+++ b/js/ui/status/bluetooth.js
@@ -25,6 +25,7 @@ class Indicator extends PanelMenu.SystemIndicator {
this._indicator = this._addIndicator();
this._indicator.icon_name = 'bluetooth-active-symbolic';
this._hadSetupDevices = global.settings.get_boolean(HAD_BLUETOOTH_DEVICES_SETUP);
+ this._client = new GnomeBluetooth.Client();
this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
(proxy, error) => {
@@ -43,6 +44,8 @@ class Indicator extends PanelMenu.SystemIndicator {
this._toggleItem = new PopupMenu.PopupMenuItem('');
this._toggleItem.connect('activate', () => {
this._proxy.BluetoothAirplaneMode = !this._proxy.BluetoothAirplaneMode;
+ if (!this._proxy.BluetoothAirplaneMode)
+ this._client.default_adapter_powered = true;
});
this._item.menu.addMenuItem(this._toggleItem);
@@ -52,7 +55,6 @@ class Indicator extends PanelMenu.SystemIndicator {
this._syncId = 0;
this._adapter = null;
- this._client = new GnomeBluetooth.Client();
this._store = this._client.get_devices();
this._deviceNotifyConnected = [];
this._client.connect('device-removed', (c, path) => {
@@ -146,6 +148,6 @@ class Indicator extends PanelMenu.SystemIndicator {
else
this._item.label.text = _('Bluetooth On');
- this._toggleItem.label.text = this._proxy.BluetoothAirplaneMode ? _('Turn On') : _('Turn Off');
+ this._toggleItem.label.text = this._proxy.BluetoothAirplaneMode &&
this._client.default_adapter_powered ? _('Turn On') : _('Turn Off');
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]