evolution-data-server r9094 - in trunk/calendar: . backends/file



Author: mcrha
Date: Fri Jul  4 07:23:40 2008
New Revision: 9094
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9094&view=rev

Log:
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.



Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/backends/file/e-cal-backend-file.c

Modified: trunk/calendar/backends/file/e-cal-backend-file.c
==============================================================================
--- trunk/calendar/backends/file/e-cal-backend-file.c	(original)
+++ trunk/calendar/backends/file/e-cal-backend-file.c	Fri Jul  4 07:23:40 2008
@@ -1924,6 +1924,7 @@
 	ECalComponent *comp, *recurrence;
 	ECalBackendFileObject *obj_data;
 	struct icaltimetype current;
+	GList *detached = NULL;
 
 	cbfile = E_CAL_BACKEND_FILE (backend);
 	priv = cbfile->priv;
@@ -2137,10 +2138,39 @@
 		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;
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]