[gnome-shell] weather: Disentangle _useAutoLocation from Weather setting
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] weather: Disentangle _useAutoLocation from Weather setting
- Date: Mon, 20 Mar 2017 18:14:25 +0000 (UTC)
commit 7c9f76944b2910d8da444200c031a35f2ac063d3
Author: Florian Müllner <fmuellner gnome org>
Date: Sun Mar 19 16:34:53 2017 +0100
weather: Disentangle _useAutoLocation from Weather setting
We currently use automatic location for weather forecasts if the
corresponding Weather setting is set, however we should take other
factors into account as well:
- whether location services are enabled at all
- whether Weather has been authorized to use them
In preparation of these changes, track the setting's value in a
separate property and make _useAutoLocation a getter, so we can
extend it with additional conditions easily.
https://bugzilla.gnome.org/show_bug.cgi?id=780252
js/misc/weather.js | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/js/misc/weather.js b/js/misc/weather.js
index 775d053..04e3295 100644
--- a/js/misc/weather.js
+++ b/js/misc/weather.js
@@ -20,7 +20,7 @@ const WeatherClient = new Lang.Class({
this._locationValid = false;
this._lastUpdate = GLib.DateTime.new_from_unix_local(0);
- this._useAutoLocation = false;
+ this._autoLocationRequested = false;
this._mostRecentLocation = null;
this._gclueService = null;
@@ -81,6 +81,10 @@ const WeatherClient = new Lang.Class({
this._loadInfo();
},
+ get _useAutoLocation() {
+ return this._autoLocationRequested;
+ },
+
_loadInfo: function() {
let id = this._weatherInfo.connect('updated', () => {
this._weatherInfo.disconnect(id);
@@ -165,10 +169,10 @@ const WeatherClient = new Lang.Class({
_onAutomaticLocationChanged: function(settings, key) {
let useAutoLocation = settings.get_boolean(key);
- if (this._useAutoLocation == useAutoLocation)
+ if (this._autoLocationRequested == useAutoLocation)
return;
- this._useAutoLocation = useAutoLocation;
+ this._autoLocationRequested = useAutoLocation;
this._updateLocationMonitoring();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]