[Xfce4-commits] <xfce4-weather-plugin:master> Cache last download time for weather data.

Harald Judt noreply at xfce.org
Sat Jan 5 12:04:18 CET 2013


Updating branch refs/heads/master
         to 86132c6bbac9d8d8ce169c0e16e2ab4e34e2b6f9 (commit)
       from 88466c32734a1d33db0f04b0bc6f0ee9e5832b31 (commit)

commit 86132c6bbac9d8d8ce169c0e16e2ab4e34e2b6f9
Author: Harald Judt <h.judt at gmx.at>
Date:   Sat Jan 5 01:53:49 2013 +0100

    Cache last download time for weather data.

 panel-plugin/weather.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 7ab1769..d236f93 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -942,6 +942,11 @@ write_cache_file(plugin_data *data)
     value = double_to_string(data->timezone, "%.1f");
     CACHE_APPEND("timezone=%s\n", value);
     g_free(value);
+    if (G_LIKELY(data->weather_update)) {
+        value = format_date(data->weather_update->last, date_format, FALSE);
+        CACHE_APPEND("last_weather_download=%s\n", value);
+        g_free(value);
+    }
     now = format_date(now_t, date_format, FALSE);
     CACHE_APPEND("cache_date=%s\n\n", now);
     g_free(now);
@@ -1103,6 +1108,11 @@ read_cache_file(plugin_data *data)
         CACHE_FREE_VARS();
         return;
     }
+    if (G_LIKELY(data->weather_update)) {
+        CACHE_READ_STRING(timestring, "last_weather_download");
+        data->weather_update->last = parse_timestring(timestring, NULL);
+        g_free(timestring);
+    }
 
     /* read cached astrodata if available and up-to-date */
     group = "astrodata";


More information about the Xfce4-commits mailing list