From cd13211f3b7c8ec200313d25ded3b7aa972e4b95 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Thu, 23 Dec 2004 12:35:40 +0000 Subject: get instance times using the correct timezone. (redo_queries): emit 2004-12-23 Rodrigo Moya * gui/e-cal-model.c (set_instance_times): get instance times using the correct timezone. (redo_queries): emit signals before clearing the array. * gui/e-day-view.c (process_component): * gui/e-week-view.c (process_component): no need to try to update, always add. svn path=/trunk/; revision=28192 --- calendar/ChangeLog | 10 ++++++ calendar/gui/e-cal-model.c | 17 +++++----- calendar/gui/e-day-view.c | 48 ---------------------------- calendar/gui/e-week-view.c | 78 ++++++++++++++++++++++------------------------ 4 files changed, 56 insertions(+), 97 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 63a1cd7ad2..0fca80d588 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,13 @@ +2004-12-23 Rodrigo Moya + + * gui/e-cal-model.c (set_instance_times): get instance times using + the correct timezone. + (redo_queries): emit signals before clearing the array. + + * gui/e-day-view.c (process_component): + * gui/e-week-view.c (process_component): no need to try to update, + always add. + 2004-12-23 Hans Petter Jansson * gui/e-select-names-editable.c: Correct bad include. diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 5fba603847..edc0c046a3 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -186,7 +186,6 @@ clear_objects_array (ECalModelPrivate *priv) e_cal_model_free_component_data (comp_data); } - g_ptr_array_set_size (priv->objects, 0); } @@ -1304,21 +1303,21 @@ set_instance_times (ECalModelComponent *comp_data, icaltimezone *zone) if (zone) { if (e_cal_util_component_is_instance (comp_data->icalcomp)) { - comp_data->instance_start = icaltime_as_timet (recur_time); + comp_data->instance_start = icaltime_as_timet_with_zone (recur_time, zone); comp_data->instance_end = comp_data->instance_start + - (icaltime_as_timet (end_time) - - icaltime_as_timet (start_time)); + (icaltime_as_timet_with_zone (end_time, end_time.zone ? end_time.zone : zone) - + icaltime_as_timet_with_zone (start_time, start_time.zone ? start_time.zone : zone)); } else { if (start_time.zone) { - icaltimezone_convert_time (&start_time, start_time.zone, zone); - comp_data->instance_start = icaltime_as_timet (start_time); + //icaltimezone_convert_time (&start_time, start_time.zone, zone); + comp_data->instance_start = icaltime_as_timet_with_zone (start_time, start_time.zone); } else comp_data->instance_start = icaltime_as_timet_with_zone (start_time, zone); if (end_time.zone) { - icaltimezone_convert_time (&end_time, end_time.zone, zone); - comp_data->instance_end = icaltime_as_timet (end_time); + //icaltimezone_convert_time (&end_time, end_time.zone, zone); + comp_data->instance_end = icaltime_as_timet_with_zone (end_time, end_time.zone); } else comp_data->instance_end = icaltime_as_timet_with_zone (end_time, zone); } @@ -1697,8 +1696,8 @@ redo_queries (ECalModel *model) /* clean up the current contents */ e_table_model_pre_change (E_TABLE_MODEL (model)); len = priv->objects->len; - clear_objects_array (priv); e_table_model_rows_deleted (E_TABLE_MODEL (model), 0, len); + clear_objects_array (priv); /* update the query for all clients */ for (l = priv->clients; l != NULL; l = l->next) { diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 78f8cfc9b4..89122753eb 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -530,54 +530,6 @@ process_component (EDayView *day_view, ECalModelComponent *comp_data) else rid = NULL; - /* If the event already exists and the dates didn't change, we can - update the event fairly easily without changing the events arrays - or computing a new layout. */ - if (e_day_view_find_event_from_uid (day_view, uid, rid, &day, &event_num)) { - ECalComponent *tmp_comp; - - if (day == E_DAY_VIEW_LONG_EVENT) - event = &g_array_index (day_view->long_events, - EDayViewEvent, event_num); - else - event = &g_array_index (day_view->events[day], - EDayViewEvent, event_num); - - tmp_comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (tmp_comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if (!e_cal_util_component_has_recurrences (comp_data->icalcomp) - && !e_cal_component_has_recurrences (tmp_comp) - && e_cal_component_event_dates_match (comp, tmp_comp)) { -#if 0 - g_print ("updated object's dates unchanged\n"); -#endif - /* e_day_view_foreach_event_with_uid (day_view, uid, e_day_view_update_event_cb, comp_data); */ - e_day_view_update_event_cb (day_view, day, event_num, comp_data); - gtk_widget_queue_draw (day_view->top_canvas); - gtk_widget_queue_draw (day_view->main_canvas); - return; - } - - /* The dates have changed, so we need to remove the - old occurrrences before adding the new ones. */ -#if 0 - g_print ("dates changed - removing occurrences\n"); -#endif - e_day_view_remove_event_cb (day_view, day, event_num, NULL); - - g_object_unref (tmp_comp); - } else { - if (rid && e_day_view_find_event_from_uid (day_view, uid, NULL, &day, &event_num)) { - if (day == E_DAY_VIEW_LONG_EVENT) - event = &g_array_index (day_view->long_events, EDayViewEvent, event_num); - else - event = &g_array_index (day_view->events[day], EDayViewEvent, event_num); - - if (!e_cal_util_component_is_instance (event->comp_data->icalcomp)) - e_day_view_remove_event_cb (day_view, day, event_num, NULL); - } - } - /* Add the object */ add_event_data.day_view = day_view; add_event_data.comp_data = comp_data; diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index fb60e67d3f..e552c009d8 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -330,46 +330,44 @@ process_component (EWeekView *week_view, ECalModelComponent *comp_data) else rid = NULL; - /* If the event already exists and the dates didn't change, we can - update the event fairly easily without changing the events arrays - or computing a new layout. */ - if (e_week_view_find_event_from_uid (week_view, uid, rid, &event_num)) { - ECalComponent *tmp_comp; - - event = &g_array_index (week_view->events, EWeekViewEvent, - event_num); - - tmp_comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (tmp_comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if (!e_cal_component_has_recurrences (comp) - && !e_cal_component_has_recurrences (tmp_comp) - && e_cal_component_event_dates_match (comp, tmp_comp)) { -#if 0 - g_print ("updated object's dates unchanged\n"); -#endif - /* e_week_view_foreach_event_with_uid (week_view, uid, e_week_view_update_event_cb, comp_data); */ - e_week_view_update_event_cb (week_view, event_num, comp_data); - g_object_unref (comp); - g_object_unref (tmp_comp); - gtk_widget_queue_draw (week_view->main_canvas); - return; - } - - /* The dates have changed, so we need to remove the - old occurrrences before adding the new ones. */ -#if 0 - g_print ("dates changed - removing occurrences\n"); -#endif - e_week_view_remove_event_cb (week_view, event_num, NULL); - - g_object_unref (tmp_comp); - } else { - if (rid && e_week_view_find_event_from_uid (week_view, uid, NULL, &event_num)) { - event = &g_array_index (week_view->events, EWeekViewEvent, event_num); - if (!e_cal_util_component_is_instance (event->comp_data->icalcomp)) - e_week_view_remove_event_cb (week_view, event_num, NULL); - } - } +/* /\* If the event already exists and the dates didn't change, we can */ +/* update the event fairly easily without changing the events arrays */ +/* or computing a new layout. *\/ */ +/* if (e_week_view_find_event_from_uid (week_view, uid, rid, &event_num)) { */ +/* ECalComponent *tmp_comp; */ + +/* event = &g_array_index (week_view->events, EWeekViewEvent, event_num); */ + +/* tmp_comp = e_cal_component_new (); */ +/* e_cal_component_set_icalcomponent (tmp_comp, icalcomponent_new_clone (event->comp_data->icalcomp)); */ +/* if (!e_cal_component_has_recurrences (comp) */ +/* && !e_cal_component_has_recurrences (tmp_comp) */ +/* && e_cal_component_event_dates_match (comp, tmp_comp)) { */ +/* #if 0 */ +/* g_print ("updated object's dates unchanged\n"); */ +/* #endif */ +/* e_week_view_update_event_cb (week_view, event_num, comp_data); */ +/* g_object_unref (comp); */ +/* g_object_unref (tmp_comp); */ +/* gtk_widget_queue_draw (week_view->main_canvas); */ +/* return; */ +/* } */ + +/* /\* The dates have changed, so we need to remove the */ +/* old object before adding the new ones. *\/ */ +/* #if 0 */ +/* g_print ("dates changed - removing occurrences\n"); */ +/* #endif */ +/* e_week_view_remove_event_cb (week_view, event_num, NULL); */ + +/* g_object_unref (tmp_comp); */ +/* } else { */ +/* if (rid && e_week_view_find_event_from_uid (week_view, uid, NULL, &event_num)) { */ +/* event = &g_array_index (week_view->events, EWeekViewEvent, event_num); */ +/* if (!e_cal_util_component_is_instance (event->comp_data->icalcomp)) */ +/* e_week_view_remove_event_cb (week_view, event_num, NULL); */ +/* } */ +/* } */ /* Add the object */ num_days = week_view->multi_week_view ? week_view->weeks_shown * 7 : 7; -- cgit v1.2.3