aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-client/cal-client.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-06-09 15:04:09 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-06-09 15:04:09 +0800
commit943862dd20ad79007900192fec5c705e9748542a (patch)
tree01330a057de763ae84f14e8ce004928d835012f1 /calendar/cal-client/cal-client.c
parent95ebc1fc92ebe028654b8842bc9d7e5174a0090e (diff)
downloadgsoc2013-evolution-943862dd20ad79007900192fec5c705e9748542a.tar
gsoc2013-evolution-943862dd20ad79007900192fec5c705e9748542a.tar.gz
gsoc2013-evolution-943862dd20ad79007900192fec5c705e9748542a.tar.bz2
gsoc2013-evolution-943862dd20ad79007900192fec5c705e9748542a.tar.lz
gsoc2013-evolution-943862dd20ad79007900192fec5c705e9748542a.tar.xz
gsoc2013-evolution-943862dd20ad79007900192fec5c705e9748542a.tar.zst
gsoc2013-evolution-943862dd20ad79007900192fec5c705e9748542a.zip
Added a get_n_objects() method.
2000-06-09 Federico Mena Quintero <federico@helixcode.com> * idl/evolution-calendar.idl (Cal): Added a get_n_objects() method. * pcs/cal-backend.c (cal_backend_get_n_objects): New function. * pcs/cal-backend-imc.c (cal_backend_imc_get_n_objects): Implemented. * pcs/cal.c (Cal_get_n_objects): Implemented. * cal-client/cal-client.c (cal_client_get_uids): Free the ev. (cal_client_get_n_objects): Implemented. * cal-util/calobj.h (iCalObjectField): New enumeration to identify the fields in an iCalObject. svn path=/trunk/; revision=3486
Diffstat (limited to 'calendar/cal-client/cal-client.c')
-rw-r--r--calendar/cal-client/cal-client.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index 23ab9bc003..921e2dac59 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -551,6 +551,42 @@ cal_client_create_calendar (CalClient *client, const char *str_uri)
return load_or_create (client, str_uri, FALSE);
}
+int
+cal_client_get_n_objects (CalClient *client, CalObjType type)
+{
+ CalClientPrivate *priv;
+ CORBA_Environment ev;
+ int n;
+ int t;
+
+ g_return_val_if_fail (client != NULL, -1);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), -1);
+
+ priv = client->priv;
+ g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, -1);
+
+ 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);
+ n = Evolution_Calendar_Cal_get_n_objects (priv->cal, t, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_message ("cal_client_get_n_objects(): could not get the number of objects");
+ CORBA_exception_free (&ev);
+ return -1;
+ }
+
+ CORBA_exception_free (&ev);
+ return n;
+}
+
/**
* cal_client_get_object:
* @client: A calendar client.
@@ -562,9 +598,8 @@ cal_client_create_calendar (CalClient *client, const char *str_uri)
* sought object, or NULL if no object had the specified UID. A complete
* calendar is returned because you also need the timezone data.
**/
-CalClientGetStatus cal_client_get_object (CalClient *client,
- const char *uid,
- iCalObject **ico)
+CalClientGetStatus
+cal_client_get_object (CalClient *client, const char *uid, iCalObject **ico)
{
CalClientPrivate *priv;
CORBA_Environment ev;
@@ -677,6 +712,8 @@ cal_client_get_uids (CalClient *client, CalObjType type)
return NULL;
}
+ CORBA_exception_free (&ev);
+
/* Create the list */
uids = NULL;