[dates] Handle the timezone correctly in the task details dialog



commit 966969063535da0786b7483c1bcd427df8a0d87d
Author: Long Bu <long bu intel com>
Date:   Thu Aug 13 11:31:59 2009 +0100

    Handle the timezone correctly in the task details dialog
    
    Signed-off-by: Ross Burton <ross linux intel com>

 src/dates_callbacks.c |    7 +++++--
 src/dates_view.c      |    9 +++++++++
 src/dates_view.h      |    2 ++
 3 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/dates_callbacks.c b/src/dates_callbacks.c
index ab378c3..b17a963 100644
--- a/src/dates_callbacks.c
+++ b/src/dates_callbacks.c
@@ -410,6 +410,7 @@ dates_fill_details_dialog (DatesView *view, DatesData *d)
     GtkTextBuffer *buffer;
     ECalComponentText summary;
     GtkWidget *widget;
+    icaltimezone* from_zone; 
 
     /* Set summary entry */
     e_cal_component_get_summary (d->comp, &summary);
@@ -447,13 +448,15 @@ dates_fill_details_dialog (DatesView *view, DatesData *d)
 	
     /* Set time buttons and dialog */
     e_cal_component_get_dtstart (d->comp, &time);
-    timem = icaltimetype_to_tm (time.value);
+    from_zone = icaltimezone_get_builtin_timezone_from_tzid (time.tzid);
+    timem = icaltimetype_to_tm_with_zone (time.value, from_zone, dates_view_get_zone(view));
     strftime (time_text, 256, TIME_MARKUP, &timem);
     gtk_label_set_markup (GTK_LABEL (d->details_start_label), time_text);
     e_cal_component_free_datetime (&time);
 
     e_cal_component_get_dtend (d->comp, &time);
-    timem = icaltimetype_to_tm (time.value);
+    from_zone = icaltimezone_get_builtin_timezone_from_tzid (time.tzid);
+    timem = icaltimetype_to_tm_with_zone (time.value, from_zone, dates_view_get_zone(view));
     strftime (time_text, 256, TIME_MARKUP, &timem);
     gtk_label_set_markup (GTK_LABEL (d->details_end_label),
 			  time_text);
diff --git a/src/dates_view.c b/src/dates_view.c
index 5cf2207..d3e4331 100644
--- a/src/dates_view.c
+++ b/src/dates_view.c
@@ -5735,3 +5735,12 @@ dates_view_update_scrollability (DatesView *view)
 		gtk_adjustment_changed (priv->adjust);
 	}
 }
+
+icaltimezone *
+dates_view_get_zone(DatesView *view)
+{
+	DatesViewPrivate *priv;
+
+	priv = DATES_VIEW_GET_PRIVATE (view);
+	return priv->zone;
+}
diff --git a/src/dates_view.h b/src/dates_view.h
index 02b1c40..0bc7ea8 100644
--- a/src/dates_view.h
+++ b/src/dates_view.h
@@ -108,6 +108,8 @@ gboolean	dates_view_get_use_24h		(DatesView *view);
 void            dates_view_get_visible_span     (DatesView *view,
 						 struct icaltimetype *start,
 						 struct icaltimetype *end);
+icaltimezone * dates_view_get_zone(DatesView *view);
+
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]