[Xfce4-commits] <xfce4-weather-plugin:master> Add make_cache_filename() helper function.

Harald Judt noreply at xfce.org
Sun Dec 9 23:44:21 CET 2012


Updating branch refs/heads/master
         to ec83b55e004d7b66c2db064e5ebcc5af9796f507 (commit)
       from a822fe9ac482aaabbf362223673fcfd63a68c9bc (commit)

commit ec83b55e004d7b66c2db064e5ebcc5af9796f507
Author: Harald Judt <h.judt at gmx.at>
Date:   Sun Dec 9 19:24:37 2012 +0100

    Add make_cache_filename() helper function.

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

diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 2c3ceed..89ee0fc 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -681,6 +681,26 @@ xfceweather_write_config(XfcePanelPlugin *plugin,
 }
 
 
+/*
+ * Generate file name for the weather data cache file.
+ */
+static gchar *
+make_cache_filename(xfceweather_data *data)
+{
+    gchar *cache_dir, *file;
+
+    if (G_UNLIKELY(data->lat == NULL || data->lon == NULL))
+        return NULL;
+
+    cache_dir = get_cache_directory();
+    file = g_strdup_printf("%s%sweatherdata_%s_%s_%d",
+                           cache_dir, G_DIR_SEPARATOR_S,
+                           data->lat, data->lon, data->msl);
+    g_free(cache_dir);
+    return file;
+}
+
+
 void
 update_weatherdata_with_reset(xfceweather_data *data, gboolean clear)
 {


More information about the Xfce4-commits mailing list