From: Chenthill Palanisamy Date: Mon, 11 Jul 2005 00:51:08 +0000 (+0000) Subject: Added a new API for getting a list of attachments for an calendar object X-Git-Tag: upstream/3.7.4~7244 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3d83901f420e9cf041965d58996d8a927f2ab64c;p=platform%2Fupstream%2Fevolution-data-server.git Added a new API for getting a list of attachments for an calendar object --- diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 5d9baf4..29ba3a4 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,33 @@ +2005-07-11 Chenthill Palanisamy + + * idl/Evolution-DataServer-Calendar.idl: Interface for sending a request + for an attachment and notifying the attachment list. + * libecal/e-cal-listener.[ch]: (impl_notifyAttachmentListRequested), + (e_cal_listener_class_init): listens to the backend and Notifies the client. + * libecal/e-cal.[ch]: (cal_attachment_list_cb), (e_cal_init), + (e_cal_get_attachments_for_comp): API to retrieve the attachment + list for a calendar item. + * libedata-cal/e-cal-backend-sync.[ch]: + (e_cal_backend_sync_get_attachment_list), + (_e_cal_backend_get_attachment_list), + (e_cal_backend_sync_class_init): Methods to send request to corresponding + backends and send notifications to the client. + * libedata-cal/e-cal-backend.c: + (e_cal_backend_get_attachment_list): + * libedata-cal/e-cal-backend.h: Calls the sync implemention. + * libedata-cal/e-data-cal.[ch]: (impl_Cal_getAttachmentList), + (e_data_cal_class_init), (e_data_cal_notify_object_list), + (e_data_cal_notify_attachment_list): Implements the request and the + sends notification to the listener. + * backends/file/e-cal-backend-file.c: + (e_cal_backend_file_get_attachment_list), + (e_cal_backend_file_class_init): + * backends/groupwise/e-cal-backend-groupwise.c: + (e_cal_backend_groupwise_get_attachment_list), + (e_cal_backend_groupwise_class_init): Virtual methods to get + the attachment for a calendar object. + + 2005-07-10 Sankar P * libecal/e-cal.c: (open_calendar) diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c index ea468a9..32480bc 100644 --- a/calendar/backends/file/e-cal-backend-file.c +++ b/calendar/backends/file/e-cal-backend-file.c @@ -1261,6 +1261,15 @@ e_cal_backend_file_get_object_list (ECalBackendSync *backend, EDataCal *cal, con return GNOME_Evolution_Calendar_Success; } +/* Gets the list of attachments */ +static ECalBackendSyncStatus +e_cal_backend_file_get_attachment_list (ECalBackendSync *backend, EDataCal *cal, const char *uid, const char *rid, GSList **list) +{ + + /* TODO implement the function */ + return GNOME_Evolution_Calendar_Success; +} + /* get_query handler for the file backend */ static void e_cal_backend_file_start_query (ECalBackend *backend, EDataCalView *query) @@ -2486,6 +2495,7 @@ e_cal_backend_file_class_init (ECalBackendFileClass *class) sync_class->get_default_object_sync = e_cal_backend_file_get_default_object; sync_class->get_object_sync = e_cal_backend_file_get_object; sync_class->get_object_list_sync = e_cal_backend_file_get_object_list; + sync_class->get_attachment_list_sync = e_cal_backend_file_get_attachment_list; sync_class->get_timezone_sync = e_cal_backend_file_get_timezone; sync_class->add_timezone_sync = e_cal_backend_file_add_timezone; sync_class->set_default_timezone_sync = e_cal_backend_file_set_default_timezone; diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise.c b/calendar/backends/groupwise/e-cal-backend-groupwise.c index dd7dcab..520b0f1 100644 --- a/calendar/backends/groupwise/e-cal-backend-groupwise.c +++ b/calendar/backends/groupwise/e-cal-backend-groupwise.c @@ -1337,6 +1337,14 @@ e_cal_backend_groupwise_set_default_timezone (ECalBackendSync *backend, EDataCal return GNOME_Evolution_Calendar_Success; } +/* Gets the list of attachments */ +static ECalBackendSyncStatus +e_cal_backend_groupwise_get_attachment_list (ECalBackendSync *backend, EDataCal *cal, const char *uid, const char *rid, GSList **list) +{ + /* TODO implement the function */ + return GNOME_Evolution_Calendar_Success; +} + /* Get_objects_in_range handler for the groupwise backend */ static ECalBackendSyncStatus e_cal_backend_groupwise_get_object_list (ECalBackendSync *backend, EDataCal *cal, const char *sexp, GList **objects) @@ -2334,6 +2342,7 @@ e_cal_backend_groupwise_class_init (ECalBackendGroupwiseClass *class) sync_class->get_default_object_sync = e_cal_backend_groupwise_get_default_object; sync_class->get_object_sync = e_cal_backend_groupwise_get_object; sync_class->get_object_list_sync = e_cal_backend_groupwise_get_object_list; + sync_class->get_attachment_list_sync = e_cal_backend_groupwise_get_attachment_list; sync_class->get_timezone_sync = e_cal_backend_groupwise_get_timezone; sync_class->add_timezone_sync = e_cal_backend_groupwise_add_timezone; sync_class->set_default_timezone_sync = e_cal_backend_groupwise_set_default_timezone; diff --git a/calendar/idl/Evolution-DataServer-Calendar.idl b/calendar/idl/Evolution-DataServer-Calendar.idl index fa1aeb7..b9fb4e3 100644 --- a/calendar/idl/Evolution-DataServer-Calendar.idl +++ b/calendar/idl/Evolution-DataServer-Calendar.idl @@ -206,6 +206,9 @@ module Calendar { oneway void modifyObject (in CalObj calobj, in CalObjModType mod); oneway void removeObject (in CalObjUID uid, in CalRecurID rid, in CalObjModType mod); + /* get attachment list for an object */ + oneway void getAttachmentList (in CalObjUID uid, in CalRecurID rid); + /* Methods for getting/sending iCalendar VCALENDARS via iTip/iMip */ oneway void receiveObjects (in CalObj calobj); oneway void sendObjects (in CalObj calobj); @@ -253,6 +256,8 @@ module Calendar { oneway void notifyChanges (in CallStatus status, in CalObjChangeSeq changes); oneway void notifyFreeBusy (in CallStatus status, in CalObjSeq freebusy); + oneway void notifyAttachmentListRequested (in CallStatus status, in stringlist attachments); + /* Called from a Calendar when the mode is changed */ oneway void notifyCalSetMode (in SetModeStatus status, in CalMode mode); diff --git a/calendar/libecal/e-cal-listener.c b/calendar/libecal/e-cal-listener.c index 1d11d6a..c0710f7 100644 --- a/calendar/libecal/e-cal-listener.c +++ b/calendar/libecal/e-cal-listener.c @@ -55,6 +55,7 @@ enum { DEFAULT_OBJECT, OBJECT, OBJECT_LIST, + ATTACHMENT_LIST, GET_TIMEZONE, ADD_TIMEZONE, SET_DEFAULT_TIMEZONE, @@ -420,6 +421,33 @@ impl_notifyObjectListRequested (PortableServer_Servant servant, g_list_free (object_list); } +static void +impl_notifyAttachmentListRequested (PortableServer_Servant servant, + const GNOME_Evolution_Calendar_CallStatus status, + const GNOME_Evolution_Calendar_stringlist *attachments, + CORBA_Environment *ev) +{ + ECalListener *listener; + ECalListenerPrivate *priv; + GSList *a_list = NULL; + int i; + + listener = E_CAL_LISTENER (bonobo_object_from_servant (servant)); + priv = listener->priv; + + if (!priv->notify) + return; + + for (i = 0; i < attachments->_length; i++) { + a_list = g_slist_append (a_list, g_strdup (attachments->_buffer[i])); + } + + g_signal_emit (G_OBJECT (listener), signals[ATTACHMENT_LIST], 0, convert_status (status), a_list); + + g_slist_foreach (a_list, (GFunc) g_free, NULL); + g_slist_free (a_list); +} + static void impl_notifyTimezoneRequested (PortableServer_Servant servant, const GNOME_Evolution_Calendar_CallStatus status, @@ -728,6 +756,7 @@ e_cal_listener_class_init (ECalListenerClass *klass) klass->epv.notifyDefaultObjectRequested = impl_notifyDefaultObjectRequested; klass->epv.notifyObjectRequested = impl_notifyObjectRequested; klass->epv.notifyObjectListRequested = impl_notifyObjectListRequested; + klass->epv.notifyAttachmentListRequested = impl_notifyAttachmentListRequested; klass->epv.notifyTimezoneRequested = impl_notifyTimezoneRequested; klass->epv.notifyTimezoneAdded = impl_notifyTimezoneAdded; klass->epv.notifyDefaultTimezoneSet = impl_notifyDefaultTimezoneSet; @@ -866,6 +895,14 @@ e_cal_listener_class_init (ECalListenerClass *klass) G_STRUCT_OFFSET (ECalListenerClass, object_list), NULL, NULL, e_cal_marshal_VOID__INT_POINTER, + G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_POINTER); + signals[ATTACHMENT_LIST] = + g_signal_new ("attachment_list", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ECalListenerClass, attachment_list), + NULL, NULL, + e_cal_marshal_VOID__INT_POINTER, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_POINTER); signals[GET_TIMEZONE] = g_signal_new ("get_timezone", diff --git a/calendar/libecal/e-cal-listener.h b/calendar/libecal/e-cal-listener.h index 7fd599c..e5fdfed 100644 --- a/calendar/libecal/e-cal-listener.h +++ b/calendar/libecal/e-cal-listener.h @@ -73,6 +73,8 @@ typedef struct { void (*object) (ECalListener *listener, ECalendarStatus status, const char *object); void (*object_list) (ECalListener *listener, ECalendarStatus status, GList **objects); + void (*attachment_list) (ECalListener *listener, ECalendarStatus status, GSList **objects); + void (*get_timezone) (ECalListener *listener, ECalendarStatus status, const char *object); void (*add_timezone) (ECalListener *listener, ECalendarStatus status, const char *tzid); void (*set_default_timezone) (ECalListener *listener, ECalendarStatus status, const char *tzid); diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c index aaebc5d..12f4a31 100644 --- a/calendar/libecal/e-cal.c +++ b/calendar/libecal/e-cal.c @@ -53,6 +53,7 @@ typedef struct { char *uid; GList *list; + GSList *slist; gboolean bool; char *string; @@ -750,6 +751,29 @@ cal_object_list_cb (ECalListener *listener, ECalendarStatus status, GList *objec } static void +cal_attachment_list_cb (ECalListener *listener, ECalendarStatus status, GSList *attachments, gpointer data) +{ + ECal *ecal = data; + ECalendarOp *op; + + op = e_calendar_get_op (ecal); + + if (op == NULL) { + g_warning (G_STRLOC ": Cannot find operation "); + return; + } + + g_mutex_lock (op->mutex); + + op->status = status; + op->slist = g_slist_copy (attachments); + + g_cond_signal (op->cond); + + g_mutex_unlock (op->mutex); +} + +static void cal_get_timezone_cb (ECalListener *listener, ECalendarStatus status, const char *object, gpointer data) { ECal *ecal = data; @@ -1092,6 +1116,7 @@ e_cal_init (ECal *ecal, ECalClass *klass) g_signal_connect (G_OBJECT (priv->listener), "default_object", G_CALLBACK (cal_default_object_requested_cb), ecal); g_signal_connect (G_OBJECT (priv->listener), "object", G_CALLBACK (cal_object_requested_cb), ecal); g_signal_connect (G_OBJECT (priv->listener), "object_list", G_CALLBACK (cal_object_list_cb), ecal); + g_signal_connect (G_OBJECT (priv->listener), "attachment_list", G_CALLBACK (cal_attachment_list_cb), ecal); g_signal_connect (G_OBJECT (priv->listener), "get_timezone", G_CALLBACK (cal_get_timezone_cb), ecal); g_signal_connect (G_OBJECT (priv->listener), "add_timezone", G_CALLBACK (cal_add_timezone_cb), ecal); g_signal_connect (G_OBJECT (priv->listener), "set_default_timezone", G_CALLBACK (cal_set_default_timezone_cb), ecal); @@ -2626,6 +2651,83 @@ e_cal_get_default_object (ECal *ecal, icalcomponent **icalcomp, GError **error) } /** + * e_cal_get_attachments_for_comp: + * @ecal: A calendar client. + * @uid: Unique identifier for a calendar component. + * @rid: Recurrence identifier. + * @list: Return the list of attachment uris. + * @error: Placeholder for error information. + * + * Queries a calendar for a calendar component object based on its unique + * identifier and gets the attachments for the component. + * + * Return value: TRUE if the call was successful, FALSE otherwise. + **/ +gboolean +e_cal_get_attachments_for_comp (ECal *ecal, const char *uid, const char *rid, GSList **list, GError **error) +{ + ECalPrivate *priv; + CORBA_Environment ev; + ECalendarStatus status; + ECalendarOp *our_op; + + e_return_error_if_fail (ecal && E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG); + + priv = ecal->priv; + + g_mutex_lock (ecal->priv->mutex); + + if (ecal->priv->load_state != E_CAL_LOAD_LOADED) { + g_mutex_unlock (ecal->priv->mutex); + E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error); + } + + if (ecal->priv->current_op != NULL) { + g_mutex_unlock (ecal->priv->mutex); + E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_BUSY, error); + } + + our_op = e_calendar_new_op (ecal); + + g_mutex_lock (our_op->mutex); + + g_mutex_unlock (ecal->priv->mutex); + + CORBA_exception_init (&ev); + GNOME_Evolution_Calendar_Cal_getAttachmentList (priv->cal, uid, rid ? rid : "", &ev); + if (BONOBO_EX (&ev)) { + e_calendar_remove_op (ecal, our_op); + g_mutex_unlock (our_op->mutex); + e_calendar_free_op (our_op); + + CORBA_exception_free (&ev); + + g_warning (G_STRLOC ": Unable to contact backend"); + + E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error); + } + + CORBA_exception_free (&ev); + + /* wait for something to happen (both cancellation and a + successful response will notity us via our cv */ + g_cond_wait (our_op->cond, our_op->mutex); + + status = our_op->status; + if (status != E_CALENDAR_STATUS_OK){ + *list = NULL; + } else { + *list = our_op->slist; + } + + e_calendar_remove_op (ecal, our_op); + g_mutex_unlock (our_op->mutex); + e_calendar_free_op (our_op); + + E_CALENDAR_CHECK_STATUS (status, error); +} + +/** * e_cal_get_object: * @ecal: A calendar client. * @uid: Unique identifier for a calendar component. diff --git a/calendar/libecal/e-cal.h b/calendar/libecal/e-cal.h index d24e277..7892de4 100644 --- a/calendar/libecal/e-cal.h +++ b/calendar/libecal/e-cal.h @@ -205,6 +205,8 @@ gboolean e_cal_set_default_source (ESource *source, ECalSourceType type, GErr gboolean e_cal_get_sources (ESourceList **sources, ECalSourceType type, GError **error); const char * e_cal_get_local_attachment_store (ECal *ecal); gboolean e_cal_get_recurrences_no_master (ECal *ecal); +gboolean e_cal_get_attachments_for_comp (ECal *ecal, const char *uid, const char *rid, GSList **list, GError **error); + G_END_DECLS #endif diff --git a/calendar/libedata-cal/e-cal-backend-sync.c b/calendar/libedata-cal/e-cal-backend-sync.c index a679abe..b4f85d9 100644 --- a/calendar/libedata-cal/e-cal-backend-sync.c +++ b/calendar/libedata-cal/e-cal-backend-sync.c @@ -447,6 +447,31 @@ e_cal_backend_sync_get_object_list (ECalBackendSync *backend, EDataCal *cal, con } /** + * e_cal_backend_sync_get_attachment_list: + * @backend: An ECalBackendSync object. + * @cal: An EDataCal object. + * @uid: Unique id of the calendar object. + * @rid: Recurrence id of the calendar object. + * @attachments: Placeholder for list of returned attachment uris. + * + * Calls the get_attachment_list method on the given backend. + * + * Return value: Status code. + */ +ECalBackendSyncStatus +e_cal_backend_sync_get_attachment_list (ECalBackendSync *backend, EDataCal *cal, const char *uid, const char *rid, GSList **attachments) +{ + ECalBackendSyncStatus status; + + g_return_val_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError); + g_return_val_if_fail (attachments, GNOME_Evolution_Calendar_OtherError); + + LOCK_WRAPPER (get_attachment_list_sync, (backend, cal, uid, rid, attachments)); + + return status; +} + +/** * e_cal_backend_sync_get_timezone: * @backend: An ECalBackendSync object. * @cal: An EDataCal object. @@ -768,6 +793,20 @@ _e_cal_backend_get_object (ECalBackend *backend, EDataCal *cal, const char *uid, } static void +_e_cal_backend_get_attachment_list (ECalBackend *backend, EDataCal *cal, const char *uid, const char *rid) +{ + ECalBackendSyncStatus status; + GSList *list = NULL; + + status = e_cal_backend_sync_get_attachment_list (E_CAL_BACKEND_SYNC (backend), cal, uid, rid, &list); + + e_data_cal_notify_attachment_list (cal, status, list); + + g_slist_foreach (list, (GFunc) g_free, NULL); + g_free (list); +} + +static void _e_cal_backend_get_object_list (ECalBackend *backend, EDataCal *cal, const char *sexp) { ECalBackendSyncStatus status; @@ -908,6 +947,7 @@ e_cal_backend_sync_class_init (ECalBackendSyncClass *klass) backend_class->get_default_object = _e_cal_backend_get_default_object; backend_class->get_object = _e_cal_backend_get_object; backend_class->get_object_list = _e_cal_backend_get_object_list; + backend_class->get_attachment_list = _e_cal_backend_get_attachment_list; backend_class->get_timezone = _e_cal_backend_get_timezone; backend_class->add_timezone = _e_cal_backend_add_timezone; backend_class->set_default_timezone = _e_cal_backend_set_default_timezone; diff --git a/calendar/libedata-cal/e-cal-backend-sync.h b/calendar/libedata-cal/e-cal-backend-sync.h index a19af13..95326a4 100644 --- a/calendar/libedata-cal/e-cal-backend-sync.h +++ b/calendar/libedata-cal/e-cal-backend-sync.h @@ -56,6 +56,9 @@ struct _ECalBackendSyncClass { ECalBackendSyncStatus (*get_object_sync) (ECalBackendSync *backend, EDataCal *cal, const char *uid, const char *rid, char **object); ECalBackendSyncStatus (*get_object_list_sync) (ECalBackendSync *backend, EDataCal *cal, const char *sexp, GList **objects); + ECalBackendSyncStatus (*get_attachment_list_sync) (ECalBackendSync *backend, EDataCal *cal, const char *uid, const char *rid, GSList **attachments); + + ECalBackendSyncStatus (*get_timezone_sync) (ECalBackendSync *backend, EDataCal *cal, const char *tzid, char **object); ECalBackendSyncStatus (*add_timezone_sync) (ECalBackendSync *backend, EDataCal *cal, const char *tzobj); ECalBackendSyncStatus (*set_default_timezone_sync) (ECalBackendSync *backend, EDataCal *cal, const char *tzid); @@ -115,6 +118,12 @@ ECalBackendSyncStatus e_cal_backend_sync_remove_object (ECalBackendSyn CalObjModType mod, char **old_object, char **object); +ECalBackendSyncStatus e_cal_backend_sync_get_attachment_list (ECalBackendSync *backend, + EDataCal *cal, + const char *uid, + const char *rid, + GSList **attachments); + ECalBackendSyncStatus e_cal_backend_sync_discard_alarm (ECalBackendSync *backend, EDataCal *cal, const char *uid, const char *auid); ECalBackendSyncStatus e_cal_backend_sync_receive_objects (ECalBackendSync *backend, diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c index 4090248..4f3d9ee 100644 --- a/calendar/libedata-cal/e-cal-backend.c +++ b/calendar/libedata-cal/e-cal-backend.c @@ -760,6 +760,27 @@ e_cal_backend_get_object_list (ECalBackend *backend, EDataCal *cal, const char * } /** + * e_cal_backend_get_attachment_list: + * @backend: A calendar backend. + * @cal: An #EDataCal object. + * @uid: Unique identifier for a calendar object. + * @rid: ID for the object's recurrence to get. + * + * Queries a calendar backend for attachments present in a calendar object based + * on its unique identifier and its recurrence ID (if a recurrent appointment). + */ +void +e_cal_backend_get_attachment_list (ECalBackend *backend, EDataCal *cal, const char *uid, const char *rid) +{ + g_return_if_fail (backend != NULL); + g_return_if_fail (E_IS_CAL_BACKEND (backend)); + g_return_if_fail (uid != NULL); + + g_assert (CLASS (backend)->get_object != NULL); + (* CLASS (backend)->get_attachment_list) (backend, cal, uid, rid); +} + +/** * e_cal_backend_get_free_busy: * @backend: A calendar backend. * @cal: An #EDataCal object. diff --git a/calendar/libedata-cal/e-cal-backend.h b/calendar/libedata-cal/e-cal-backend.h index 26f1ce2..1d7df97 100644 --- a/calendar/libedata-cal/e-cal-backend.h +++ b/calendar/libedata-cal/e-cal-backend.h @@ -90,6 +90,8 @@ struct _ECalBackendClass { void (* get_object) (ECalBackend *backend, EDataCal *cal, const char *uid, const char *rid); void (* get_object_list) (ECalBackend *backend, EDataCal *cal, const char *sexp); + void (* get_attachment_list) (ECalBackend *backend, EDataCal *cal, const char *uid, const char *rid); + /* Timezone related virtual methods */ void (* get_timezone) (ECalBackend *backend, EDataCal *cal, const char *tzid); void (* add_timezone) (ECalBackend *backend, EDataCal *cal, const char *object); @@ -143,6 +145,8 @@ void e_cal_backend_get_default_object (ECalBackend *backend, EDataCal *cal); void e_cal_backend_get_object (ECalBackend *backend, EDataCal *cal, const char *uid, const char *rid); void e_cal_backend_get_object_list (ECalBackend *backend, EDataCal *cal, const char *sexp); +void e_cal_backend_get_attachment_list (ECalBackend *backend, EDataCal *cal, const char *uid, const char *rid); + gboolean e_cal_backend_is_loaded (ECalBackend *backend); void e_cal_backend_start_query (ECalBackend *backend, EDataCalView *query); diff --git a/calendar/libedata-cal/e-data-cal.c b/calendar/libedata-cal/e-data-cal.c index db56294..62f2e7a 100644 --- a/calendar/libedata-cal/e-data-cal.c +++ b/calendar/libedata-cal/e-data-cal.c @@ -236,6 +236,22 @@ impl_Cal_getObjectList (PortableServer_Servant servant, e_cal_backend_get_object_list (priv->backend, cal, sexp); } +/* Cal::getAttachmentList method */ +static void +impl_Cal_getAttachmentList (PortableServer_Servant servant, + const CORBA_char *uid, + const CORBA_char *rid, + CORBA_Environment *ev) +{ + EDataCal *cal; + EDataCalPrivate *priv; + + cal = E_DATA_CAL (bonobo_object_from_servant (servant)); + priv = cal->priv; + + e_cal_backend_get_attachment_list (priv->backend, cal, uid, rid); +} + /* Cal::getChanges method */ static void impl_Cal_getChanges (PortableServer_Servant servant, @@ -637,6 +653,7 @@ e_data_cal_class_init (EDataCalClass *klass) epv->addTimezone = impl_Cal_addTimezone; epv->setDefaultTimezone = impl_Cal_setDefaultTimezone; epv->getObjectList = impl_Cal_getObjectList; + epv->getAttachmentList = impl_Cal_getAttachmentList; epv->getChanges = impl_Cal_getChanges; epv->getFreeBusy = impl_Cal_getFreeBusy; epv->discardAlarm = impl_Cal_discardAlarm; @@ -1179,6 +1196,50 @@ e_data_cal_notify_object_list (EDataCal *cal, GNOME_Evolution_Calendar_CallStatu } /** + * e_data_cal_notify_attachment_list: + * @cal: A calendar client interface. + * @status: Status code. + * @attachments: List of retrieved attachment uri's. + * + * Notifies listeners of the completion of the get_attachment_list method call. + */ +void +e_data_cal_notify_attachment_list (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status, GSList *attachments) +{ + EDataCalPrivate *priv; + CORBA_Environment ev; + GNOME_Evolution_Calendar_stringlist seq; + GSList *l; + int i; + + g_return_if_fail (cal != NULL); + g_return_if_fail (E_IS_DATA_CAL (cal)); + + priv = cal->priv; + g_return_if_fail (priv->listener != CORBA_OBJECT_NIL); + + CORBA_exception_init (&ev); + + seq._maximum = g_slist_length (attachments); + seq._length = 0; + seq._buffer = GNOME_Evolution_Calendar_stringlist_allocbuf (seq._maximum); + + for (l = attachments, i = 0; l; l = l->next, i++) { + seq._buffer[i] = CORBA_string_dup (l->data); + seq._length++; + } + + GNOME_Evolution_Calendar_CalListener_notifyAttachmentListRequested (priv->listener, status, &seq, &ev); + + if (BONOBO_EX (&ev)) + g_message (G_STRLOC ": could not notify the listener of object list"); + + CORBA_exception_free (&ev); + + CORBA_free(seq._buffer); +} + +/** * e_data_cal_notify_query: * @cal: A calendar client interface. * @status: Status code. diff --git a/calendar/libedata-cal/e-data-cal.h b/calendar/libedata-cal/e-data-cal.h index 7e7f571..13d8132 100644 --- a/calendar/libedata-cal/e-data-cal.h +++ b/calendar/libedata-cal/e-data-cal.h @@ -119,6 +119,7 @@ void e_data_cal_notify_auth_required (EDataCal *cal); void e_data_cal_notify_error (EDataCal *cal, const char *message); +void e_data_cal_notify_attachment_list (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status, GSList *objects); G_END_DECLS