diff options
author | Federico Mena Quintero <federico@helixcode.com> | 2000-02-09 16:04:33 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 2000-02-09 16:04:33 +0800 |
commit | ca082de77aec8542e913e1ce374dd849f51a4a27 (patch) | |
tree | ffa7b8d394a4096fecb664174c70c97eca400b3b /calendar/cal-client/cal-client.c | |
parent | 66dc424c9c809c775e1491299bb2a8c97715865f (diff) | |
download | gsoc2013-evolution-ca082de77aec8542e913e1ce374dd849f51a4a27.tar.gz gsoc2013-evolution-ca082de77aec8542e913e1ce374dd849f51a4a27.tar.zst gsoc2013-evolution-ca082de77aec8542e913e1ce374dd849f51a4a27.zip |
Added get_uids() method to get a list of UIDs based on object types.
2000-02-08 Federico Mena Quintero <federico@helixcode.com>
* evolution-calendar.idl (Cal): Added get_uids() method to get a
list of UIDs based on object types.
* cal-backend.c (cal_backend_get_uids): Implemented get_uids() in
the backend.
* cal.c (Cal_get_uids): Implemented get_uids() method.
* cal-client.c (cal_client_get_uids): Implemented client-side
function.
* cal-util.c (cal_obj_instance_list_free): Doh. Free the list,
not the last link.
(cal_obj_uid_list_free): New function to free a list of UIDs.
* GnomeCal.idl (Repository): Removed unused method
get_object_by_id_list(). This is just for cleanup purposes and to
remind me exactly of what needs to be moved over to
evolution-calendar.idl.
(Repository): Removed unused get_objects() method.
* corba-cal.c (init_calendar_repo_class): Removed the unused
get_objects method.
* calobj.h (CalObjFindStatus): New status value enumeration for
the find function.
* calobj.c (ical_object_find_in_string): New function to parse a
complete calendar and find a calendar object in it. This should
be used instead ical_object_new_from_string() in the future.
* evolution-calendar.idl (CalObjInstance): Added an uid field.
Now the idea is that whenever calendar object strings are passed
around, their UIDs are passed along with them so that the actual
object can be pulled from the whole VCAL object using its UID to
identify it.
* cal-util.h (CalObjInstance): Added uid field.
* cal-util.c (cal_obj_instance_list_free): Free the UIDs.
* cal-backend.c (build_event_list): Store the object's UID in the
instance structure.
* cal.c (Cal_get_events_in_range): Copy the UID field to the CORBA
structure.
* cal-client.c (cal_client_get_events_in_range): Copy the UID
field from the CORBA structure.
* main.c (gnome_cal_file_menu): Removed unfinished html-month stuff.
* Makefile.am (gnomecal_SOURCES): Removed html-month.c.
* gnome-cal.c: #include "alarm.h"
(mail_notify): Made static.
* alarm.h: #include "calobj.h"
* corba-cal-factory.h (init_corba_server): Fixed prototype.
* quick-view.c (create_items_for_event): Made static.
* gncal-todo.c (column_resized): Made static.
* layout.c (find_index): Made static.
svn path=/trunk/; revision=1699
Diffstat (limited to 'calendar/cal-client/cal-client.c')
-rw-r--r-- | calendar/cal-client/cal-client.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index af8b83db34..3e0659357d 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -473,6 +473,60 @@ cal_client_get_object (CalClient *client, const char *uid) } GList * +cal_client_get_uids (CalClient *client, CalObjType type) +{ + CalClientPrivate *priv; + CORBA_Environment ev; + Evolution_Calendar_CalObjUIDSeq *seq; + int t; + GList *uids; + int i; + + g_return_val_if_fail (client != NULL, NULL); + g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); + + priv = client->priv; + g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, NULL); + + t = (((type & CALOBJ_TYPE_EVENT) ? Evolution_Calendar_TYPE_EVENT : 0) + | ((type & CALOBJ_TYPE_TODO) ? Evolution_Calendar_TYPE_TODO : 0) + | ((type & CALOBJ_TYPE_JOURNAL) ? Evolution_Calendar_TYPE_JOURNAL : 0) + | ((type & CALOBJ_TYPE_OTHER) ? Evolution_Calendar_TYPE_OTHER : 0) + | ((type & CALOBJ_TYPE_ANY) ? Evolution_Calendar_TYPE_ANY : 0)); + + CORBA_exception_init (&ev); + + seq = Evolution_Calendar_Cal_get_uids (priv->cal, t, &ev); + if (ev._major != CORBA_NO_EXCEPTION) { + g_message ("cal_client_get_uids(): could not get the list of UIDs"); + CORBA_exception_free (&ev); + return NULL; + } + + /* Create the list */ + + uids = NULL; + + for (i = 0; i < seq->_length; i++) + uids = g_list_prepend (uids, g_strdup (seq->_buffer[i])); + + CORBA_free (seq); + + return uids; +} + +/** + * cal_client_get_events_in_range: + * @client: A calendar client. + * @start: Start time for query. + * @end: End time for query. + * + * Queries a calendar for the events that occur or recur in the specified range + * of time. + * + * Return value: A list of #CalObjInstance structures. + **/ +GList * cal_client_get_events_in_range (CalClient *client, time_t start, time_t end) { CalClientPrivate *priv; @@ -513,6 +567,7 @@ cal_client_get_events_in_range (CalClient *client, time_t start, time_t end) corba_icoi = &seq->_buffer[i]; icoi = g_new (CalObjInstance, 1); + icoi->uid = g_strdup (corba_icoi->uid); icoi->calobj = g_strdup (corba_icoi->calobj); icoi->start = corba_icoi->start; icoi->end = corba_icoi->end; |