From bde127b8933b249f9cc8fbeba9989b5e5c8ae90d Mon Sep 17 00:00:00 2001 From: Andre Moreira Magalhaes Date: Fri, 31 Jul 2020 18:11:48 -0300 Subject: [PATCH] rfkill: Always sync state on construction This fixes an issue where the indicator can be out of sync until the RfkillManager (used by it) properties change. The problem is that multiple instances of the indicator will use the same RfkillManager instance (getRfkillManager() returns a singleton) that only guarantees to emit the changed signal in two scenarios: when the D-Bus proxy connects and when the proxy properties change. If by the time an indicator is instantiated the RfkillManager's D-Bus proxy is already connected, that indicator would only sync its state when the RfkillManager properties change. Let's fix that by always syncing the state on construction - in the worst case scenario the RfkillManager's D-Bus proxy won't have connected yet and the indicator state will be temporarily out of sync but once it gets connected the indicator will sync again with the correct state. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1386 --- js/ui/status/rfkill.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/ui/status/rfkill.js b/js/ui/status/rfkill.js index 658116e2e..9f8b09dd2 100644 --- a/js/ui/status/rfkill.js +++ b/js/ui/status/rfkill.js @@ -86,6 +86,8 @@ class Indicator extends PanelMenu.SystemIndicator { Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); this._sessionUpdated(); + + this._sync(); } _sessionUpdated() {