[Xfce4-commits] <xfce4-weather-plugin:master> Fix night time icon update after astrodata download.
Harald Judt
noreply at xfce.org
Thu Jan 24 11:32:01 CET 2013
Updating branch refs/heads/master
to b450897eba69c3e79447748bac67393f6c9fd894 (commit)
from 08a0a4981492d8fa6fc06f8864da619cba3c2e10 (commit)
commit b450897eba69c3e79447748bac67393f6c9fd894
Author: Harald Judt <h.judt at gmx.at>
Date: Wed Jan 23 14:57:03 2013 +0100
Fix night time icon update after astrodata download.
Immediately update the night time status and icon after astrodata download.
Additionally, invalidate obsolete sunrise/sunset data so that the icon
is always updated correctly.
panel-plugin/weather.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 74c6d40..5dc8453 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -474,7 +474,21 @@ cb_astro_update(SoupSession *session,
data->astro_update->attempt++;
data->astro_update->next = calc_next_download_time(data->astro_update,
now_t);
+
+ /* invalidate obsolete sunrise/sunset data */
+ if (data->astrodata != NULL &&
+ difftime(data->astrodata->sunset, now_t) < 0 &&
+ difftime(data->astrodata->sunrise, now_t) < 0) {
+ xml_astro_free(data->astrodata);
+ data->astrodata = NULL;
+ weather_debug("Obsolete astronomical data has been invalidated.");
+ }
}
+
+ /* update icon */
+ data->night_time = is_night_time(data->astrodata);
+ update_icon(data);
+
schedule_next_wakeup(data);
weather_dump(weather_dump_astrodata, data->astrodata);
}
More information about the Xfce4-commits
mailing list