From cf16aa4fb112337616d20f4f2f9c2512cbe5e82f Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Thu, 17 Feb 2000 09:21:20 +0000 Subject: Implemented. 2000-02-17 Federico Mena Quintero * cal-client.c (cal_client_remove_object): Implemented. * cal.c (cal_notify_remove): Implemented. (Cal_remove_object): Implemented. (cal_get_epv): Fill in the remove_object field in the epv. * cal-backend.c (cal_backend_remove_object): Implemented. (notify_remove): New function to notify clients that an object was removed. svn path=/trunk/; revision=1821 --- calendar/cal.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'calendar/cal.c') diff --git a/calendar/cal.c b/calendar/cal.c index 158e4c493c..8263bfe491 100644 --- a/calendar/cal.c +++ b/calendar/cal.c @@ -325,6 +325,24 @@ Cal_update_object (PortableServer_Servant servant, NULL); } +/* Cal::remove_object method */ +static void +Cal_remove_object (PortableServer_Servant servant, + const Evolution_Calendar_CalObjUID uid, + CORBA_Environment *ev) +{ + Cal *cal; + CalPrivate *priv; + + cal = CAL (bonobo_object_from_servant (servant)); + priv = cal->priv; + + if (!cal_backend_remove_object (priv->backend, uid)) + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_Evolution_Calendar_Cal_NotFound, + NULL); +} + /** * cal_get_epv: * @void: @@ -344,6 +362,7 @@ cal_get_epv (void) epv->get_uids = Cal_get_uids; epv->get_events_in_range = Cal_get_events_in_range; epv->update_object = Cal_update_object; + epv->remove_object = Cal_remove_object; return epv; } @@ -507,3 +526,34 @@ cal_notify_update (Cal *cal, const char *uid) CORBA_exception_free (&ev); } + +/** + * cal_notify_remove: + * @cal: A calendar client interface. + * @uid: UID of object that was removed. + * + * Notifies a listener attached to a calendar client interface object about a + * calendar object that was removed. + **/ +void +cal_notify_remove (Cal *cal, const char *uid) +{ + CalPrivate *priv; + CORBA_Environment ev; + + g_return_if_fail (cal != NULL); + g_return_if_fail (IS_CAL (cal)); + g_return_if_fail (uid != NULL); + + priv = cal->priv; + g_return_if_fail (priv->listener != CORBA_OBJECT_NIL); + + CORBA_exception_init (&ev); + Evolution_Calendar_Listener_obj_removed (priv->listener, uid, &ev); + + if (ev._major != CORBA_NO_EXCEPTION) + g_message ("cal_notify_remove(): could not notify the listener " + "about a removed object"); + + CORBA_exception_free (&ev); +} -- cgit v1.2.3