+2008-07-04 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #329571
+
+ * backends/file/e-cal-backend-file.c:
+ (e_cal_backend_file_modify_object):
+ Preserve detached instances when modifying master object.
+
2008-06-25 Milan Crha <mcrha@redhat.com>
** Fix for bug #476640
ECalComponent *comp, *recurrence;
ECalBackendFileObject *obj_data;
struct icaltimetype current;
+ GList *detached = NULL;
cbfile = E_CAL_BACKEND_FILE (backend);
priv = cbfile->priv;
if (old_object)
*old_object = e_cal_component_get_as_string (obj_data->full_object);
+ if (obj_data->recurrences_list) {
+ /* has detached components, preserve them */
+ GList *l;
+
+ for (l = obj_data->recurrences_list; l; l = l->next) {
+ detached = g_list_prepend (detached, g_object_ref (l->data));
+ }
+ }
+
remove_component (cbfile, comp_uid, obj_data);
/* Add the new object */
add_component (cbfile, comp, TRUE);
+
+ if (detached) {
+ /* it had some detached components, place them back */
+ comp_uid = icalcomponent_get_uid (e_cal_component_get_icalcomponent (comp));
+
+ if ((obj_data = g_hash_table_lookup (priv->comp_uid_hash, comp_uid)) != NULL) {
+ GList *l;
+
+ for (l = detached; l; l = l->next) {
+ ECalComponent *c = l->data;
+
+ g_hash_table_insert (obj_data->recurrences, e_cal_component_get_recurid_as_string (c), c);
+ icalcomponent_add_component (priv->icalcomp, e_cal_component_get_icalcomponent (c));
+ priv->comp = g_list_append (priv->comp, c);
+ obj_data->recurrences_list = g_list_append (obj_data->recurrences_list, c);
+ }
+ }
+
+ g_list_free (detached);
+ }
break;
}