[gnome-shell] status/location: Track enabled state



commit 78c7d5ba0c608ca4586416c861619cd8b6bb61c8
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Feb 9 20:23:30 2022 +0100

    status/location: Track enabled state
    
    More fallout from commit e3a1d84992: We are tracking the agent's
    :max-accuracy-level property that we don't use, but not :enabled.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5043
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2170>

 js/ui/status/location.js | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/status/location.js b/js/ui/status/location.js
index 547c8347ad..f4b425c022 100644
--- a/js/ui/status/location.js
+++ b/js/ui/status/location.js
@@ -238,8 +238,10 @@ class Indicator extends PanelMenu.SystemIndicator {
 
         this.menu.addMenuItem(this._item);
 
-        this._inUseId = this._agent.connect('notify::in-use', this._updateMenuLabels.bind(this));
-        this._maxAccuracyId = this._agent.connect('notify::max-accuracy-level', 
this._updateMenuLabels.bind(this));
+        this._agentSignals = [
+            this._agent.connect('notify::enabled', () => this._sync()),
+            this._agent.connect('notify::in-use', () => this._sync()),
+        ];
 
         this.connect('destroy', this._onDestroy.bind(this));
 
@@ -248,8 +250,8 @@ class Indicator extends PanelMenu.SystemIndicator {
     }
 
     _onDestroy() {
-        this._agent.disconnect(this._inUseId);
-        this._agent.disconnect(this._maxAccuracyId);
+        this._agentSignals.forEach(id => this._agent.disconnect(id));
+        this._agentSignals = [];
     }
 
     _onSessionUpdated() {
@@ -257,7 +259,7 @@ class Indicator extends PanelMenu.SystemIndicator {
         this.menu.setSensitive(sensitive);
     }
 
-    _updateMenuLabels() {
+    _sync() {
         if (this._agent.enabled) {
             this._item.label.text = this._indicator.visible
                 ? _('Location In Use')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]