From ce88a7b03231b59c57f832aa656b4763d7d1e77e Mon Sep 17 00:00:00 2001 From: Stan Janssen <12174852+stan-janssen@users.noreply.github.com> Date: Sun, 2 Apr 2023 12:26:49 +0200 Subject: [PATCH] Improved response to power state changes in Switchboard (#191) This resolves a problem if the user turns off Bluetooth in Switchboard, the Wingpanel indicator would immediately turn it back on (and vice versa). --- src/Services/Manager.vala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Services/Manager.vala b/src/Services/Manager.vala index bc164622..2e34f60a 100644 --- a/src/Services/Manager.vala +++ b/src/Services/Manager.vala @@ -115,7 +115,7 @@ public class BluetoothIndicator.Services.ObjectManager : Object { ((DBusProxy) adapter).g_properties_changed.connect ((changed, invalid) => { var powered = changed.lookup_value ("Powered", new VariantType ("b")); if (powered != null) { - set_last_state.begin (); + set_global_state.begin (powered.get_boolean ()); } }); } @@ -217,6 +217,7 @@ public class BluetoothIndicator.Services.ObjectManager : Object { } settings.set_boolean ("bluetooth-enabled", state); + check_global_state (); } public async void set_last_state () {