From: Milan Crha Date: Wed, 25 Jun 2008 12:32:37 +0000 (+0000) Subject: ** Fix for bug #476640 X-Git-Tag: upstream/3.7.4~4890 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=343f5b4a192a594c5fb747cb6c2babb54d9a7941;p=platform%2Fupstream%2Fevolution-data-server.git ** Fix for bug #476640 2008-06-25 Milan Crha ** Fix for bug #476640 * backends/file/e-cal-backend-file.c: (cancel_received_object): Pass back old and new object after the remove. * backends/file/e-cal-backend-file.c: (e_cal_backend_file_receive_objects): Cancel event properly. svn path=/trunk/; revision=9043 --- diff --git a/calendar/ChangeLog b/calendar/ChangeLog index eb9e0dd..9620d4d 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,12 @@ +2008-06-25 Milan Crha + + ** Fix for bug #476640 + + * backends/file/e-cal-backend-file.c: (cancel_received_object): + Pass back old and new object after the remove. + * backends/file/e-cal-backend-file.c: + (e_cal_backend_file_receive_objects): Cancel event properly. + 2008-06-22 Patrick Ohly * libecal/e-cal-check-timezones.c, diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c index f1ae222..73e998e 100644 --- a/calendar/backends/file/e-cal-backend-file.c +++ b/calendar/backends/file/e-cal-backend-file.c @@ -2301,7 +2301,7 @@ e_cal_backend_file_remove_object (ECalBackendSync *backend, EDataCal *cal, } static gboolean -cancel_received_object (ECalBackendFile *cbfile, icalcomponent *icalcomp) +cancel_received_object (ECalBackendFile *cbfile, icalcomponent *icalcomp, char **old_object, char **new_object) { ECalBackendFileObject *obj_data; ECalBackendFilePrivate *priv; @@ -2310,6 +2310,9 @@ cancel_received_object (ECalBackendFile *cbfile, icalcomponent *icalcomp) priv = cbfile->priv; + *old_object = NULL; + *new_object = NULL; + /* Find the old version of the component. */ obj_data = g_hash_table_lookup (priv->comp_uid_hash, icalcomponent_get_uid (icalcomp)); if (!obj_data) @@ -2322,10 +2325,14 @@ cancel_received_object (ECalBackendFile *cbfile, icalcomponent *icalcomp) return FALSE; } + *old_object = e_cal_component_get_as_string (obj_data->full_object); + + /* new_object is kept NULL if not removing the instance */ rid = e_cal_component_get_recurid_as_string (comp); - if (rid && *rid) + if (rid && *rid) { remove_instance (cbfile, obj_data, rid); - else + *new_object = e_cal_component_get_as_string (obj_data->full_object); + } else remove_component (cbfile, icalcomponent_get_uid (icalcomp), obj_data); g_free (rid); @@ -2517,7 +2524,7 @@ e_cal_backend_file_receive_objects (ECalBackendSync *backend, EDataCal *cal, con /* Now we manipulate the components we care about */ for (l = comps; l; l = l->next) { const char *uid; - char *object, *old_object, *rid; + char *object, *old_object, *rid, *new_object; ECalBackendFileObject *obj_data; subcomp = l->data; @@ -2585,26 +2592,22 @@ e_cal_backend_file_receive_objects (ECalBackendSync *backend, EDataCal *cal, con goto error; break; case ICAL_METHOD_CANCEL: - if (cancel_received_object (cbfile, subcomp)) { + old_object = NULL; + new_object = NULL; + if (cancel_received_object (cbfile, subcomp, &old_object, &new_object)) { ECalComponentId *id; - object = icalcomponent_as_ical_string (subcomp); - obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid); - if (obj_data) - old_object = e_cal_component_get_as_string (obj_data->full_object); - else - old_object = NULL; id = e_cal_component_get_id (comp); - e_cal_backend_notify_object_removed (E_CAL_BACKEND (backend), id, old_object, object); + e_cal_backend_notify_object_removed (E_CAL_BACKEND (backend), id, old_object, new_object); /* remove the component from the toplevel VCALENDAR */ icalcomponent_remove_component (toplevel_comp, subcomp); icalcomponent_free (subcomp); e_cal_component_free_id (id); + g_free (new_object); g_free (old_object); - g_free (object); } g_free (rid); break;