[Xfce4-commits] <xfce4-weather-plugin:master> Add overall cloudiness to location data and summary.

Harald Judt noreply at xfce.org
Mon Jul 2 12:38:14 CEST 2012


Updating branch refs/heads/master
         to 8ac92698255d2964b2bba33d3fd53f0490177ad0 (commit)
       from feb84145ae8fce321356e366588230e9eca413ac (commit)

commit 8ac92698255d2964b2bba33d3fd53f0490177ad0
Author: Harald Judt <harald.judt at univie.ac.at>
Date:   Tue Jun 26 15:33:53 2012 +0200

    Add overall cloudiness to location data and summary.
    
    Make the precomputed overall cloudiness available in the current
    weather display and the forecast summary.

 panel-plugin/weather-config.c  |    1 +
 panel-plugin/weather-data.c    |    3 +++
 panel-plugin/weather-data.h    |    1 +
 panel-plugin/weather-parsers.c |    4 ++++
 panel-plugin/weather-parsers.h |    1 +
 panel-plugin/weather-summary.c |    1 +
 panel-plugin/weather.c         |    3 +++
 7 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index eb00f22..3b6c382 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -44,6 +44,7 @@ static const labeloption labeloptions[OPTIONS_N] = {
   {N_("Low cloudiness (CL)"), CLOUDINESS_LOW},
   {N_("Medium cloudiness (CM)"), CLOUDINESS_MED},
   {N_("High cloudiness (CH)"), CLOUDINESS_HIGH},
+  {N_("Overall Cloudiness (CO)"), CLOUDINESS_OVERALL},
   {N_("Fog (F)"), FOG},
   {N_("Precipitations (R)"), PRECIPITATIONS},
 };
diff --git a/panel-plugin/weather-data.c b/panel-plugin/weather-data.c
index d27ca44..b9290cb 100644
--- a/panel-plugin/weather-data.c
+++ b/panel-plugin/weather-data.c
@@ -75,6 +75,8 @@ get_data (xml_time *timeslice, datas type)
 		return CHK_NULL(loc->cloudiness_percent[CLOUD_MED]);
 	case CLOUDINESS_HIGH:
 		return CHK_NULL(loc->cloudiness_percent[CLOUD_HIGH]);
+	case CLOUDINESS_OVERALL:
+		return CHK_NULL(loc->cloudiness_percent[CLOUD_OVERALL]);
 	case FOG:
 		return CHK_NULL(loc->fog_percent);
 	case PRECIPITATIONS:
@@ -112,6 +114,7 @@ get_unit (xml_time *timeslice, units unit, datas type)
 	case CLOUDINESS_LOW:
 	case CLOUDINESS_MED:
 	case CLOUDINESS_HIGH:
+	case CLOUDINESS_OVERALL:
 	case FOG:
 		return "%";
 	case PRECIPITATIONS:
diff --git a/panel-plugin/weather-data.h b/panel-plugin/weather-data.h
index 37f04c5..190d726 100644
--- a/panel-plugin/weather-data.h
+++ b/panel-plugin/weather-data.h
@@ -34,6 +34,7 @@ typedef enum {
 	CLOUDINESS_LOW,
 	CLOUDINESS_MED,
 	CLOUDINESS_HIGH,
+	CLOUDINESS_OVERALL,
 	FOG,
 	PRECIPITATIONS,
 	SYMBOL
diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c
index 704a396..f4f29bc 100644
--- a/panel-plugin/weather-parsers.c
+++ b/panel-plugin/weather-parsers.c
@@ -243,6 +243,10 @@ void parse_location (xmlNode * cur_node, xml_location *loc)
 			loc->pressure_unit = PROP(child_node, "unit");
 			loc->pressure_value = PROP(child_node, "value");
 		}
+		if (NODE_IS_TYPE (child_node, "cloudiness")) {
+			g_free(loc->cloudiness_percent[CLOUD_OVERALL]);
+			loc->cloudiness_percent[CLOUD_OVERALL] = PROP(child_node, "percent");
+		}
 		if (NODE_IS_TYPE (child_node, "fog")) {
 			g_free(loc->fog_percent);
 			loc->fog_percent = PROP(child_node, "percent");
diff --git a/panel-plugin/weather-parsers.h b/panel-plugin/weather-parsers.h
index 144600e..3f64725 100644
--- a/panel-plugin/weather-parsers.h
+++ b/panel-plugin/weather-parsers.h
@@ -33,6 +33,7 @@ enum
 	CLOUD_LOW = 0,
 	CLOUD_MED,
 	CLOUD_HIGH,
+	CLOUD_OVERALL,
 	NUM_CLOUDINESS
 };
 
diff --git a/panel-plugin/weather-summary.c b/panel-plugin/weather-summary.c
index 0330f13..ada8d72 100644
--- a/panel-plugin/weather-summary.c
+++ b/panel-plugin/weather-summary.c
@@ -314,6 +314,7 @@ create_summary_tab (xfceweather_data *data)
   APPEND_TEXT_ITEM (_("Low clouds"), CLOUDINESS_LOW);
   APPEND_TEXT_ITEM (_("Medium clouds"), CLOUDINESS_MED);
   APPEND_TEXT_ITEM (_("High clouds"), CLOUDINESS_HIGH);
+  APPEND_TEXT_ITEM (_("Cloudiness"), CLOUDINESS_OVERALL);
 
   APPEND_BTEXT (_("\nData from The Norwegian Meteorological Institute\n"));
   APPEND_LINK_ITEM ("\t", "Thanks to met.no", "http://met.no/", ltag1);
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index cedef93..25fbc2a 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -131,6 +131,9 @@ make_label (xml_weather    *weatherdata,
     case CLOUDINESS_HIGH:
       lbl = _("CH");
       break;
+    case CLOUDINESS_OVERALL:
+      lbl = _("CO");
+      break;
     case FOG:
       lbl = _("F");
       break;


More information about the Xfce4-commits mailing list