From 5e9d81e541449d811574d64c9f0e84e0cf24b536 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Mon, 22 Oct 2001 16:47:54 +0000 Subject: write out the correct time in the control 2001-10-22 JP Rosevear * gui/e-itip-control.c (set_date_label): write out the correct time in the control * pcs/cal.c (build_fb_seq): utility function to build sequences of f/b data (impl_Cal_get_free_busy): use above so we never return a NULL * conduits/calendar/calendar-conduit-config.h (calconduit_save_configuration): fix c/p error (calconduit_load_configuration): ditto svn path=/trunk/; revision=13876 --- calendar/pcs/cal.c | 57 +++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 26 deletions(-) (limited to 'calendar/pcs/cal.c') diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index b5d404bc7a..0d0e8e4a8b 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -241,6 +241,32 @@ impl_Cal_get_objects_in_range (PortableServer_Servant servant, return seq; } +static GNOME_Evolution_Calendar_CalObjSeq * +build_fb_seq (GList *obj_list) +{ + GNOME_Evolution_Calendar_CalObjSeq *seq; + GList *l; + int n, i; + + n = g_list_length (obj_list); + + seq = GNOME_Evolution_Calendar_CalObjSeq__alloc (); + CORBA_sequence_set_release (seq, TRUE); + seq->_length = n; + seq->_buffer = CORBA_sequence_GNOME_Evolution_Calendar_CalObj_allocbuf (n); + + /* Fill the sequence */ + + for (i = 0, l = obj_list; l; i++, l = l->next) { + char *calobj; + + calobj = l->data; + seq->_buffer[i] = CORBA_string_dup (calobj); + } + + return seq; +} + /* Cal::get_free_busy method */ static GNOME_Evolution_Calendar_CalObjSeq * impl_Cal_get_free_busy (PortableServer_Servant servant, @@ -264,7 +290,7 @@ impl_Cal_get_free_busy (PortableServer_Servant servant, if (t_start > t_end || t_start == -1 || t_end == -1) { bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_InvalidRange); - return NULL; + return build_fb_seq (NULL); } /* convert the CORBA user list to a GList */ @@ -277,34 +303,13 @@ impl_Cal_get_free_busy (PortableServer_Servant servant, /* call the backend's get_free_busy method */ obj_list = cal_backend_get_free_busy (priv->backend, users, t_start, t_end); + seq = build_fb_seq (obj_list); g_list_free (users); - if (obj_list) { - GList *l; - gint count; - gint n; - - count = g_list_length (obj_list); - - seq = GNOME_Evolution_Calendar_CalObjSeq__alloc (); - CORBA_sequence_set_release (seq, TRUE); - seq->_length = count; - seq->_buffer = CORBA_sequence_GNOME_Evolution_Calendar_CalObj_allocbuf (count); - for (l = obj_list, n = 0; l; l = l->next, n++) { - gchar *calobj = (gchar *) l->data; - - seq->_buffer[n] = CORBA_string_dup (calobj); - g_free (calobj); - } - - g_list_free (obj_list); - - return seq; - } - - bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_NotFound); + if (obj_list == NULL) + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_NotFound); - return NULL; + return seq; } /* Cal::get_alarms_in_range method */ -- cgit