aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog22
-rw-r--r--calendar/cal-client/cal-client.c51
-rw-r--r--calendar/cal-client/cal-client.h3
-rw-r--r--calendar/idl/evolution-calendar.idl2
-rw-r--r--calendar/pcs/Makefile.am2
-rw-r--r--calendar/pcs/cal-backend-db.c8
-rw-r--r--calendar/pcs/cal-backend-file.c4
-rw-r--r--calendar/pcs/cal-backend.c8
-rw-r--r--calendar/pcs/cal-backend.h4
-rw-r--r--calendar/pcs/cal.c35
10 files changed, 100 insertions, 39 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 989a227541..a018ee1e08 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,25 @@
+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
+
2001-06-21 JP Rosevear <jpr@ximian.com>
* gui/main.c (main): update to new call
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index f9e7fa3512..9e5461ea8e 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -463,7 +463,7 @@ client_forget_password_cb (WombatClient *w_client,
CalClient *client;
client = CAL_CLIENT (user_data);
- g_return_val_if_fail (IS_CAL_CLIENT (client), NULL);
+ g_return_if_fail (IS_CAL_CLIENT (client));
gtk_signal_emit (GTK_OBJECT (client),
cal_client_signals [FORGET_PASSWORD],
@@ -566,8 +566,8 @@ cal_client_new (void)
void
cal_client_set_auth_func (CalClient *client, CalClientAuthFunc func, gpointer data)
{
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
+ g_return_if_fail (client != NULL);
+ g_return_if_fail (IS_CAL_CLIENT (client));
client->priv->auth_func = func;
client->priv->auth_user_data = data;
@@ -613,6 +613,9 @@ cal_client_open_calendar (CalClient *client, const char *str_uri, gboolean only_
return FALSE;
}
+ bonobo_object_add_interface (BONOBO_OBJECT (priv->listener),
+ BONOBO_OBJECT (priv->w_client));
+
corba_listener = (GNOME_Evolution_Calendar_Listener) bonobo_object_corba_objref (
BONOBO_OBJECT (priv->listener));
@@ -1018,37 +1021,51 @@ cal_client_get_objects_in_range (CalClient *client, CalObjType type, time_t star
*
* Gets free/busy information from the calendar server
*/
-GList *
-cal_client_get_free_busy (CalClient *client, time_t start, time_t end)
+CalClientGetStatus
+cal_client_get_free_busy (CalClient *client, time_t start, time_t end, CalComponent **comp)
{
CalClientPrivate *priv;
CORBA_Environment ev;
- GNOME_Evolution_Calendar_CalObjUIDSeq *seq;
- GList *uids;
+ CORBA_char *calobj;
+ icalcomponent *icalcomp;
- g_return_val_if_fail (client != NULL, NULL);
- g_return_val_if_fail (IS_CAL_CLIENT (client), NULL);
+ g_return_val_if_fail (client != NULL, CAL_CLIENT_GET_NOT_FOUND);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_GET_NOT_FOUND);
priv = client->priv;
- g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, NULL);
+ g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, CAL_CLIENT_GET_NOT_FOUND);
- g_return_val_if_fail (start != -1 && end != -1, NULL);
- g_return_val_if_fail (start <= end, NULL);
+ g_return_val_if_fail (start != -1 && end != -1, CAL_CLIENT_GET_NOT_FOUND);
+ g_return_val_if_fail (start <= end, CAL_CLIENT_GET_NOT_FOUND);
+ g_return_val_if_fail (comp != NULL, CAL_CLIENT_GET_NOT_FOUND);
+
+ *comp = NULL;
CORBA_exception_init (&ev);
- seq = GNOME_Evolution_Calendar_Cal_getFreeBusy (priv->cal, start, end, &ev);
+ calobj = GNOME_Evolution_Calendar_Cal_getFreeBusy (priv->cal, start, end, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_message ("cal_client_get_free_busy(): could not get the objects");
CORBA_exception_free (&ev);
- return NULL;
+ return CAL_CLIENT_GET_NOT_FOUND;
}
CORBA_exception_free (&ev);
- uids = build_uid_list (seq);
- CORBA_free (seq);
+ icalcomp = icalparser_parse_string (calobj);
+ CORBA_free (calobj);
+ if (!icalcomp) {
+ return CAL_CLIENT_GET_SYNTAX_ERROR;
+ }
- return uids;
+ *comp = cal_component_new ();
+ if (!cal_component_set_icalcomponent (*comp, icalcomp)) {
+ icalcomponent_free (icalcomp);
+ gtk_object_unref (GTK_OBJECT (*comp));
+ *comp = NULL;
+ return CAL_CLIENT_GET_SYNTAX_ERROR;
+ }
+
+ return CAL_CLIENT_GET_SUCCESS;
}
/* Callback used when an object is updated and we must update the copy we have */
diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h
index 07acc0d232..de06b14eb9 100644
--- a/calendar/cal-client/cal-client.h
+++ b/calendar/cal-client/cal-client.h
@@ -116,7 +116,8 @@ GList *cal_client_get_changes (CalClient *client, CalObjType type, const char *c
GList *cal_client_get_objects_in_range (CalClient *client, CalObjType type,
time_t start, time_t end);
-GList *cal_client_get_free_busy (CalClient *client, time_t start, time_t end);
+CalClientGetStatus cal_client_get_free_busy (CalClient *client, time_t start, time_t end,
+ CalComponent **comp);
void cal_client_generate_instances (CalClient *client, CalObjType type,
time_t start, time_t end,
diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl
index d14decca04..1016cf2af3 100644
--- a/calendar/idl/evolution-calendar.idl
+++ b/calendar/idl/evolution-calendar.idl
@@ -141,7 +141,7 @@ module Calendar {
raises (InvalidRange);
/* Returns free/busy objects for the given interval */
- CalObjUIDSeq getFreeBusy (in Time_t start, in Time_t end);
+ CalObj getFreeBusy (in Time_t start, in Time_t end);
/* Gets the alarms for the specified component that trigger in
* the specified time range.
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;