diff options
author | Chenthill Palanisamy <pchenthill@novell.com> | 2005-07-22 19:41:35 +0800 |
---|---|---|
committer | Chenthill Palanisamy <pchen@src.gnome.org> | 2005-07-22 19:41:35 +0800 |
commit | b94a5c8fd061715d7b812e60c5d1aa92ab74602c (patch) | |
tree | df37ad0b2c1395a405682a495d3d5fcceaa1439b /calendar | |
parent | c8a608424c7e6c343fa8f2a4670fd96885b9c884 (diff) | |
download | gsoc2013-evolution-b94a5c8fd061715d7b812e60c5d1aa92ab74602c.tar gsoc2013-evolution-b94a5c8fd061715d7b812e60c5d1aa92ab74602c.tar.gz gsoc2013-evolution-b94a5c8fd061715d7b812e60c5d1aa92ab74602c.tar.bz2 gsoc2013-evolution-b94a5c8fd061715d7b812e60c5d1aa92ab74602c.tar.lz gsoc2013-evolution-b94a5c8fd061715d7b812e60c5d1aa92ab74602c.tar.xz gsoc2013-evolution-b94a5c8fd061715d7b812e60c5d1aa92ab74602c.tar.zst gsoc2013-evolution-b94a5c8fd061715d7b812e60c5d1aa92ab74602c.zip |
Fixes #309991
2005-07-22 Chenthill Palanisamy <pchenthill@novell.com>
Fixes #309991
* gui/e-cal-model.c: (ensure_dates_are_in_default_zone),
(e_cal_view_objects_added_cb):
* gui/gnome-cal.c: (ensure_dates_are_in_default_zone),
(dn_e_cal_view_objects_added_cb): If the start date and end
date are in UTC convert them to default zone while displaying.
svn path=/trunk/; revision=29850
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 9 | ||||
-rw-r--r-- | calendar/gui/e-cal-model.c | 26 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 25 |
3 files changed, 60 insertions, 0 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index e6415044e8..3130a1561b 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,12 @@ +2005-07-22 Chenthill Palanisamy <pchenthill@novell.com> + + Fixes #309991 + * gui/e-cal-model.c: (ensure_dates_are_in_default_zone), + (e_cal_view_objects_added_cb): + * gui/gnome-cal.c: (ensure_dates_are_in_default_zone), + (dn_e_cal_view_objects_added_cb): If the start date and end + date are in UTC convert them to default zone while displaying. + 2005-07-21 Shakti Sen <shprasad@novell.com> * gui/e-tasks.c (e_tasks_init): Creating the tasks-menu. diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 95bb927164..f53320ec93 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -1326,6 +1326,30 @@ set_instance_times (ECalModelComponent *comp_data, icaltimezone *zone) (icaltime_as_timet (end_time) - icaltime_as_timet (start_time)); } +/* We do this check since the calendar items are downloaded from the server in the open_method, + since the default timezone might not be set there */ +static void +ensure_dates_are_in_default_zone (icalcomponent *icalcomp) +{ + icaltimetype dt; + icaltimezone *zone = calendar_config_get_icaltimezone (); + + if (!zone) + return; + + dt = icalcomponent_get_dtstart (icalcomp); + if (dt.is_utc) { + dt = icaltime_convert_to_zone (dt, zone); + icalcomponent_set_dtstart (icalcomp, dt); + } + + dt = icalcomponent_get_dtend (icalcomp); + if (dt.is_utc) { + dt = icaltime_convert_to_zone (dt, zone); + icalcomponent_set_dtend (icalcomp, dt); + } +} + static void e_cal_view_objects_added_cb (ECalView *query, GList *objects, gpointer user_data) { @@ -1350,6 +1374,8 @@ e_cal_view_objects_added_cb (ECalView *query, GList *objects, gpointer user_data e_cal_model_free_component_data (comp_data); } + ensure_dates_are_in_default_zone (l->data); + if ((priv->flags & E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES)) { RecurrenceExpansionData rdata; diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 635183f009..c5929aff02 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -445,6 +445,30 @@ gnome_calendar_class_init (GnomeCalendarClass *class) } +/* We do this check since the calendar items are downloaded from the server in the open_method, + since the default timezone might not be set there */ +static void +ensure_dates_are_in_default_zone (icalcomponent *icalcomp) +{ + icaltimetype dt; + icaltimezone *zone = calendar_config_get_icaltimezone (); + + if (!zone) + return; + + dt = icalcomponent_get_dtstart (icalcomp); + if (dt.is_utc) { + dt = icaltime_convert_to_zone (dt, zone); + icalcomponent_set_dtstart (icalcomp, dt); + } + + dt = icalcomponent_get_dtend (icalcomp); + if (dt.is_utc) { + dt = icaltime_convert_to_zone (dt, zone); + icalcomponent_set_dtend (icalcomp, dt); + } +} + /* Callback used when the calendar query reports of an updated object */ static void dn_e_cal_view_objects_added_cb (ECalView *query, GList *objects, gpointer data) @@ -459,6 +483,7 @@ dn_e_cal_view_objects_added_cb (ECalView *query, GList *objects, gpointer data) for (l = objects; l; l = l->next) { ECalComponent *comp = NULL; + ensure_dates_are_in_default_zone (l->data); comp = e_cal_component_new (); if (!e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (l->data))) { g_object_unref (comp); |