[Xfce4-commits] <xfce4-weather-plugin:master> Add struct to store units configuration.

Harald Judt noreply at xfce.org
Tue Nov 27 16:46:09 CET 2012


Updating branch refs/heads/master
         to 83aa4604e881e9e1dd893d35b8588e14644ded98 (commit)
       from 3f0f65deee4f534daf5ffe6be5ecac40c176124a (commit)

commit 83aa4604e881e9e1dd893d35b8588e14644ded98
Author: Harald Judt <h.judt at gmx.at>
Date:   Fri Nov 23 11:46:16 2012 +0100

    Add struct to store units configuration.

 panel-plugin/weather-data.h |    8 ++++++++
 panel-plugin/weather.c      |    4 ++++
 panel-plugin/weather.h      |    2 ++
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/panel-plugin/weather-data.h b/panel-plugin/weather-data.h
index 59091bd..33d30f2 100644
--- a/panel-plugin/weather-data.h
+++ b/panel-plugin/weather-data.h
@@ -82,6 +82,14 @@ typedef enum {
     NIGHT
 } daytime;
 
+typedef struct {
+    gint temperature;
+    gint pressure;
+    gint windspeed;
+    gint precipitations;
+    gint altitude;
+} units_config;
+
 
 gdouble string_to_double(const gchar *str,
                          gdouble backup);
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 8be3e75..ea51d6b 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -925,6 +925,7 @@ xfceweather_create_control(XfcePanelPlugin *plugin)
     /* Initialize with sane default values */
     data->plugin = plugin;
     data->unit_system = METRIC;
+    data->units = g_slice_new0(units_config);
     data->weatherdata = NULL;
     data->forecast_days = DEFAULT_FORECAST_DAYS;
 
@@ -1037,6 +1038,9 @@ xfceweather_free(XfcePanelPlugin *plugin,
     if (data->astrodata)
         xml_astro_free(data->astrodata);
 
+    if (data->units)
+        g_slice_free(units_config, data->units);
+
     if (data->updatetimeout) {
         g_source_remove(data->updatetimeout);
         data->updatetimeout = 0;
diff --git a/panel-plugin/weather.h b/panel-plugin/weather.h
index d4113c9..1342b80 100644
--- a/panel-plugin/weather.h
+++ b/panel-plugin/weather.h
@@ -60,7 +60,9 @@ typedef struct {
     gchar *lat;
     gchar *lon;
     gchar *location_name;
+
     unit_systems unit_system;
+    units_config *units;
 
     xml_weather *weatherdata;
     xml_astro *astrodata;


More information about the Xfce4-commits mailing list