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>
This commit is contained in:
Florian Müllner 2022-02-09 20:23:30 +01:00 committed by Marge Bot
parent 5628849a40
commit 78c7d5ba0c

View File

@ -238,8 +238,10 @@ class Indicator extends PanelMenu.SystemIndicator {
this.menu.addMenuItem(this._item); this.menu.addMenuItem(this._item);
this._inUseId = this._agent.connect('notify::in-use', this._updateMenuLabels.bind(this)); this._agentSignals = [
this._maxAccuracyId = this._agent.connect('notify::max-accuracy-level', this._updateMenuLabels.bind(this)); this._agent.connect('notify::enabled', () => this._sync()),
this._agent.connect('notify::in-use', () => this._sync()),
];
this.connect('destroy', this._onDestroy.bind(this)); this.connect('destroy', this._onDestroy.bind(this));
@ -248,8 +250,8 @@ class Indicator extends PanelMenu.SystemIndicator {
} }
_onDestroy() { _onDestroy() {
this._agent.disconnect(this._inUseId); this._agentSignals.forEach(id => this._agent.disconnect(id));
this._agent.disconnect(this._maxAccuracyId); this._agentSignals = [];
} }
_onSessionUpdated() { _onSessionUpdated() {
@ -257,7 +259,7 @@ class Indicator extends PanelMenu.SystemIndicator {
this.menu.setSensitive(sensitive); this.menu.setSensitive(sensitive);
} }
_updateMenuLabels() { _sync() {
if (this._agent.enabled) { if (this._agent.enabled) {
this._item.label.text = this._indicator.visible this._item.label.text = this._indicator.visible
? _('Location In Use') ? _('Location In Use')