From 5a2fbc78d98a8219e4b11176d743cbcaf61b6adf Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Fri, 19 Mar 2004 15:05:08 +0000 Subject: compare ecalcomponents, not icalcomponents (the compare func is borked), 2004-03-19 JP Rosevear * gui/e-day-view.c (process_component): compare ecalcomponents, not icalcomponents (the compare func is borked), check recurrence changes better (e_day_view_init): just use the model the parent creates * gui/e-week-view.c (process_component): create the temporary item from the correct icalcomp (e_week_view_init): just use the model the parent creates svn path=/trunk/; revision=25129 --- calendar/ChangeLog | 11 +++++++++++ calendar/gui/e-day-view.c | 29 ++++++++++++++++++++--------- calendar/gui/e-week-view.c | 13 +++++-------- 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index b2d1733a02..99ce2b2791 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,14 @@ +2004-03-19 JP Rosevear + + * gui/e-day-view.c (process_component): compare ecalcomponents, + not icalcomponents (the compare func is borked), check recurrence + changes better + (e_day_view_init): just use the model the parent creates + + * gui/e-week-view.c (process_component): create the temporary item + from the correct icalcomp + (e_week_view_init): just use the model the parent creates + 2004-03-18 Rodrigo Moya * gui/dialogs/select-source-dialog.c (select_source_dialog): create diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 2dd2c1cca2..a13c059b15 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -525,12 +525,22 @@ process_component (EDayView *day_view, ECalModelComponent *comp_data) if (day_view->lower == 0 && day_view->upper == 0) return; + comp = e_cal_component_new (); + if (!e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp))) { + g_object_unref (comp); + + g_message (G_STRLOC ": Could not set icalcomponent on ECalComponent"); + return; + } + + e_cal_component_get_uid (comp, &uid); + /* 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. */ - uid = icalcomponent_get_uid (comp_data->icalcomp); - if (e_day_view_find_event_from_uid (day_view, uid, &day, &event_num)) { + ECalComponent *tmp_comp; + if (day == E_DAY_VIEW_LONG_EVENT) event = &g_array_index (day_view->long_events, EDayViewEvent, event_num); @@ -538,8 +548,11 @@ process_component (EDayView *day_view, ECalModelComponent *comp_data) 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_util_event_dates_match (event->comp_data->icalcomp, 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 @@ -557,12 +570,11 @@ process_component (EDayView *day_view, ECalModelComponent *comp_data) e_day_view_foreach_event_with_uid (day_view, uid, e_day_view_remove_event_cb, NULL); + + g_object_unref (tmp_comp); } /* Add the occurrences of the event */ - comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp)); - add_event_data.day_view = day_view; add_event_data.comp_data = comp_data; e_cal_recur_generate_instances (comp, day_view->lower, @@ -1033,9 +1045,8 @@ e_day_view_init (EDayView *day_view) target_table, n_targets, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK); - /* Set the default model */ - model = E_CAL_MODEL (e_cal_model_calendar_new ()); - e_calendar_view_set_model (E_CALENDAR_VIEW (day_view), model); + /* Get the model */ + model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)); /* connect to ECalModel's signals */ g_signal_connect (G_OBJECT (model), "time_range_changed", diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 14ed7f72c6..8ada75bbd3 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -345,7 +345,7 @@ process_component (EWeekView *week_view, ECalModelComponent *comp_data) if (!e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp))) { g_object_unref (comp); - g_message ("process_component(): Could not set icalcomponent on ECalComponent"); + g_message (G_STRLOC ": Could not set icalcomponent on ECalComponent"); return; } @@ -361,7 +361,7 @@ process_component (EWeekView *week_view, ECalModelComponent *comp_data) event_num); tmp_comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (tmp_comp, icalcomponent_new_clone (comp_data->icalcomp)); + 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)) { @@ -400,8 +400,6 @@ process_component (EWeekView *week_view, ECalModelComponent *comp_data) e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view))); g_object_unref (comp); - - e_week_view_queue_layout (week_view); } static void @@ -676,10 +674,9 @@ e_week_view_init (EWeekView *week_view) week_view->resize_width_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW); week_view->last_cursor_set = NULL; - /* Set the default model */ - model = E_CAL_MODEL (e_cal_model_calendar_new ()); - e_calendar_view_set_model (E_CALENDAR_VIEW (week_view), model); - + /* Get the model */ + model = e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)); + /* connect to ECalModel's signals */ g_signal_connect (G_OBJECT (model), "time_range_changed", G_CALLBACK (time_range_changed_cb), week_view); -- cgit v1.2.3