[Xfce4-commits] <xfce4-weather-plugin:master> Locale support, part 3: Format interval times in summary.

Harald Judt noreply at xfce.org
Wed Jul 4 18:30:03 CEST 2012


Updating branch refs/heads/master
         to 9467ce9f2b9adf7be98254494a414a26f4d64ca9 (commit)
       from 558afb675622f3e11395fc25123e18c07fb8ecfb (commit)

commit 9467ce9f2b9adf7be98254494a414a26f4d64ca9
Author: Harald Judt <h.judt at gmx.at>
Date:   Wed Jul 4 17:38:36 2012 +0200

    Locale support, part 3: Format interval times in summary.
    
    Format start and end time according to the user's locale setting.

 panel-plugin/weather-summary.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/panel-plugin/weather-summary.c b/panel-plugin/weather-summary.c
index 0466775..be14b0f 100644
--- a/panel-plugin/weather-summary.c
+++ b/panel-plugin/weather-summary.c
@@ -242,6 +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];
 
   view = gtk_text_view_new ();
   gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
@@ -278,9 +280,13 @@ create_summary_tab (xfceweather_data *data)
   APPEND_TEXT_ITEM (_("Latitude"), LATITUDE);
   APPEND_TEXT_ITEM (_("Longitude"), LONGITUDE);
 
-  value = g_strdup_printf (_("\n\tData applies to time interval\n\tfrom %s\tto %s"),
-                           ctime(&timeslice->start),
-                           ctime(&timeslice->end));
+  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"),
+                           interval_start,
+                           interval_end);
   APPEND_TEXT_ITEM_REAL (value);
 
   /* Temperature */


More information about the Xfce4-commits mailing list