[gnome-shell/gnome-41] status/location: Use correct enabled state



commit e72b00569848a0119f9bd837a74d8c1d370e230b
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Feb 9 20:26:26 2022 +0100

    status/location: Use correct enabled state
    
    Commit e3a1d84992 split out the agent from the indicator, but kept
    using a local 'enabled' property with no connection at all to the
    actual state.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5043
    
    (cherry picked from commit 5628849a405e42410cb19adb2bd9f92f7b88d8e6)
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2180>

 js/ui/status/location.js | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/status/location.js b/js/ui/status/location.js
index 7e0222b72c..547c8347ad 100644
--- a/js/ui/status/location.js
+++ b/js/ui/status/location.js
@@ -232,7 +232,8 @@ class Indicator extends PanelMenu.SystemIndicator {
             GObject.BindingFlags.SYNC_CREATE);
 
         this._item.label.text = _('Location Enabled');
-        this._onOffAction = this._item.menu.addAction(_('Disable'), this._onOnOffAction.bind(this));
+        this._onOffAction = this._item.menu.addAction(_('Disable'),
+            () => (this._agent.enabled = !this._agent.enabled));
         this._item.menu.addSettingsAction(_('Privacy Settings'), 'gnome-location-panel.desktop');
 
         this.menu.addMenuItem(this._item);
@@ -251,17 +252,13 @@ class Indicator extends PanelMenu.SystemIndicator {
         this._agent.disconnect(this._maxAccuracyId);
     }
 
-    _onOnOffAction() {
-        this.enabled = !this.enabled;
-    }
-
     _onSessionUpdated() {
         let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
         this.menu.setSensitive(sensitive);
     }
 
     _updateMenuLabels() {
-        if (this.enabled) {
+        if (this._agent.enabled) {
             this._item.label.text = this._indicator.visible
                 ? _('Location In Use')
                 : _('Location Enabled');


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