summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2019-08-27 15:07:35 +0300
committerBastien Nocera <hadess@hadess.net>2019-08-27 15:07:35 +0300
commitd45d5a84c4a836f081dd01bf703e23f5b651bc29 (patch)
treee7f23bbb09a1e735bd52f587af76bf8e1af8d218
parent5240f2ffee96078d2de02c608aa10a6f435b7ec3 (diff)
downloadlibgweather-d45d5a84c4a836f081dd01bf703e23f5b651bc29.tar.gz
yrno: Fix forecasts never being available because invalid
yrno was never setting the "valid" flag on the main info struct, just on each one of the info structs created to hold the forecasts, so it was impossible to get the forecasts unless *another* provider succeeded. This fixes fetching forecasts for Helsinki, as METAR fetching fails and YR.NO didn't set the valid flag. Closes: #11
-rw-r--r--libgweather/weather-yrno.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libgweather/weather-yrno.c b/libgweather/weather-yrno.c
index ace74e9..e47dd35 100644
--- a/libgweather/weather-yrno.c
+++ b/libgweather/weather-yrno.c
@@ -391,6 +391,7 @@ yrno_finish_new (SoupSession *session,
GWeatherInfo *info = GWEATHER_INFO (user_data);
GWeatherInfoPrivate *priv;
WeatherLocation *loc;
+ guint num_forecasts;
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
/* forecast data is not really interesting anyway ;) */
@@ -407,6 +408,10 @@ yrno_finish_new (SoupSession *session,
g_debug ("%s", msg->response_body->data);
parse_forecast_xml_new (info, msg->response_body);
+ num_forecasts = g_slist_length (priv->forecast_list);
+ g_debug ("yrno parsed %d forecast infos", num_forecasts);
+ if (!priv->valid)
+ priv->valid = (num_forecasts > 0);
_gweather_info_request_done (info, msg);
}