weather: Fix warning on closing Weather

GDBusProxy::g-properties-changed is also emitted when the name drops from
the bus, at which point any properties will be null. That's not a valid
gsettings value, so to avoid the corresponding warning, move the g-name-owner
check accordingly.

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

View File

@ -153,12 +153,13 @@ var WeatherClient = class {
this._weatherProxy.connect('g-properties-changed', this._weatherProxy.connect('g-properties-changed',
this._onWeatherPropertiesChanged.bind(this)); this._onWeatherPropertiesChanged.bind(this));
this._onWeatherPropertiesChanged();
if (this._weatherProxy.g_name_owner != null)
this._onWeatherPropertiesChanged();
} }
_onWeatherPropertiesChanged() { _onWeatherPropertiesChanged() {
if (this._weatherProxy.g_name_owner == null)
return;
this._settings.set_boolean('automatic-location', this._settings.set_boolean('automatic-location',
this._weatherProxy.AutomaticLocation); this._weatherProxy.AutomaticLocation);
this._settings.set_value('locations', this._settings.set_value('locations',