[evolution-patches] merge from recurrences-work-branch



This is the patch for merging the recurrences-work-branch to HEAD for
e-d-s.

As I talked with JP, while evo is not yet ready, but these changes don't
affect the client API and evo HEAD works perfectly with it, so we
thought it would be better to merge e-d-s now and evo in 1 or 2 days.

It is now committed for people to start finding possible secondary
effects, but please have a look at the patch in case I missed something.
-- 
Rodrigo Moya <rodrigo novell com>
? .ChangeLogcvsdiff.swp
? config.guess
? config.sub
? depcomp
? install-sh
? ltmain.sh
? missing
? mkinstalldirs
? ylwrap
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.358
diff -u -p -r1.358 ChangeLog
--- ChangeLog	15 Dec 2004 09:08:04 -0000	1.358
+++ ChangeLog	15 Dec 2004 18:11:32 -0000
@@ -1,3 +1,47 @@
+2004-12-15  Rodrigo Moya <rodrigo novell com>
+
+	Merge from recurrences-work-branch
+
+	* libecal/e-cal.c (open_calendar): added missing calls to
+	e_calendar_remove_op/e_calendar_free_op.
+	(add_instance): enable code to set the recurrence ID on each instance.
+
+	* libedata-cal/e-data-cal.[ch] (e_data_cal_notify_object_removed): added
+	new argument to have backends send both the object before and after the
+	modification.
+
+	* libedata-cal/e-cal-backend.[ch] (e_cal_backend_modify_object):
+	pass correct number of arguments to e_cal_backend_notify_object_removed.
+	(match_query_and_notify, e_cal_backend_notify_object_modified): separated
+	the notification logic from e_cal_backend_notify_object_modified.
+	(e_cal_backend_notify_object_removed): added new argument to have
+	backends send both the object before and after the modification.
+
+	* libedata-cal/e-cal-backend-sync.[ch] (e_cal_backend_sync_remove_object):
+	added a new argument to send the object as it was before being removed.
+	Also, change meaning of 'object' argument to contain the object as it
+	is after being modified, or NULL if it was removed.
+	(_e_cal_backend_remove_object): adapted to change in method arguments
+	and pass correct number of arguments to e_data_cal_notify_object_removed.
+
+	* backends/contacts/e-cal-backend-contacts.c (contact_record_free):
+	pass correct number of arguments to e_cal_backend_notify_object_removed.
+	
+	* backends/file/e-cal-backend-file.c (notify_removals_cb,
+	e_cal_backend_file_receive_objects):
+	pass correct number of arguments to e_cal_backend_notify_object_removed.
+	(remove_object_instance_cb, e_cal_backend_file_modify_object): adapted to
+	support detached recurrences and THISANDPRIOR/THISANDFUTURE.
+	(e_cal_backend_file_remove_object): adapted to method changes.
+
+	* backends/groupwise/e-cal-backend-groupwise.c (get_deltas, receive_object):
+	pass correct number of arguments to e_cal_backend_notify_object_removed.
+	(e_cal_backend_groupwise_remove_object): adapted to method changes.
+
+	* backends/http/e-cal-backend-http.c (notify_and_remove_from_cache):
+	pass correct number of arguments to e_cal_backend_notify_object_removed.
+	(e_cal_backend_http_remove_object): adapted to method changes.
+
 2004-12-15  Chenthill Palanisamy <pchenthill novell com>
 
 	* backends/groupwise/e-cal-backend-groupwise-utils.c:
Index: backends/contacts/e-cal-backend-contacts.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/contacts/e-cal-backend-contacts.c,v
retrieving revision 1.13
diff -u -p -r1.13 e-cal-backend-contacts.c
--- backends/contacts/e-cal-backend-contacts.c	14 Aug 2004 05:20:27 -0000	1.13
+++ backends/contacts/e-cal-backend-contacts.c	15 Dec 2004 18:11:32 -0000
@@ -176,7 +176,7 @@ contact_record_free (ContactRecord *cr)
 	if (cr->comp_birthday) {
 		comp_str = e_cal_component_get_as_string (cr->comp_birthday);
 		e_cal_component_get_uid (cr->comp_birthday, &uid);
-		e_cal_backend_notify_object_removed (E_CAL_BACKEND (cr->cbc), uid, comp_str);
+		e_cal_backend_notify_object_removed (E_CAL_BACKEND (cr->cbc), uid, comp_str, NULL);
 		g_free (comp_str);
 		g_object_unref (G_OBJECT (cr->comp_birthday));
 	}
@@ -185,7 +185,7 @@ contact_record_free (ContactRecord *cr)
 	if (cr->comp_anniversary) {
 		comp_str = e_cal_component_get_as_string (cr->comp_anniversary);
 		e_cal_component_get_uid (cr->comp_anniversary, &uid);
-		e_cal_backend_notify_object_removed (E_CAL_BACKEND (cr->cbc), uid, comp_str);
+		e_cal_backend_notify_object_removed (E_CAL_BACKEND (cr->cbc), uid, comp_str, NULL);
 		g_free (comp_str);
 		g_object_unref (G_OBJECT (cr->comp_anniversary));
 	}
