diff options
author | Giovanni Campagna <gcampagna@src.gnome.org> | 2012-12-01 18:55:49 +0100 |
---|---|---|
committer | Giovanni Campagna <gcampagna@src.gnome.org> | 2012-12-01 18:55:49 +0100 |
commit | 231d7adb0831bc838e1b5fc86529457e8920ce22 (patch) | |
tree | 61041335d5c19f3e7be95c8dcf63fcb148359be8 | |
parent | 2294d34c1b5d8682ac7c3039201b4c03b4efdf58 (diff) | |
download | libgweather-wip/forecasts.tar.gz |
Fix day/night icons for forecast infoswip/forecasts
We need to do the sun calculations for all GWeatherInfos, not just the
master one, as those values are used in get_icon_name().
Also, fix get_icon_name() to use the time the info refers to, not current
time.
-rw-r--r-- | libgweather/weather-iwin.c | 1 | ||||
-rw-r--r-- | libgweather/weather-yahoo.c | 3 | ||||
-rw-r--r-- | libgweather/weather.c | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/libgweather/weather-iwin.c b/libgweather/weather-iwin.c index 0a446e0..20add27 100644 --- a/libgweather/weather-iwin.c +++ b/libgweather/weather-iwin.c @@ -177,6 +177,7 @@ parseForecastXml (const char *buff, GWeatherInfo *master_info) for (i = 0; i < 7; i++) { GWeatherInfo *nfo = _gweather_info_new_clone (master_info); nfo->priv->update = update_times[i]; + calc_sun_time (nfo, nfo->priv->update); if (nfo) res = g_slist_append (res, nfo); diff --git a/libgweather/weather-yahoo.c b/libgweather/weather-yahoo.c index 0e8be62..5bb864b 100644 --- a/libgweather/weather-yahoo.c +++ b/libgweather/weather-yahoo.c @@ -201,6 +201,9 @@ make_info_from_node (GWeatherInfo *master_info, priv->valid = FALSE; xmlFree (val); + /* Calculate sun to get the right icon */ + calc_sun_time (info, info->priv->update); + return info; } diff --git a/libgweather/weather.c b/libgweather/weather.c index ae8d89a..4952106 100644 --- a/libgweather/weather.c +++ b/libgweather/weather.c @@ -327,7 +327,7 @@ requests_init (GWeatherInfo *info) void request_done (GWeatherInfo *info, gboolean ok) { if (ok) { - (void) calc_sun (info); + calc_sun_time (info, info->priv->update); info->priv->moonValid = info->priv->valid && calc_moon (info); } if (!--info->priv->requests_pending) @@ -1187,7 +1187,7 @@ gweather_info_get_icon_name (GWeatherInfo *info) else if (priv->polarNight) daytime = FALSE; else { - current_time = time (NULL); + current_time = priv->update; daytime = ( !priv->sunriseValid || (current_time >= priv->sunrise) ) && ( !priv->sunsetValid || (current_time < priv->sunset) ); |