diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2001-06-22 21:08:02 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2001-06-22 21:08:02 +0800 |
commit | a7846c7d6d408bf9acdb04353f0b9097745eb277 (patch) | |
tree | 9d4d33aea6123e5e203eaa42b371e95312eae363 /calendar/pcs | |
parent | 997e2b35630e4d290ce67b125cd94f118cc83892 (diff) | |
download | gsoc2013-evolution-a7846c7d6d408bf9acdb04353f0b9097745eb277.tar gsoc2013-evolution-a7846c7d6d408bf9acdb04353f0b9097745eb277.tar.gz gsoc2013-evolution-a7846c7d6d408bf9acdb04353f0b9097745eb277.tar.bz2 gsoc2013-evolution-a7846c7d6d408bf9acdb04353f0b9097745eb277.tar.lz gsoc2013-evolution-a7846c7d6d408bf9acdb04353f0b9097745eb277.tar.xz gsoc2013-evolution-a7846c7d6d408bf9acdb04353f0b9097745eb277.tar.zst gsoc2013-evolution-a7846c7d6d408bf9acdb04353f0b9097745eb277.zip |
changed getFreeBusy method to return a CalObj instead of a sequence
2001-06-22 Rodrigo Moya <rodrigo@ximian.com>
* 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
Diffstat (limited to 'calendar/pcs')
-rw-r--r-- | calendar/pcs/Makefile.am | 2 | ||||
-rw-r--r-- | calendar/pcs/cal-backend-db.c | 8 | ||||
-rw-r--r-- | calendar/pcs/cal-backend-file.c | 4 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.c | 8 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.h | 4 | ||||
-rw-r--r-- | calendar/pcs/cal.c | 35 |
6 files changed, 41 insertions, 20 deletions
diff --git a/calendar/pcs/Makefile.am b/calendar/pcs/Makefile.am index 227ca53257..9806c13fb3 100644 --- a/calendar/pcs/Makefile.am +++ b/calendar/pcs/Makefile.am @@ -4,6 +4,8 @@ INCLUDES = \ -I$(top_srcdir)/calendar \ -I$(top_srcdir)/libical/src/libical \ -I$(top_builddir)/libical/src/libical \ + -I$(top_srcdir)/libwombat \ + -I$(top_builddir)/libwombat \ $(BONOBO_VFS_GNOME_CFLAGS) \ $(EXTRA_GNOME_CFLAGS) \ -DGNOMELOCALEDIR=\""$(localedir)"\" diff --git a/calendar/pcs/cal-backend-db.c b/calendar/pcs/cal-backend-db.c index 785ba98440..56b9786c0d 100644 --- a/calendar/pcs/cal-backend-db.c +++ b/calendar/pcs/cal-backend-db.c @@ -77,9 +77,9 @@ static GList* cal_backend_db_get_objects_in_range (CalBackend *backend, CalObjType type, time_t start, time_t end); -static GList *cal_backend_db_get_free_busy (CalBackend *backend, - time_t start, - time_t end); +static char *cal_backend_db_get_free_busy (CalBackend *backend, + time_t start, + time_t end); static GNOME_Evolution_Calendar_CalObjChangeSeq *cal_backend_db_get_changes ( CalBackend *backend, CalObjType type, const char *change_id); @@ -939,7 +939,7 @@ cal_backend_db_get_objects_in_range (CalBackend *backend, } /* get_free_busy handler for the DB backend */ -static GList * +static char * cal_backend_db_get_free_busy (CalBackend *backend, time_t start, time_t end) { return NULL; diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c index d8951571f8..80aac2f418 100644 --- a/calendar/pcs/cal-backend-file.c +++ b/calendar/pcs/cal-backend-file.c @@ -77,7 +77,7 @@ static CalObjType cal_backend_file_get_type_by_uid (CalBackend *backend, const c static GList *cal_backend_file_get_uids (CalBackend *backend, CalObjType type); static GList *cal_backend_file_get_objects_in_range (CalBackend *backend, CalObjType type, time_t start, time_t end); -static GList *cal_backend_file_get_free_busy (CalBackend *backend, time_t start, time_t end); +static char *cal_backend_file_get_free_busy (CalBackend *backend, time_t start, time_t end); static GNOME_Evolution_Calendar_CalObjChangeSeq *cal_backend_file_get_changes ( CalBackend *backend, CalObjType type, const char *change_id); @@ -979,7 +979,7 @@ cal_backend_file_get_objects_in_range (CalBackend *backend, CalObjType type, } /* Get_free_busy handler for the file backend */ -static GList * +static char * cal_backend_file_get_free_busy (CalBackend *backend, time_t start, time_t end) { return NULL; diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c index d72a6fe5e6..76438ad51d 100644 --- a/calendar/pcs/cal-backend.c +++ b/calendar/pcs/cal-backend.c @@ -333,13 +333,11 @@ cal_backend_get_objects_in_range (CalBackend *backend, CalObjType type, * @start: Start time for query. * @end: End time for query. * - * Builds a list of unique identifiers corresponding to free/busy calendar - * objects of the that occur or recur within the specified time range. + * Gets a free/busy object for the given time interval * - * Return value: A list of UID strings. The list should be freed using the - * cal_obj_uid_list_free() function. + * Return value: a free/busy object **/ -GList * +char * cal_backend_get_free_busy (CalBackend *backend, time_t start, time_t end) { g_return_val_if_fail (backend != NULL, NULL); diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h index 35cddaa492..44f87e3f34 100644 --- a/calendar/pcs/cal-backend.h +++ b/calendar/pcs/cal-backend.h @@ -88,7 +88,7 @@ struct _CalBackendClass { GList *(* get_objects_in_range) (CalBackend *backend, CalObjType type, time_t start, time_t end); - GList *(* get_free_busy) (CalBackend *backend, time_t start, time_t end); + char *(* get_free_busy) (CalBackend *backend, time_t start, time_t end); /* Change related virtual methods */ GNOME_Evolution_Calendar_CalObjChangeSeq * (* get_changes) ( @@ -126,7 +126,7 @@ GList *cal_backend_get_uids (CalBackend *backend, CalObjType type); GList *cal_backend_get_objects_in_range (CalBackend *backend, CalObjType type, time_t start, time_t end); -GList *cal_backend_get_free_busy (CalBackend *backend, time_t start, time_t end); +char *cal_backend_get_free_busy (CalBackend *backend, time_t start, time_t end); GNOME_Evolution_Calendar_CalObjChangeSeq * cal_backend_get_changes ( CalBackend *backend, CalObjType type, const char *change_id); 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 <ical.h> #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; |