Index: backends/file/e-cal-backend-file.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/file/e-cal-backend-file.c,v
retrieving revision 1.36
diff -u -p -r1.36 e-cal-backend-file.c
--- backends/file/e-cal-backend-file.c	28 Oct 2004 00:16:21 -0000	1.36
+++ backends/file/e-cal-backend-file.c	15 Dec 2004 18:11:33 -0000
@@ -682,7 +682,7 @@ notify_removals_cb (gpointer key, gpoint
 		if (!old_obj_str)
 			return;
 
-		e_cal_backend_notify_object_removed (context->backend, uid, old_obj_str);
+		e_cal_backend_notify_object_removed (context->backend, uid, old_obj_str, NULL);
 	}
 }
 
@@ -1721,10 +1721,56 @@ e_cal_backend_file_create_object (ECalBa
 	return GNOME_Evolution_Calendar_Success;
 }
 
+typedef struct {
+	ECalBackendFile *cbfile;
+	ECalBackendFileObject *obj_data;
+	const char *rid;
+	CalObjModType mod;
+} RemoveRecurrenceData;
+
+static gboolean
+remove_object_instance_cb (gpointer key, gpointer value, gpointer user_data)
+{
+	time_t fromtt, instancett;
+	GSList *categories;
+	char *rid = key;
+	ECalComponent *instance = value;
+	RemoveRecurrenceData *rrdata = user_data;
+
+	fromtt = icaltime_as_timet (icaltime_from_string (rrdata->rid));
+	instancett = icaltime_as_timet (get_rid_icaltime (instance));
+
+	if (fromtt > 0 && instancett > 0) {
+		if ((rrdata->mod == CALOBJ_MOD_THISANDPRIOR && instancett <= fromtt) ||
+		    (rrdata->mod == CALOBJ_MOD_THISANDFUTURE && instancett >= fromtt)) {
+			/* remove the component from our data */
+			icalcomponent_remove_component (rrdata->cbfile->priv->icalcomp,
+							e_cal_component_get_icalcomponent (instance));
+			rrdata->cbfile->priv->comp = g_list_remove (rrdata->cbfile->priv->comp, instance);
+
+			rrdata->obj_data->recurrences_list = g_list_remove (rrdata->obj_data->recurrences_list, instance);
+
+			/* update the set of categories */
+			e_cal_component_get_categories_list (instance, &categories);
+			e_cal_backend_unref_categories (E_CAL_BACKEND (rrdata->cbfile), categories);
+			e_cal_component_free_categories_list (categories);
+
+			/* free memory */
+			g_free (rid);
+			g_object_unref (instance);
+
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+
 static ECalBackendSyncStatus
 e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, const char *calobj, 
 				  CalObjModType mod, char **old_object)
 {
+	RemoveRecurrenceData rrdata;
 	ECalBackendFile *cbfile;
 	ECalBackendFilePrivate *priv;
 	icalcomponent *icalcomp;
@@ -1820,9 +1866,7 @@ e_cal_backend_file_modify_object (ECalBa
 			e_cal_util_remove_instances (e_cal_component_get_icalcomponent (obj_data->full_object),
 						     get_rid_icaltime (comp),
 						     mod);
-
-			new = e_cal_component_get_as_string (obj_data->full_object);
-
+			new = e_cal_component_get_as_string (comp);
 			e_cal_backend_notify_object_modified (E_CAL_BACKEND (backend), old, new);
 
 			if (old_object)
@@ -1833,14 +1877,80 @@ e_cal_backend_file_modify_object (ECalBa
 		}
 
 		/* add the detached instance */
+		icalcomponent_set_recurrenceid (e_cal_component_get_icalcomponent (comp),
+						icaltime_from_string (rid));
 		g_hash_table_insert (obj_data->recurrences, 
 				     g_strdup (e_cal_component_get_recurid_as_string (comp)),
 				     comp);
+		icalcomponent_add_component (priv->icalcomp,
+					     e_cal_component_get_icalcomponent (comp));
+		priv->comp = g_list_append (priv->comp, comp);
 		obj_data->recurrences_list = g_list_append (obj_data->recurrences_list, comp);
 		break;
 	case CALOBJ_MOD_THISANDPRIOR :
-		break;
 	case CALOBJ_MOD_THISANDFUTURE :
+		rid = e_cal_component_get_recurid_as_string (comp);
+		if (!rid || !*rid) {
+			if (old_object)
+				*old_object = e_cal_component_get_as_string (obj_data->full_object);
+
+			remove_component (cbfile, obj_data->full_object);
+
+			/* Add the new object */
+			add_component (cbfile, comp, TRUE);
+			break;
+		}
+
+		/* remove the component from our data, temporarily */
+		icalcomponent_remove_component (priv->icalcomp,
+						e_cal_component_get_icalcomponent (obj_data->full_object));
+		priv->comp = g_list_remove (priv->comp, obj_data->full_object);
+
+		/* now deal with the detached recurrence */
+		if (g_hash_table_lookup_extended (obj_data->recurrences, rid,
+						  &real_rid, &recurrence)) {
+			if (old_object)
+				*old_object = e_cal_component_get_as_string (recurrence);
+
+			/* remove the component from our data */
+			icalcomponent_remove_component (priv->icalcomp,
+							e_cal_component_get_icalcomponent (recurrence));
+			priv->comp = g_list_remove (priv->comp, recurrence);
+			g_hash_table_remove (obj_data->recurrences, rid);
+			obj_data->recurrences_list = g_list_remove (obj_data->recurrences_list, recurrence);
+
+			/* free memory */
+			g_free (real_rid);
+		} else {
+			if (old_object)
+				*old_object = e_cal_component_get_as_string (obj_data->full_object);
+		}
+
+		/* remove all affected recurrences */
+		e_cal_util_remove_instances (e_cal_component_get_icalcomponent (obj_data->full_object),
+					     icaltime_from_string (rid), mod);
+
+		rrdata.cbfile = cbfile;
+		rrdata.obj_data = obj_data;
+		rrdata.rid = rid;
+		rrdata.mod = mod;
+		g_hash_table_foreach_remove (obj_data->recurrences, (GHRFunc) remove_object_instance_cb, &rrdata);
+
+		/* add the modified object to the beginning of the list,
+		   so that it's always before any detached instance we
+		   might have */
+		icalcomponent_add_component (priv->icalcomp,
+					     e_cal_component_get_icalcomponent (obj_data->full_object));
+		priv->comp = g_list_prepend (priv->comp, obj_data->full_object);
+
+		/* add the new detached recurrence */
+		g_hash_table_insert (obj_data->recurrences, 
+				     g_strdup (e_cal_component_get_recurid_as_string (comp)),
+				     comp);
+		icalcomponent_add_component (priv->icalcomp,
+					     e_cal_component_get_icalcomponent (comp));
+		priv->comp = g_list_append (priv->comp, comp);
+		obj_data->recurrences_list = g_list_append (obj_data->recurrences_list, comp);
 		break;
 	case CALOBJ_MOD_ALL :
 		/* in this case, we blow away all recurrences, and start over
@@ -1907,62 +2017,17 @@ remove_instance (ECalBackendFile *cbfile
 	cbfile->priv->comp = g_list_prepend (cbfile->priv->comp, obj_data->full_object);
 }
 
-typedef struct {
-	ECalBackendFile *cbfile;
-	ECalBackendFileObject *obj_data;
-	const char *rid;
-	CalObjModType mod;
-} RemoveRecurrenceData;
-
-static gboolean
-remove_object_instance_cb (gpointer key, gpointer value, gpointer user_data)
-{
-	time_t fromtt, instancett;
-	GSList *categories;
-	char *rid = key;
-	ECalComponent *instance = value;
-	RemoveRecurrenceData *rrdata = user_data;
-
-	fromtt = icaltime_as_timet (icaltime_from_string (rrdata->rid));
-	instancett = icaltime_as_timet (get_rid_icaltime (instance));
-
-	if (fromtt > 0 && instancett > 0) {
-		if ((rrdata->mod == CALOBJ_MOD_THISANDPRIOR && instancett <= fromtt) ||
-		    (rrdata->mod == CALOBJ_MOD_THISANDFUTURE && instancett >= fromtt)) {
-			/* remove the component from our data */
-			icalcomponent_remove_component (rrdata->cbfile->priv->icalcomp,
-							e_cal_component_get_icalcomponent (instance));
-			rrdata->cbfile->priv->comp = g_list_remove (rrdata->cbfile->priv->comp, instance);
-
-			rrdata->obj_data->recurrences_list = g_list_remove (rrdata->obj_data->recurrences_list, instance);
-
-			/* update the set of categories */
-			e_cal_component_get_categories_list (instance, &categories);
-			e_cal_backend_unref_categories (E_CAL_BACKEND (rrdata->cbfile), categories);
-			e_cal_component_free_categories_list (categories);
-
-			/* free memory */
-			g_free (rid);
-			g_object_unref (instance);
-
-			return TRUE;
-		}
-	}
-
-	return FALSE;
-}
-
 /* Remove_object handler for the file backend */
 static ECalBackendSyncStatus
 e_cal_backend_file_remove_object (ECalBackendSync *backend, EDataCal *cal,
 				  const char *uid, const char *rid,
-				  CalObjModType mod, char **object)
+				  CalObjModType mod, char **old_object,
+				  char **object)
 {
 	ECalBackendFile *cbfile;
 	ECalBackendFilePrivate *priv;
 	ECalBackendFileObject *obj_data;
 	ECalComponent *comp;
-	GSList *categories;
 	RemoveRecurrenceData rrdata;
 
 	cbfile = E_CAL_BACKEND_FILE (backend);
@@ -1971,6 +2036,8 @@ e_cal_backend_file_remove_object (ECalBa
 	g_return_val_if_fail (priv->icalcomp != NULL, GNOME_Evolution_Calendar_NoSuchCal);
 	g_return_val_if_fail (uid != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
 
+	*old_object = *object = NULL;
+
 	obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
 	if (!obj_data)
 		return GNOME_Evolution_Calendar_ObjectNotFound;
@@ -1979,10 +2046,19 @@ e_cal_backend_file_remove_object (ECalBa
 
 	switch (mod) {
 	case CALOBJ_MOD_ALL :
-		*object = e_cal_component_get_as_string (comp);
+		*old_object = e_cal_component_get_as_string (comp);
 		remove_component (cbfile, comp);
+		*object = NULL;
 		break;
 	case CALOBJ_MOD_THIS :
+		*old_object = e_cal_component_get_as_string (comp);
+		if (!rid || !*rid) {
+			remove_component (cbfile, comp);
+			*object = NULL;
+		} else {
+			remove_instance (cbfile, obj_data, rid);
+			*object = e_cal_component_get_as_string (obj_data->full_object);
+		}
 		*object = e_cal_component_get_as_string (comp);
 		if (!rid || !*rid)
 			remove_component (cbfile, comp);
@@ -1994,7 +2070,7 @@ e_cal_backend_file_remove_object (ECalBa
 		if (!rid || !*rid)
 			return GNOME_Evolution_Calendar_ObjectNotFound;
 
-		*object = e_cal_component_get_as_string (comp);
+		*old_object = e_cal_component_get_as_string (comp);
 
 		/* remove the component from our data, temporarily */
 		icalcomponent_remove_component (priv->icalcomp,
@@ -2015,6 +2091,8 @@ e_cal_backend_file_remove_object (ECalBa
 		   so that it's always before any detached instance we
 		   might have */
 		priv->comp = g_list_prepend (priv->comp, comp);
+
+		*object = e_cal_component_get_as_string (obj_data->full_object);
 		break;
 	}
 
@@ -2199,11 +2277,19 @@ e_cal_backend_file_receive_objects (ECal
 		case ICAL_METHOD_CANCEL:
 			if (cancel_received_object (cbfile, subcomp)) {
 				object = (char *) icalcomponent_as_ical_string (subcomp);
-				e_cal_backend_notify_object_removed (E_CAL_BACKEND (backend), uid, object);
+				old_comp = lookup_component (cbfile, uid);
+				if (old_comp)
+					old_object = e_cal_component_get_as_string (old_comp);
+				else
+					old_object = NULL;
+
+				e_cal_backend_notify_object_removed (E_CAL_BACKEND (backend), uid, old_object, object);
 
 				/* remove the component from the toplevel VCALENDAR */
 				icalcomponent_remove_component (toplevel_comp, subcomp);
 				icalcomponent_free (subcomp);
+
+				g_free (old_object);
 			}
 			break;
 		default:
Index: backends/groupwise/e-cal-backend-groupwise.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise.c,v
retrieving revision 1.108
diff -u -p -r1.108 e-cal-backend-groupwise.c
--- backends/groupwise/e-cal-backend-groupwise.c	15 Dec 2004 09:08:04 -0000	1.108
+++ backends/groupwise/e-cal-backend-groupwise.c	15 Dec 2004 18:11:33 -0000
@@ -321,7 +321,7 @@ get_deltas (gpointer handle)
 				(vtype == E_CAL_COMPONENT_TODO)) {
 			comp_str = e_cal_component_get_as_string (comp);
 			e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), 
-								(char *) l->data, comp_str);
+							     (char *) l->data, comp_str, NULL);
 			e_cal_backend_cache_remove_component (cache, (const char *) l->data, NULL);
 			g_free (comp_str);
 		}
@@ -1413,7 +1413,8 @@ e_cal_backend_groupwise_modify_object (E
 static ECalBackendSyncStatus
 e_cal_backend_groupwise_remove_object (ECalBackendSync *backend, EDataCal *cal,
 				       const char *uid, const char *rid,
-				       CalObjModType mod, char **object)
+				       CalObjModType mod, char **old_object,
+				       char **object)
 {
 	ECalBackendGroupwise *cbgw;
         ECalBackendGroupwisePrivate *priv;
@@ -1422,6 +1423,8 @@ e_cal_backend_groupwise_remove_object (E
 	cbgw = E_CAL_BACKEND_GROUPWISE (backend);
 	priv = cbgw->priv;
 
+	*old_object = *object = NULL;
+
 	/* if online, remove the item from the server */
 	if (priv->mode == CAL_MODE_REMOTE) {
 		ECalBackendSyncStatus status;
@@ -1433,6 +1436,8 @@ e_cal_backend_groupwise_remove_object (E
 		if (status != GNOME_Evolution_Calendar_Success)
 			return status;
 
+		*old_object = calobj;
+
 		icalcomp = icalparser_parse_string (calobj);
 		if (!icalcomp) {
 			g_free (calobj);
@@ -1517,7 +1522,8 @@ receive_object (ECalBackendGroupwise *cb
 			
 			e_cal_component_get_uid (comp, (const char **) &uid);
 			e_cal_backend_cache_remove_component (priv->cache, uid, NULL);
-			e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), uid, e_cal_component_get_as_string (comp));
+			e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), uid, e_cal_component_get_as_string (comp), NULL);
+			g_free (comp);
 		}
 		else {
 			char *cache_comp = NULL, *temp, *new_comp = NULL;
Index: backends/http/e-cal-backend-http.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/http/e-cal-backend-http.c,v
retrieving revision 1.21
diff -u -p -r1.21 e-cal-backend-http.c
--- backends/http/e-cal-backend-http.c	9 Dec 2004 15:52:35 -0000	1.21
+++ backends/http/e-cal-backend-http.c	15 Dec 2004 18:11:33 -0000
@@ -200,7 +200,7 @@ notify_and_remove_from_cache (gpointer k
 	const char *calobj = value;
 	ECalBackendHttp *cbhttp = E_CAL_BACKEND_HTTP (user_data);
 
-	e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbhttp), uid, calobj);
+	e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbhttp), uid, calobj, NULL);
 
 	return TRUE;
 }
@@ -788,7 +788,8 @@ e_cal_backend_http_modify_object (ECalBa
 static ECalBackendSyncStatus
 e_cal_backend_http_remove_object (ECalBackendSync *backend, EDataCal *cal,
 				const char *uid, const char *rid,
-				CalObjModType mod, char **object)
+				CalObjModType mod, char **old_object,
+				char **object)
 {
 	ECalBackendHttp *cbhttp;
 	ECalBackendHttpPrivate *priv;
@@ -797,6 +798,8 @@ e_cal_backend_http_remove_object (ECalBa
 	priv = cbhttp->priv;
 
 	g_return_val_if_fail (uid != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
+
+	*old_object = *object = NULL;
 
 	return GNOME_Evolution_Calendar_PermissionDenied;
 }
Index: libecal/e-cal.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal.c,v
retrieving revision 1.84
diff -u -p -r1.84 e-cal.c
--- libecal/e-cal.c	9 Dec 2004 07:00:44 -0000	1.84
+++ libecal/e-cal.c	15 Dec 2004 18:11:34 -0000
@@ -1507,14 +1507,18 @@ open_calendar (ECal *ecal, gboolean only
 		priv->load_state = E_CAL_LOAD_AUTHENTICATING;
 
 		if (priv->auth_func == NULL) {
+			e_calendar_remove_op (ecal, our_op);
 			g_mutex_unlock (our_op->mutex);
+			e_calendar_free_op (our_op);
 			*status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
 			E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
 		}
 
 		username = e_source_get_property (priv->source, "username");
 		if (!username) {
+			e_calendar_remove_op (ecal, our_op);
 			g_mutex_unlock (our_op->mutex);
+			e_calendar_free_op (our_op);
 			*status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
 			E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
 		}
@@ -1526,7 +1530,9 @@ open_calendar (ECal *ecal, gboolean only
 
 		password = priv->auth_func (ecal, prompt, key, priv->auth_user_data);
 		if (!password) {
+			e_calendar_remove_op (ecal, our_op);
 			g_mutex_unlock (our_op->mutex);
+			e_calendar_free_op (our_op);
 			*status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED; 
 			E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
 		}
@@ -2903,7 +2909,7 @@ add_instance (ECalComponent *comp, time_
 {
 	GList **list;
 	struct comp_instance *ci;
-	struct icaltimetype itt_start;
+	struct icaltimetype itt, itt_start;
 	icalcomponent *icalcomp;
 
 	list = data;
@@ -2913,7 +2919,6 @@ add_instance (ECalComponent *comp, time_
 	icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
 	itt_start = icalcomponent_get_dtstart (icalcomp);
 
-#if 0
 	/* set the RECUR-ID for the instance */
 	if (e_cal_util_component_has_recurrences (icalcomp)) {
 		if (!(icalcomponent_get_first_property (icalcomp, ICAL_RECURRENCEID_PROPERTY))) {
@@ -2921,12 +2926,10 @@ add_instance (ECalComponent *comp, time_
 			icalcomponent_set_recurrenceid (icalcomp, itt);
 		}
 	}
-#endif
 
 	/* add the instance to the list */
 	ci->comp = e_cal_component_new ();
 	e_cal_component_set_icalcomponent (ci->comp, icalcomp);
-
 	
 	ci->start = start;
 	ci->end = end;
Index: libedata-cal/e-cal-backend-sync.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend-sync.c,v
retrieving revision 1.10
diff -u -p -r1.10 e-cal-backend-sync.c
--- libedata-cal/e-cal-backend-sync.c	11 Jun 2004 15:54:15 -0000	1.10
+++ libedata-cal/e-cal-backend-sync.c	15 Dec 2004 18:11:34 -0000
@@ -128,13 +128,14 @@ e_cal_backend_sync_modify_object (ECalBa
 
 ECalBackendSyncStatus
 e_cal_backend_sync_remove_object (ECalBackendSync *backend, EDataCal *cal, const char *uid, const char *rid,
-				  CalObjModType mod, char **object)
+				  CalObjModType mod, char **old_object, char **object)
 {
 	g_return_val_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
 	g_return_val_if_fail (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->remove_object_sync != NULL,
 			      GNOME_Evolution_Calendar_UnsupportedMethod);
 
-	return (* E_CAL_BACKEND_SYNC_GET_CLASS (backend)->remove_object_sync) (backend, cal, uid, rid, mod, object);
+	return (* E_CAL_BACKEND_SYNC_GET_CLASS (backend)->remove_object_sync) (backend, cal, uid, rid, mod,
+									       old_object, object);
 }
 
 ECalBackendSyncStatus
@@ -375,21 +376,21 @@ static void
 _e_cal_backend_remove_object (ECalBackend *backend, EDataCal *cal, const char *uid, const char *rid, CalObjModType mod)
 {
 	ECalBackendSyncStatus status;
-	char *object = NULL;
+	char *object = NULL, *old_object = NULL;
 	
-	status = e_cal_backend_sync_remove_object (E_CAL_BACKEND_SYNC (backend), cal, uid, rid, mod, &object);
+	status = e_cal_backend_sync_remove_object (E_CAL_BACKEND_SYNC (backend), cal, uid, rid, mod, &old_object, &object);
 
 	if (status == GNOME_Evolution_Calendar_Success) {
 		char *calobj = NULL;
 
 		if (e_cal_backend_sync_get_object (E_CAL_BACKEND_SYNC (backend), cal, uid, NULL, &calobj)
 		    == GNOME_Evolution_Calendar_Success) {
-			e_data_cal_notify_object_modified (cal, status, object, calobj);
+			e_data_cal_notify_object_modified (cal, status, old_object, calobj);
 			g_free (calobj);
 		} else
-			e_data_cal_notify_object_removed (cal, status, uid, object);
+			e_data_cal_notify_object_removed (cal, status, uid, old_object, object);
 	} else
-		e_data_cal_notify_object_removed (cal, status, uid, object);
+		e_data_cal_notify_object_removed (cal, status, uid, old_object, object);
 
 	g_free (object);
 }
Index: libedata-cal/e-cal-backend-sync.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend-sync.h,v
retrieving revision 1.7
diff -u -p -r1.7 e-cal-backend-sync.h
--- libedata-cal/e-cal-backend-sync.h	11 Jun 2004 15:54:15 -0000	1.7
+++ libedata-cal/e-cal-backend-sync.h	15 Dec 2004 18:11:34 -0000
@@ -44,7 +44,7 @@ struct _ECalBackendSyncClass {
 
 	ECalBackendSyncStatus (*create_object_sync)  (ECalBackendSync *backend, EDataCal *cal, char **calobj, char **uid);
 	ECalBackendSyncStatus (*modify_object_sync)  (ECalBackendSync *backend, EDataCal *cal, const char *calobj, CalObjModType mod, char **old_object);
-	ECalBackendSyncStatus (*remove_object_sync)  (ECalBackendSync *backend, EDataCal *cal, const char *uid, const char *rid, CalObjModType mod, char **object);
+	ECalBackendSyncStatus (*remove_object_sync)  (ECalBackendSync *backend, EDataCal *cal, const char *uid, const char *rid, CalObjModType mod, char **old_object, char **object);
 
 	ECalBackendSyncStatus (*discard_alarm_sync)  (ECalBackendSync *backend, EDataCal *cal, const char *uid, const char *auid);
 
@@ -110,6 +110,7 @@ ECalBackendSyncStatus e_cal_backend_sync
 							       const char      *uid,
 							       const char      *rid,
 							       CalObjModType    mod,
+							       char **old_object,
 							       char **object);
 ECalBackendSyncStatus e_cal_backend_sync_discard_alarm (ECalBackendSync *backend, EDataCal *cal, const char *uid, const char *auid);
 
Index: libedata-cal/e-cal-backend.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend.c,v
retrieving revision 1.10
diff -u -p -r1.10 e-cal-backend.c
--- libedata-cal/e-cal-backend.c	13 Dec 2004 03:43:21 -0000	1.10
+++ libedata-cal/e-cal-backend.c	15 Dec 2004 18:11:35 -0000
@@ -824,7 +824,7 @@ e_cal_backend_modify_object (ECalBackend
 	if (CLASS (backend)->modify_object)
 		(* CLASS (backend)->modify_object) (backend, cal, calobj, mod);
 	else
-		e_data_cal_notify_object_removed (cal, GNOME_Evolution_Calendar_PermissionDenied, NULL, NULL);
+		e_data_cal_notify_object_removed (cal, GNOME_Evolution_Calendar_PermissionDenied, NULL, NULL, NULL);
 }
 
 /**
@@ -1006,6 +1006,28 @@ e_cal_backend_notify_object_created (ECa
 	g_object_unref (iter);
 }
 
+static void
+match_query_and_notify (EDataCalView *query, const char *old_object, const char *object)
+{
+	gboolean old_match, new_match;
+
+	old_match = e_data_cal_view_object_matches (query, old_object);
+	new_match = e_data_cal_view_object_matches (query, object);
+	if (old_match && new_match)
+		e_data_cal_view_notify_objects_modified_1 (query, object);
+	else if (new_match)
+		e_data_cal_view_notify_objects_added_1 (query, object);
+	else if (old_match) {
+		icalcomponent *icalcomp;
+	
+		icalcomp = icalcomponent_new_from_string ((char *) old_object);
+		if (icalcomp) {
+			e_data_cal_view_notify_objects_removed_1 (query, icalcomponent_get_uid (icalcomp));
+			icalcomponent_free (icalcomp);
+		}
+	}
+}
+
 /**
  * e_cal_backend_notify_object_modified:
  * @backend: A calendar backend.
@@ -1020,13 +1042,12 @@ e_cal_backend_notify_object_created (ECa
  **/
 void
 e_cal_backend_notify_object_modified (ECalBackend *backend, 
-				    const char *old_object, const char *object)
+				      const char *old_object, const char *object)
 {
 	ECalBackendPrivate *priv;
 	EList *queries;
 	EIterator *iter;
 	EDataCalView *query;
-	gboolean old_match, new_match;
 
 	priv = backend->priv;
 
@@ -1040,23 +1061,9 @@ e_cal_backend_notify_object_modified (EC
 
 	while (e_iterator_is_valid (iter)) {
 		query = QUERY (e_iterator_get (iter));
-		
-		bonobo_object_ref (query);
-
-		old_match = e_data_cal_view_object_matches (query, old_object);
-		new_match = e_data_cal_view_object_matches (query, object);
-		if (old_match && new_match)
-			e_data_cal_view_notify_objects_modified_1 (query, object);
-		else if (new_match)
-			e_data_cal_view_notify_objects_added_1 (query, object);
-		else if (old_match) {
-			icalcomponent *comp;
-
-			comp = icalcomponent_new_from_string ((char *)old_object);
-			e_data_cal_view_notify_objects_removed_1 (query, icalcomponent_get_uid (comp));
-			icalcomponent_free (comp);
-		}
 
+		bonobo_object_ref (query);
+		match_query_and_notify (query, old_object, object);
 		bonobo_object_unref (query);
 
 		e_iterator_next (iter);
@@ -1069,6 +1076,9 @@ e_cal_backend_notify_object_modified (EC
  * @backend: A calendar backend.
  * @uid: the UID of the removed object
  * @old_object: iCalendar representation of the removed object
+ * @new_object: iCalendar representation of the object after the removal. This
+ * only applies to recurrent appointments that had an instance removed. In that
+ * case, this function notifies a modification instead of a removal.
  *
  * Notifies each of the backend's listeners about a removed object.
  *
@@ -1078,7 +1088,7 @@ e_cal_backend_notify_object_modified (EC
  **/
 void
 e_cal_backend_notify_object_removed (ECalBackend *backend, const char *uid,
-				     const char *old_object)
+				     const char *old_object, const char *object)
 {
 	ECalBackendPrivate *priv;
 	EList *queries;
@@ -1088,7 +1098,7 @@ e_cal_backend_notify_object_removed (ECa
 	priv = backend->priv;
 
 	if (priv->notification_proxy) {
-		e_cal_backend_notify_object_removed (priv->notification_proxy, uid, old_object);
+		e_cal_backend_notify_object_removed (priv->notification_proxy, uid, old_object, object);
 		return;
 	}
 
@@ -1099,8 +1109,15 @@ e_cal_backend_notify_object_removed (ECa
 		query = QUERY (e_iterator_get (iter));
 
 		bonobo_object_ref (query);
-		if (e_data_cal_view_object_matches (query, old_object))
-			e_data_cal_view_notify_objects_removed_1 (query, uid);
+
+		if (object == NULL) {
+			/* if object == NULL, it means the object has been completely
+			   removed from the backend */
+			if (e_data_cal_view_object_matches (query, old_object))
+				e_data_cal_view_notify_objects_removed_1 (query, uid);
+		} else
+			match_query_and_notify (query, old_object, object);
+
 		bonobo_object_unref (query);
 
 		e_iterator_next (iter);
Index: libedata-cal/e-cal-backend.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend.h,v
retrieving revision 1.7
diff -u -p -r1.7 e-cal-backend.h
--- libedata-cal/e-cal-backend.h	11 Jun 2004 15:54:15 -0000	1.7
+++ libedata-cal/e-cal-backend.h	15 Dec 2004 18:11:35 -0000
@@ -165,7 +165,7 @@ void e_cal_backend_last_client_gone (ECa
 void e_cal_backend_set_notification_proxy (ECalBackend *backend, ECalBackend *proxy);
 void e_cal_backend_notify_object_created  (ECalBackend *backend, const char *calobj);
 void e_cal_backend_notify_object_modified (ECalBackend *backend, const char *old_object, const char *object);
-void e_cal_backend_notify_object_removed  (ECalBackend *backend, const char *uid, const char *old_object);
+void e_cal_backend_notify_object_removed  (ECalBackend *backend, const char *uid, const char *old_object, const char *object);
 
 void e_cal_backend_notify_mode      (ECalBackend *backend,
 				     GNOME_Evolution_Calendar_CalListener_SetModeStatus status, 
Index: libedata-cal/e-data-cal.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-data-cal.c,v
retrieving revision 1.10
diff -u -p -r1.10 e-data-cal.c
--- libedata-cal/e-data-cal.c	30 Sep 2004 16:49:48 -0000	1.10
+++ libedata-cal/e-data-cal.c	15 Dec 2004 18:11:35 -0000
@@ -851,7 +851,7 @@ e_data_cal_notify_object_modified (EData
 
 void
 e_data_cal_notify_object_removed (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status, 
-				  const char *uid, const char *object)
+				  const char *uid, const char *old_object, const char *object)
 {
 	EDataCalPrivate *priv;
 	CORBA_Environment ev;
@@ -863,7 +863,7 @@ e_data_cal_notify_object_removed (EDataC
 	g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
 
 	if (status == GNOME_Evolution_Calendar_Success)
-		e_cal_backend_notify_object_removed (priv->backend, uid, object);
+		e_cal_backend_notify_object_removed (priv->backend, uid, old_object, object);
 
 	CORBA_exception_init (&ev);
 	GNOME_Evolution_Calendar_CalListener_notifyObjectRemoved (priv->listener, status, &ev);
Index: libedata-cal/e-data-cal.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-data-cal.h,v
retrieving revision 1.6
diff -u -p -r1.6 e-data-cal.h
--- libedata-cal/e-data-cal.h	30 Sep 2004 16:49:48 -0000	1.6
+++ libedata-cal/e-data-cal.h	15 Dec 2004 18:11:35 -0000
@@ -83,7 +83,7 @@ void e_data_cal_notify_object_created  (
 void e_data_cal_notify_object_modified (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status, 
 					const char *old_object, const char *object);
 void e_data_cal_notify_object_removed  (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status, 
-					const char *uid, const char *object);
+					const char *uid, const char *old_object, const char *object);
 void e_data_cal_notify_alarm_discarded (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status);
 
 void e_data_cal_notify_objects_received (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status);
Index: libical/INSTALL
===================================================================
RCS file: /cvs/gnome/libical/INSTALL,v
retrieving revision 1.4
diff -u -p -r1.4 INSTALL
--- libical/INSTALL	11 Dec 2000 23:01:13 -0000	1.4
+++ libical/INSTALL	15 Dec 2004 18:11:35 -0000
@@ -1,24 +1,231 @@
-Building the library
---------------------
+Installation Instructions
+*************************
 
-This distribution is developed on Red Hat Linux 6.0 and usually
-compiles on SunOS 5.6 and FreeBSD 2.27. I have reports of success of
-previous version on MacOS ( with CodeWarrior ) and on UnixWare, but I
-don't know about any other systems.
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free
+Software Foundation, Inc.
 
-The library is configured with automake. From the root directory, run 
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
 
-	./configure
+Basic Installation
+==================
+
+These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about.  Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory.  After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PREFIX'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PREFIX', the package will
+use PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the `--target=TYPE' option to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+will cause the specified gcc to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+     Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
 
-To build all of the Makefiles for your system. If you will be installing the library, you may want to use the --prefix flag to set the directory where the library and header files will be installed. 
-
-	./configure --prefix=/proj/local/
-
-If configure runs fine, run "make" to build the library and 
-"make install" to install it.
-
-The current version of libical focuses on creating and
-manipulating iCal objects. With it, you can parse text representations
-of iCal components, add and remove sub-components, properties,
-parameters and values, and print the components back out as strings. 
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
 


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