[libgweather/wip/hadess/serialisation-fix: 4/18] GWeatherLocation: Don't use a city as a weather station
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/wip/hadess/serialisation-fix: 4/18] GWeatherLocation: Don't use a city as a weather station
- Date: Tue, 9 Oct 2018 18:22:47 +0000 (UTC)
commit 3c29671026ef657f1bde02c6f71a602a0de49803
Author: Bastien Nocera <hadess hadess net>
Date: Tue Oct 9 17:28:31 2018 +0200
GWeatherLocation: Don't use a city as a weather station
Don't use cities as the nearest weather station to another city, it
makes no sense.
libgweather/gweather-location.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index b5aa8e5..4e9f1c6 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -160,6 +160,9 @@ add_nearest_weather_station (GWeatherLocation *location)
if (siblings[i] == location)
continue;
+ if (siblings[i]->level != GWEATHER_LOCATION_WEATHER_STATION)
+ continue;
+
/* Skip siblings without valid coordinates */
if (!siblings[i]->latlon_valid)
continue;
@@ -183,7 +186,7 @@ add_nearest_weather_station (GWeatherLocation *location)
station->local_sort_name = g_strdup (closest->local_sort_name);
station->english_sort_name = g_strdup (closest->english_sort_name);
station->parent = location;
- station->level = closest->level;
+ station->level = GWEATHER_LOCATION_WEATHER_STATION;
station->country_code = g_strdup (closest->country_code);
station->tz_hint = g_strdup (closest->tz_hint);
station->station_code = g_strdup (closest->station_code);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]