diff options
author | Dan Winship <danw@src.gnome.org> | 2003-10-28 21:32:55 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2003-10-28 21:32:55 +0800 |
commit | 179cdf36868b8702b3bc7a78201f6d70142a6a6d (patch) | |
tree | d36c7facd86131b3d6037022a6d21551b0685a86 /calendar/pcs/cal.c | |
parent | 196efb7acc28bd33d576a84feebf0b5c608825cf (diff) | |
download | gsoc2013-evolution-179cdf36868b8702b3bc7a78201f6d70142a6a6d.tar gsoc2013-evolution-179cdf36868b8702b3bc7a78201f6d70142a6a6d.tar.gz gsoc2013-evolution-179cdf36868b8702b3bc7a78201f6d70142a6a6d.tar.bz2 gsoc2013-evolution-179cdf36868b8702b3bc7a78201f6d70142a6a6d.tar.lz gsoc2013-evolution-179cdf36868b8702b3bc7a78201f6d70142a6a6d.tar.xz gsoc2013-evolution-179cdf36868b8702b3bc7a78201f6d70142a6a6d.tar.zst gsoc2013-evolution-179cdf36868b8702b3bc7a78201f6d70142a6a6d.zip |
New; tell each query about a created/modified/removed object.
* pcs/cal-backend.c (cal_backend_notify_object_created,
cal_backend_notify_object_modified,
cal_backend_notify_object_removed): New; tell each query about a
created/modified/removed object.
* pcs/cal.c (cal_notify_object_created): Use
cal_backend_notify_object_created.
(cal_notify_object_modified, cal_notify_object_removed): Likewise
for modified/removed
(cal_notify_objects_received): we need both the before and after
forms for the modified objects so they can be resolved as
adds/modifies/removes per-query. But the caller can just call the
cal_backend_* routines for each object anyway, so just remove the
created/modified/removed lists.
* pcs/cal-backend-sync.c (cal_backend_sync_receive_objects):
Remove created/modified/removed list arguments.
(_cal_backend_receive_objects): Likewise.
* pcs/cal-backend-file.c (cal_backend_file_receive_objects):
Remove created/modified/removed list arguments. Replace the one
use of *removed with a call to cal_backend_notify_object_removed.
svn path=/trunk/; revision=23102
Diffstat (limited to 'calendar/pcs/cal.c')
-rw-r--r-- | calendar/pcs/cal.c | 104 |
1 files changed, 7 insertions, 97 deletions
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index deaf44ec92..aec1591da3 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -768,8 +768,6 @@ cal_notify_object_created (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, const char *uid, const char *object) { CalPrivate *priv; - EList *queries; - EIterator *iter; CORBA_Environment ev; g_return_if_fail (cal != NULL); @@ -778,25 +776,8 @@ cal_notify_object_created (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, priv = cal->priv; g_return_if_fail (priv->listener != CORBA_OBJECT_NIL); - queries = cal_backend_get_queries (priv->backend); - iter = e_list_get_iterator (queries); - - while (e_iterator_is_valid (iter)) { - Query *query = QUERY (e_iterator_get (iter)); - - bonobo_object_dup_ref (BONOBO_OBJREF (query), NULL); - - if (!query_object_matches (query, object)) - continue; - - query_notify_objects_added_1 (query, object); - - bonobo_object_release_unref (BONOBO_OBJREF (query), NULL); - - e_iterator_next (iter); - } - g_object_unref (iter); - g_object_unref (queries); + if (status == GNOME_Evolution_Calendar_Success) + cal_backend_notify_object_created (priv->backend, object); CORBA_exception_init (&ev); GNOME_Evolution_Calendar_Listener_notifyObjectCreated (priv->listener, status, uid ? uid : "", &ev); @@ -812,8 +793,6 @@ cal_notify_object_modified (Cal *cal, GNOME_Evolution_Calendar_CallStatus status const char *old_object, const char *object) { CalPrivate *priv; - EList *queries; - EIterator *iter; CORBA_Environment ev; g_return_if_fail (cal != NULL); @@ -822,36 +801,8 @@ cal_notify_object_modified (Cal *cal, GNOME_Evolution_Calendar_CallStatus status priv = cal->priv; g_return_if_fail (priv->listener != CORBA_OBJECT_NIL); - queries = cal_backend_get_queries (priv->backend); - iter = e_list_get_iterator (queries); - - while (object && old_object && e_iterator_is_valid (iter)) { - Query *query = QUERY (e_iterator_get (iter)); - gboolean old_match, new_match; - - bonobo_object_dup_ref (BONOBO_OBJREF (query), NULL); - - old_match = query_object_matches (query, old_object); - new_match = query_object_matches (query, object); - if (old_match && new_match) - query_notify_objects_modified_1 (query, object); - else if (new_match) - query_notify_objects_added_1 (query, object); - else /* if (old_match) */ { - icalcomponent *comp; - - comp = icalcomponent_new_from_string ((char *)old_object); - query_notify_objects_removed_1 (query, icalcomponent_get_uid (comp)); - icalcomponent_free (comp); - } - query_notify_query_done (query, GNOME_Evolution_Calendar_Success); - - bonobo_object_release_unref (BONOBO_OBJREF (query), NULL); - - e_iterator_next (iter); - } - g_object_unref (iter); - g_object_unref (queries); + if (status == GNOME_Evolution_Calendar_Success) + cal_backend_notify_object_modified (priv->backend, old_object, object); CORBA_exception_init (&ev); GNOME_Evolution_Calendar_Listener_notifyObjectModified (priv->listener, status, &ev); @@ -867,8 +818,6 @@ cal_notify_object_removed (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, const char *uid, const char *object) { CalPrivate *priv; - EList *queries; - EIterator *iter; CORBA_Environment ev; g_return_if_fail (cal != NULL); @@ -877,25 +826,8 @@ cal_notify_object_removed (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, priv = cal->priv; g_return_if_fail (priv->listener != CORBA_OBJECT_NIL); - queries = cal_backend_get_queries (priv->backend); - iter = e_list_get_iterator (queries); - - while (uid && object && e_iterator_is_valid (iter)) { - Query *query = QUERY (e_iterator_get (iter)); - - bonobo_object_dup_ref (BONOBO_OBJREF (query), NULL); - - if (!query_object_matches (query, object)) - continue; - - query_notify_objects_removed_1 (query, uid); - - bonobo_object_release_unref (BONOBO_OBJREF (query), NULL); - - e_iterator_next (iter); - } - g_object_unref (iter); - g_object_unref (queries); + if (status == GNOME_Evolution_Calendar_Success) + cal_backend_notify_object_removed (priv->backend, uid, object); CORBA_exception_init (&ev); GNOME_Evolution_Calendar_Listener_notifyObjectRemoved (priv->listener, status, &ev); @@ -907,12 +839,9 @@ cal_notify_object_removed (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, } void -cal_notify_objects_received (Cal *cal, GNOME_Evolution_Calendar_CallStatus status, - GList *created, GList *modified, GList *removed) +cal_notify_objects_received (Cal *cal, GNOME_Evolution_Calendar_CallStatus status) { CalPrivate *priv; - EList *queries; - EIterator *iter; CORBA_Environment ev; g_return_if_fail (cal != NULL); @@ -921,25 +850,6 @@ cal_notify_objects_received (Cal *cal, GNOME_Evolution_Calendar_CallStatus statu priv = cal->priv; g_return_if_fail (priv->listener != CORBA_OBJECT_NIL); - queries = cal_backend_get_queries (priv->backend); - iter = e_list_get_iterator (queries); - - while (e_iterator_is_valid (iter)) { - Query *query = QUERY (e_iterator_get (iter)); - - bonobo_object_dup_ref (BONOBO_OBJREF (query), NULL); - - query_notify_objects_added (query, created); - query_notify_objects_modified (query, modified); - query_notify_objects_removed (query, removed); - - bonobo_object_release_unref (BONOBO_OBJREF (query), NULL); - - e_iterator_next (iter); - } - g_object_unref (iter); - g_object_unref (queries); - CORBA_exception_init (&ev); GNOME_Evolution_Calendar_Listener_notifyObjectsReceived (priv->listener, status, &ev); |