[Evolution-hackers] e_cal_remove_object_with_mod() + empty rid: semantic?



Hello!

I'm running into an old nemesis of mine: how do I remove the parent
event (the one with RRULE) without also removing child events (=
detached recurrences, exceptions)?

This is not something that is needed by the Evolution UI, but IMHO it is
a valid operation. Definitely can happen during syncing or when using a
different front end.

It is possible to create a calendar which only has the child event in
Evolution by importing a meeting invitation for just one instance of a
recurring event.

I consider such a calendar valid, but there is no clean way to get to
that state after the parent has been added, as far as I know.
e_cal_remove_object_with_mod() looks promising, but I can't get it to
work:

/**
 * e_cal_remove_object_with_mod:
 * @ecal: A calendar client.
 * @uid: UID og the object to remove.
 * @rid: Recurrence ID of the specific recurrence to remove.
 * @mod: Type of removal.
 * @error: Placeholder for error information.
 *
 * This function allows the removal of instances of a recurrent
 * appointment. By using a combination of the @uid, @rid and @mod
 * arguments, you can remove specific instances. If what you want
 * is to remove all instances, use e_cal_remove_object instead.
 *
 * If not all instances are removed, the client will get a "obj_modified"
 * signal, while it will get a "obj_removed" signal when all instances
 * are removed.
 *
 * Returns: TRUE if the operation was successful, FALSE otherwise.
 */
gboolean
e_cal_remove_object_with_mod (ECal *ecal, const gchar *uid,
                              const gchar *rid, CalObjModType mod,
                              GError **error)

The documentation does not explain which combination of the parameters
does what.

Previously, passing a NULL or empty rid (don't remember exactly, but I
probably tried both at that time) confused the Exchange connector
backend. Therefore it wasn't possible to remove just the parent event.

In SyncEvolution I added weird hacks for this, like first retrieving all
children, removing the whole series with e_cal_remove_object(), then
re-adding the children.

I was hoping to avoid this with more recent EDS, the local file backend
and simply calling e_cal_remove_object_with_mod() regardless whether it
has an rid or not. But it turns out that
e_cal_remove_object_with_mod(rid="") simply calls the removeObject D-Bus
method with an empty string for the rid, just like e_cal_remove_object()
does, and thus all events sharing the same UID get deleted.

rid=NULL doesn't make any difference.

What is the intended semantic of e_cal_remove_object_with_mod()? If "rid
empty or NULL, then remove only parent"?

I also wonder about the "objects-removed" signal in ECalView. If there
are two events, one with RRULE and one with RECURRENCE-RULE, and both
get removed, should there be two entries in "objects-removed"?

I might be misreading my debug logging, but that doesn't seem to happen.
Before I dig deeper, I'd like to get some feedback on the expected
semantic.

-- 
Bye, Patrick Ohly
--  
Patrick Ohly gmx de
http://www.estamos.de/




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