[Xfce4-commits] <xfce4-weather-plugin:master> Use extra field in xml_time for the time of point data.

Harald Judt noreply at xfce.org
Fri Jul 13 16:50:03 CEST 2012


Updating branch refs/heads/master
         to b32baac2903304331f0109c92a2f0a4aaac74d45 (commit)
       from f43bb1782af08dc53f163a9806c79afeafca3f37 (commit)

commit b32baac2903304331f0109c92a2f0a4aaac74d45
Author: Harald Judt <h.judt at gmx.at>
Date:   Wed Jul 11 12:00:29 2012 +0200

    Use extra field in xml_time for the time of point data.
    
    Enhance xml_time with an extra field holding the time of
    point data. While this provides extra info for the user, its main
    intention is for making debugging a bit easier, in case something
    goes wrong or the data provided changes in a way we did not
    expect.
    
    Also, we do not mix up times of point and interval data in the
    forecast anymore, which was only a transitional solution.
    
    In the forecast details tab, we can now present the times for
    both point and interval data. While doing so, add a short
    explanation what these times are about.

 panel-plugin/weather-data.c    |    3 ++-
 panel-plugin/weather-parsers.h |    1 +
 panel-plugin/weather-summary.c |   19 +++++++++++++++----
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/panel-plugin/weather-data.c b/panel-plugin/weather-data.c
index f42aa8d..253037c 100644
--- a/panel-plugin/weather-data.c
+++ b/panel-plugin/weather-data.c
@@ -343,7 +343,8 @@ make_combined_timeslice(xml_time *point, xml_time *interval)
     if (loc == NULL)
         return forecast;
 
-    forecast->start = point->start;
+    forecast->point = point->start;
+    forecast->start = interval->start;
     forecast->end = interval->end;
 
     loc->altitude = g_strdup(point->location->altitude);
diff --git a/panel-plugin/weather-parsers.h b/panel-plugin/weather-parsers.h
index 23f9584..66854a9 100644
--- a/panel-plugin/weather-parsers.h
+++ b/panel-plugin/weather-parsers.h
@@ -72,6 +72,7 @@ typedef struct
 {
 	time_t start;
 	time_t end;
+	time_t point;
 	xml_location *location;
 }
 xml_time;
diff --git a/panel-plugin/weather-summary.c b/panel-plugin/weather-summary.c
index b273d4c..82a893f 100644
--- a/panel-plugin/weather-summary.c
+++ b/panel-plugin/weather-summary.c
@@ -242,8 +242,8 @@ create_summary_tab (xfceweather_data *data)
   GtkAdjustment *adj;
   GtkWidget     *weather_channel_icon;
   xml_time      *timeslice;
-  struct tm     *start, *end;
-  char           interval_start[80], interval_end[80];
+  struct tm     *start, *end, *point_tm;
+  char           interval_start[80], interval_end[80], point[80];
 
   view = gtk_text_view_new ();
   gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
@@ -275,20 +275,31 @@ create_summary_tab (xfceweather_data *data)
   g_free (value);
 
   timeslice = get_current_timeslice(data->weatherdata);
-  APPEND_BTEXT(_("Coordinates and Time\n"));
+  APPEND_BTEXT(_("Coordinates\n"));
   APPEND_TEXT_ITEM (_("Altitude"), ALTITUDE);
   APPEND_TEXT_ITEM (_("Latitude"), LATITUDE);
   APPEND_TEXT_ITEM (_("Longitude"), LONGITUDE);
 
+  APPEND_BTEXT(_("\nTime\n"));
+  point_tm = localtime(&timeslice->point);
+  strftime (point, 80, "%c", point_tm);
+  value = g_strdup_printf (_("\tPoint data applies to:\n\t%s\n"), point);
+  APPEND_TEXT_ITEM_REAL (value);
+
   start = localtime(&timeslice->start);
   strftime (interval_start, 80, "%c", start);
   end = localtime(&timeslice->end);
   strftime (interval_end, 80, "%c", end);
-  value = g_strdup_printf (_("\n\tData applies to time interval\n\tfrom %s\n\tto %s\n"),
+  value = g_strdup_printf (_("\n\tInterval data applies to:\n\t%s\n\t%s\n"),
                            interval_start,
                            interval_end);
   APPEND_TEXT_ITEM_REAL (value);
 
+  value = g_strdup_printf (_("\n\tInterval data provides icon, description and precipitation,"
+                             "\n\twhile point data supplies the rest.\n"), point);
+  APPEND_TEXT_ITEM_REAL (value);
+
+
   /* Temperature */
   APPEND_BTEXT (_("\nTemperature\n"));
   APPEND_TEXT_ITEM (_("Temperature"), TEMPERATURE);


More information about the Xfce4-commits mailing list