[Xfce4-commits] <xfce4-weather-plugin:master> Initialize xfceweather_data with sane values.

Harald Judt noreply at xfce.org
Wed Jul 18 12:06:02 CEST 2012


Updating branch refs/heads/master
         to 60881be1b2bb12fbcafb3c2d09e03baeee6a6596 (commit)
       from 59801b00e373b4e383711cd886e2e199b8d833bb (commit)

commit 60881be1b2bb12fbcafb3c2d09e03baeee6a6596
Author: Harald Judt <h.judt at gmx.at>
Date:   Wed Jul 18 12:00:47 2012 +0200

    Initialize xfceweather_data with sane values.

 panel-plugin/weather.c |   16 ++++++++++++++--
 panel-plugin/weather.h |    1 +
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index a2c4f4e..ec20d9c 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -599,8 +599,8 @@ xfceweather_read_config (XfcePanelPlugin  *plugin,
       data->proxy_port = data->saved_proxy_port;
     }
 
-  val = xfce_rc_read_int_entry (rc, "forecast_days", 5);
-  data->forecast_days = (val > 0 && val <= MAX_FORECAST_DAYS) ? val : 5;
+  val = xfce_rc_read_int_entry (rc, "forecast_days", DEFAULT_FORECAST_DAYS);
+  data->forecast_days = (val > 0 && val <= MAX_FORECAST_DAYS) ? val : DEFAULT_FORECAST_DAYS;
 
   data->animation_transitions = xfce_rc_read_bool_entry (rc,
   		"animation_transitions", TRUE);
@@ -898,7 +898,19 @@ xfceweather_create_control (XfcePanelPlugin *plugin)
   datas             lbl;
   GdkPixbuf        *icon = NULL;
 
+  /* Initialize with sane default values */
   data->plugin = plugin;
+  data->lat = NULL;
+  data->lon = NULL;
+  data->location_name = NULL;
+  data->unit_system = METRIC;
+  data->weatherdata = NULL;
+  data->proxy_host = NULL;
+  data->proxy_port = 0;
+  data->saved_proxy_host = NULL;
+  data->saved_proxy_port = 0;
+  data->animation_transitions = FALSE;
+  data->forecast_days = DEFAULT_FORECAST_DAYS;
 
 #if !GTK_CHECK_VERSION(2,12,0)
   data->tooltips = gtk_tooltips_new ();
diff --git a/panel-plugin/weather.h b/panel-plugin/weather.h
index 557509e..4a6a09a 100644
--- a/panel-plugin/weather.h
+++ b/panel-plugin/weather.h
@@ -22,6 +22,7 @@
 #include <libxfce4util/libxfce4util.h>
 #define PLUGIN_WEBSITE   "http://goodies.xfce.org/projects/panel-plugins/xfce4-weather-plugin"
 #define MAX_FORECAST_DAYS 10
+#define DEFAULT_FORECAST_DAYS 5
 
 G_BEGIN_DECLS
 


More information about the Xfce4-commits mailing list