From a7846c7d6d408bf9acdb04353f0b9097745eb277 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Fri, 22 Jun 2001 13:08:02 +0000 Subject: changed getFreeBusy method to return a CalObj instead of a sequence 2001-06-22 Rodrigo Moya * idl/evolution-calendar.idl: changed getFreeBusy method to return a CalObj instead of a sequence * cal-client/cal-client.[ch] (cal_client_get_free_busy): changed it to work like the cal_client_get_object function, that is, it does not return anymore a list of UIDs, but a CalClientGetStatus code, and added a new parameter for the caller to get the component back when this function returns (cal_client_open): aggregate WombatClient interface to the CalListener being used * pcs/cal-backend-db.c, pcs/cal-backend-file.c (..get_free_busy): set return value to "char *" as it will be returning a FreeBusy object, and not a list of UIDs * pcs/cal-backend.[ch] (cal_backend_get_free_busy): ditto * pcs/cal.c (cal_construct): queryInterface on the listener to obtain the WombatClient interface svn path=/trunk/; revision=10393 --- calendar/pcs/cal.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'calendar/pcs/cal.c') diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index 3bcc0c1f6b..50a2fe06f6 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -24,6 +24,7 @@ #include #include "cal.h" #include "query.h" +#include "wombat.h" #define PARENT_TYPE BONOBO_X_OBJECT_TYPE @@ -36,6 +37,9 @@ struct _CalPrivate { /* Listener on the client we notify */ GNOME_Evolution_Calendar_Listener listener; + + /* and a reference to the WombatClient interface */ + GNOME_Evolution_WombatClient wombat_client; }; @@ -228,7 +232,7 @@ impl_Cal_get_objects_in_range (PortableServer_Servant servant, } /* Cal::get_free_busy method */ -static GNOME_Evolution_Calendar_CalObjUIDSeq * +static GNOME_Evolution_Calendar_CalObj impl_Cal_get_free_busy (PortableServer_Servant servant, GNOME_Evolution_Calendar_Time_t start, GNOME_Evolution_Calendar_Time_t end, @@ -237,8 +241,7 @@ impl_Cal_get_free_busy (PortableServer_Servant servant, Cal *cal; CalPrivate *priv; time_t t_start, t_end; - GNOME_Evolution_Calendar_CalObjUIDSeq *seq; - GList *uids; + char *calobj; cal = CAL (bonobo_object_from_servant (servant)); priv = cal->priv; @@ -253,12 +256,20 @@ impl_Cal_get_free_busy (PortableServer_Servant servant, return NULL; } - uids = cal_backend_get_free_busy (priv->backend, t_start, t_end); - seq = build_uid_seq (uids); + calobj = cal_backend_get_free_busy (priv->backend, t_start, t_end); + if (calobj) { + CORBA_char *calobj_copy; - cal_obj_uid_list_free (uids); + calobj_copy = CORBA_string_dup (calobj); + g_free (calobj); + return calobj_copy; + } - return seq; + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_GNOME_Evolution_Calendar_Cal_NotFound, + NULL); + + return NULL; } /* Cal::get_alarms_in_range method */ @@ -449,6 +460,16 @@ cal_construct (Cal *cal, return NULL; } + /* obtain the WombatClient interface */ + priv->wombat_client = Bonobo_Unknown_queryInterface ( + priv->listener, + "IDL:GNOME/Evolution/WombatClient:1.0", + &ev); + if (ev._major != CORBA_NO_EXCEPTION) { + g_message ("cal_construct: could not get the WombatClient interface"); + priv->wombat_client = CORBA_OBJECT_NIL; + } + CORBA_exception_free (&ev); priv->backend = backend; -- cgit v1.2.3