weather: Pick up original settings values

We mirror Weather's location settings to not depend on the app running,
but then don't read the original values, oops.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1158
This commit is contained in:
Florian Müllner 2019-08-01 13:18:43 +00:00 committed by Georges Basile Stavracas Neto
parent ad55cb6d5d
commit ec6e1315a5

View File

@ -94,8 +94,10 @@ var WeatherClient = class {
}); });
this._settings.connect('changed::automatic-location', this._settings.connect('changed::automatic-location',
this._onAutomaticLocationChanged.bind(this)); this._onAutomaticLocationChanged.bind(this));
this._onAutomaticLocationChanged();
this._settings.connect('changed::locations', this._settings.connect('changed::locations',
this._onLocationsChanged.bind(this)); this._onLocationsChanged.bind(this));
this._onLocationsChanged();
this._appSystem = Shell.AppSystem.get_default(); this._appSystem = Shell.AppSystem.get_default();
this._appSystem.connect('installed-changed', this._appSystem.connect('installed-changed',
@ -259,8 +261,8 @@ var WeatherClient = class {
this._setLocation(location); this._setLocation(location);
} }
_onAutomaticLocationChanged(settings, key) { _onAutomaticLocationChanged() {
let useAutoLocation = settings.get_boolean(key); let useAutoLocation = this._settings.get_boolean('automatic-location');
if (this._autoLocationRequested == useAutoLocation) if (this._autoLocationRequested == useAutoLocation)
return; return;
@ -278,8 +280,9 @@ var WeatherClient = class {
this._setLocation(this._mostRecentLocation); this._setLocation(this._mostRecentLocation);
} }
_onLocationsChanged(settings, key) { _onLocationsChanged() {
let serialized = settings.get_value(key).deep_unpack().shift(); let locations = this._settings.get_value('locations').deep_unpack();
let serialized = locations.shift();
let mostRecentLocation = null; let mostRecentLocation = null;
if (serialized) if (serialized)