[evolution/gnome-3-0] Bug #655843 - Copy to calendar doesn't add timezone information



commit ba697fd458c75466035f65338d61d518eb465d97
Author: James Bottomley <jejbev hansenpartnership com>
Date:   Thu Aug 11 13:48:42 2011 +0200

    Bug #655843 - Copy to calendar doesn't add timezone information

 modules/calendar/e-cal-shell-view-private.c |   30 +++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index 61aff5a..221195d 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -812,6 +812,31 @@ e_cal_shell_view_set_status_message (ECalShellView *cal_shell_view,
 	cal_shell_view->priv->calendar_activity = activity;
 }
 
+struct ForeachTzidData
+{
+	ECal *source_client;
+	ECal *dest_client;
+};
+
+static void
+add_timezone_to_cal_cb (icalparameter *param, gpointer data)
+{
+	struct ForeachTzidData *ftd = data;
+	icaltimezone *tz = NULL;
+	const gchar *tzid;
+
+	g_return_if_fail (ftd != NULL);
+	g_return_if_fail (ftd->source_client != NULL);
+	g_return_if_fail (ftd->dest_client != NULL);
+
+	tzid = icalparameter_get_tzid (param);
+	if (!tzid || !*tzid)
+		return;
+
+	if (e_cal_get_timezone (ftd->source_client, tzid, &tz, NULL) && tz)
+		e_cal_add_timezone (ftd->dest_client, tz, NULL);
+}
+
 void
 e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view,
                                    ECalendarViewEvent *event,
@@ -853,6 +878,10 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view,
 	} else {
 		icalproperty *icalprop;
 		gchar *new_uid;
+		struct ForeachTzidData ftd;
+
+		ftd.source_client = event->comp_data->client;
+		ftd.dest_client = destination_client;
 
 		if (e_cal_util_component_is_instance (icalcomp_event)) {
 			success = e_cal_get_object (
@@ -895,6 +924,7 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view,
 		}
 
 		new_uid = NULL;
+		icalcomponent_foreach_tzid (icalcomp_clone, add_timezone_to_cal_cb, &ftd);
 		success = e_cal_create_object (
 			destination_client, icalcomp_clone, &new_uid, NULL);
 		if (!success) {



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