From 36e5e42d31a56499b1b2534fdf9f6a720b3813e0 Mon Sep 17 00:00:00 2001 From: Eskil Heyn Olsen Date: Wed, 5 Jan 2000 12:12:44 +0000 Subject: Added an argument to the corba get_number_of_objects, so you can decide which status the objects you count should have, eg. any or modified etc. Will add record type someday. svn path=/trunk/; revision=1535 --- calendar/gui/corba-cal.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'calendar/gui/corba-cal.c') diff --git a/calendar/gui/corba-cal.c b/calendar/gui/corba-cal.c index 2a3a727869..74afc0e76a 100644 --- a/calendar/gui/corba-cal.c +++ b/calendar/gui/corba-cal.c @@ -212,10 +212,40 @@ cal_repo_get_objects (PortableServer_Servant servant, static CORBA_long cal_repo_get_number_of_objects (PortableServer_Servant servant, + GNOME_Calendar_Repository_RecordStatus record_status, CORBA_Environment *ev) { GnomeCalendar *gcal = gnomecal_from_servant (servant); - return g_list_length(gcal->cal->events); + CORBA_long res; + GList *l; + iCalPilotState real_record_status; + + if (record_status == GNOME_Calendar_Repository_ANY) { + return g_list_length(gcal->cal->events); + } + + switch (record_status) { + case GNOME_Calendar_Repository_NEW: + real_record_status = ICAL_PILOT_SYNC_MOD; + break; + case GNOME_Calendar_Repository_MODIFIED: + real_record_status = ICAL_PILOT_SYNC_MOD; + break; + case GNOME_Calendar_Repository_DELETED: + real_record_status = ICAL_PILOT_SYNC_DEL; + break; + } + + res = 0; + + for (l = gcal->cal->events; l; l = l->next){ + iCalObject *obj = l->data; + + if (obj->pilot_status == real_record_status) + res ++; + } + + return res; } static GNOME_Calendar_Repository_String_Sequence* -- cgit