aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-client
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2001-06-22 21:08:02 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2001-06-22 21:08:02 +0800
commita7846c7d6d408bf9acdb04353f0b9097745eb277 (patch)
tree9d4d33aea6123e5e203eaa42b371e95312eae363 /calendar/cal-client
parent997e2b35630e4d290ce67b125cd94f118cc83892 (diff)
downloadgsoc2013-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/cal-client')
-rw-r--r--calendar/cal-client/cal-client.c51
-rw-r--r--calendar/cal-client/cal-client.h3
2 files changed, 36 insertions, 18 deletions
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,