aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-client/cal-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/cal-client/cal-client.c')
-rw-r--r--calendar/cal-client/cal-client.c137
1 files changed, 120 insertions, 17 deletions
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index c7f5302d14..2e83345d27 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -654,6 +654,34 @@ cal_client_get_uids (CalClient *client, CalObjType type)
return uids;
}
+/* Builds a GList of CalObjInstance structures from the CORBA sequence */
+static GList *
+build_object_instance_list (Evolution_Calendar_CalObjInstanceSeq *seq)
+{
+ GList *list;
+ int i;
+
+ /* Create the list in reverse order */
+
+ list = NULL;
+ for (i = 0; i < seq->_length; i++) {
+ Evolution_Calendar_CalObjInstance *corba_icoi;
+ CalObjInstance *icoi;
+
+ corba_icoi = &seq->_buffer[i];
+ icoi = g_new (CalObjInstance, 1);
+
+ icoi->uid = g_strdup (corba_icoi->uid);
+ icoi->start = corba_icoi->start;
+ icoi->end = corba_icoi->end;
+
+ list = g_list_prepend (list, icoi);
+ }
+
+ list = g_list_reverse (list);
+ return list;
+}
+
/**
* cal_client_get_events_in_range:
* @client: A calendar client.
@@ -671,22 +699,18 @@ cal_client_get_events_in_range (CalClient *client, time_t start, time_t end)
CalClientPrivate *priv;
CORBA_Environment ev;
Evolution_Calendar_CalObjInstanceSeq *seq;
- GList *elist;
- int i;
+ GList *events;
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);*/
if (priv->load_state != LOAD_STATE_LOADED)
return NULL;
g_return_val_if_fail (start != -1 && end != -1, NULL);
g_return_val_if_fail (start <= end, NULL);
- priv = client->priv;
-
CORBA_exception_init (&ev);
seq = Evolution_Calendar_Cal_get_events_in_range (priv->cal, start, end, &ev);
@@ -697,28 +721,107 @@ cal_client_get_events_in_range (CalClient *client, time_t start, time_t end)
}
CORBA_exception_free (&ev);
- /* Create the list in reverse order */
+ events = build_object_instance_list (seq);
+ CORBA_free (seq);
+
+ return events;
+}
+
+/* Translates the CORBA representation of an AlarmType */
+static enum AlarmType
+uncorba_alarm_type (Evolution_Calendar_AlarmType corba_type)
+{
+ switch (corba_type) {
+ case Evolution_Calendar_MAIL:
+ return ALARM_MAIL;
+
+ case Evolution_Calendar_PROGRAM:
+ return ALARM_PROGRAM;
+
+ case Evolution_Calendar_DISPLAY:
+ return ALARM_DISPLAY;
+
+ case Evolution_Calendar_AUDIO:
+ return ALARM_AUDIO;
+
+ default:
+ g_assert_not_reached ();
+ return ALARM_DISPLAY;
+ }
+}
+
+/* Builds a GList of CalAlarmInstance structures from the CORBA sequence */
+static GList *
+build_alarm_instance_list (Evolution_Calendar_CalAlarmInstanceSeq *seq)
+{
+ GList *list;
+ int i;
- elist = NULL;
+ /* Create the list in reverse order */
+ list = NULL;
for (i = 0; i < seq->_length; i++) {
- Evolution_Calendar_CalObjInstance *corba_icoi;
- CalObjInstance *icoi;
+ Evolution_Calendar_CalAlarmInstance *corba_ai;
+ CalAlarmInstance *ai;
- corba_icoi = &seq->_buffer[i];
- icoi = g_new (CalObjInstance, 1);
+ corba_ai = &seq->_buffer[i];
+ ai = g_new (CalAlarmInstance, 1);
- icoi->uid = g_strdup (corba_icoi->uid);
- icoi->start = corba_icoi->start;
- icoi->end = corba_icoi->end;
+ ai->uid = g_strdup (corba_ai->uid);
+ ai->type = uncorba_alarm_type (corba_ai->type);
+ ai->trigger = corba_ai->trigger;
+ ai->occur = corba_ai->occur;
- elist = g_list_prepend (elist, icoi);
+ list = g_list_prepend (list, ai);
}
+ list = g_list_reverse (list);
+ return list;
+}
+
+/**
+ * cal_client_get_alarms_in_range:
+ * @client: A calendar client.
+ * @start: Start time for query.
+ * @end: End time for query.
+ *
+ * Queries a calendar for the alarms that trigger in the specified range of
+ * time.
+ *
+ * Return value: A list of #CalAlarmInstance structures.
+ **/
+GList *
+cal_client_get_alarms_in_range (CalClient *client, time_t start, time_t end)
+{
+ CalClientPrivate *priv;
+ CORBA_Environment ev;
+ Evolution_Calendar_CalAlarmInstanceSeq *seq;
+ GList *alarms;
+
+ g_return_val_if_fail (client != NULL, NULL);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), NULL);
+
+ priv = client->priv;
+ if (priv->load_state != LOAD_STATE_LOADED)
+ return NULL;
+
+ g_return_val_if_fail (start != -1 && end != -1, NULL);
+ g_return_val_if_fail (start <= end, NULL);
+
+ CORBA_exception_init (&ev);
+
+ seq = Evolution_Calendar_Cal_get_alarms_in_range (priv->cal, start, end, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_message ("cal_client_get_alarms_in_range(): could not get the alarm range");
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+ CORBA_exception_free (&ev);
+
+ alarms = build_alarm_instance_list (seq);
CORBA_free (seq);
- elist = g_list_reverse (elist);
- return elist;
+ return alarms;
}
/**
p;id=2ae4346ea06443a52ceec6ee53122ba62d88c628'>- Moved to a better categorydanilo2014-02-165-0/+67 * Stage supportantoine2014-02-161-56/+55 * - Remove gmake complete builds fine without everywhere.miwi2014-02-152-2/+0 * - Reassign lioux' ports to the heaptabthorpe2014-02-151-1/+1 * - Remove now useless bmake/fmake checkmiwi2014-02-152-9/+2 * Eliminate inclusion of bsd.port.options.mk where PORT_OPTIONS is not tested forehaupt2014-02-131-2/+0 * Now that this port is staged and DOCS defined we can stop testing for DOCS inehaupt2014-02-131-6/+0 * - Drop support for VTE 0.26olivierd2014-02-131-2/+0 * According to the Porter's Handbook (5.12.2.3.) default options must be added toehaupt2014-02-1012-0/+25 * Back to the futurbapt2014-02-103-3/+3 * Mark as deprecated unmaintained ports for which no public distfiles arebapt2014-02-103-0/+9 * Patch ltconfig a bit like USES=libtool does for configure files, so thatantoine2014-02-102-5/+14 * Fix `make package' after r339339.rakuco2014-02-081-2/+2 * Unbreak after OPTIONS helpers conversion, idesk things that you want toantoine2014-02-081-1/+1 * Don't force Gcc when MOUSEWHEEL is disabled.thierry2014-02-081-1/+2 * Chase boost and icu bumpbapt2014-02-071-1/+1 * Support stagebapt2014-02-072-20/+18 * Support staging.ehaupt2014-02-072-2/+1 * - Update to 1.2.5olivierd2014-02-062-3/+3 * x11/dgs: Add dports patches for dragonfly supportmarino2014-02-062-0/+31 * x11/innerspace: Regen patch with DragonFly supportmarino2014-02-061-3/+3 * x11/terminal.app: Regen patch with DragonFly supportmarino2014-02-061-3/+21 * - Update to 0.11.2swills2014-02-053-8/+8 * - Add dependency for textproc/p5-XML-Parsernemysis2014-02-051-0/+2 * Fix SIMD check, and only check MACHINE_CPU if it is defined.kwm2014-02-051-1/+3 * - Stage supportmiwi2014-02-032-2/+0 * - Deprecate and set expiration date to 2014-03-03: Needs an old (pre 7.2) XFr...ak2014-02-031-0/+3 * - Update to 1.2.4olivierd2014-02-034-71/+26 * - Stage supportmiwi2014-02-031-5/+3 * Replace KDE4 sharedmime with USES=shared-mime-info. KDE4 sharedmime ismakc2014-02-011-2/+2 * - Update to 1.09, No functional changes just cleans up compiler warningsnemysis2014-02-012-3/+3 * OSVERSION cannot be tested without a bsd.port.*.mk included beforebapt2014-02-011-0/+2 * - Stagifyrene2014-02-014-14/+55 * - Update to version 3.17pawel2014-01-313-31/+11 * - support stagingjgh2014-01-313-24/+19 * Finish stage supportantoine2014-01-312-1/+3 * - Update to version 0.6 [1]pawel2014-01-303-37/+50 * Fix gobject-introspectionolivierd2014-01-301-2/+1 * - Support STAGEDIRolivierd2014-01-297-25/+23 * Update maintainer email addressrodrigo2014-01-291-1/+1 * - Fix Python and Lua versionsolivierd2014-01-291-6/+5 * Stage supportantoine2014-01-281-2/+3 * - Update to 1.1.6madpilot2014-01-272-7/+9 * - Implement staging.stephen2014-01-272-2/+1 * - Update to 0.11.1swills2014-01-264-36/+118 * Update to 1.8.6eadler2014-01-242-3/+3 * Reintroduce the GNOME knob (disabled by default) to avoid pulling in undesiredehaupt2014-01-231-11/+14 * Use USES=dos2unix instead of manualy 's|^M||g' [1]kwm2014-01-231-30/+28 * Fix properties on pkg-plistbapt2014-01-228-8/+0 * Over to new volunteer.linimon2014-01-211-1/+1 * Update to 301ehaupt2014-01-202-3/+3 * Fix package list. This got accidentally introduced by a reversed patch.ehaupt2014-01-201-2/+0 * Simplify desktop-file-utils usage.ehaupt2014-01-202-3/+4 * Update to 3.3.2.nobutaka2014-01-193-4/+4 * Remove entry from plist which are automatically added by USES=desktop-file-utilsbapt2014-01-181-2/+0 * Update to 2.8.1skreuzer2014-01-182-3/+3 * Support staging.rakuco2014-01-181-7/+5 * Fix LUIT_BUILD_DEPENDS.ehaupt2014-01-171-1/+1 * Use new dependency macros based on options.ehaupt2014-01-171-43/+12 * Reduce over inclusion of bsd.port.mkbapt2014-01-171-3/+1 * Python cleanup:rene2014-01-1410-10/+10 * archivers/xz is in base for all versions and has been removed from the ports ...bapt2014-01-132-8/+0 * Support stagedir.vanilla2014-01-1141-156/+206 * Support stagedir.vanilla2014-01-1030-103/+73 * - Stagify lang/ghc and all the Haskell Cabal portspgj2014-01-103-4/+1 * - Fix a run-time problem with lang/ghc on FreeBSD 10.0 and later, caused bypgj2014-01-103-3/+3 * Update to 1.31bapt2014-01-096-78/+11 * Support stagedir.vanilla2014-01-0926-204/+150 * - Convert to USES=tkgahr2014-01-093-8/+27 * Revert very bad stagification I did waiting for the maintainer to provide abapt2014-01-091-7/+10 * - Update to 1.0.1olivierd2014-01-095-8/+40 * - Chase x11-toolkits/xforms shlib bumpgahr2014-01-083-5/+5 * support stagebapt2014-01-071-2/+1 * Support stagebapt2014-01-071-27/+11 * Support stagebapt2014-01-071-4/+3 * Support stagebapt2014-01-071-9/+7 * Support stagebapt2014-01-071-24/+11 * Support stagebapt2014-01-072-19/+12 * Support stagebapt2014-01-071-16/+9 * - Update to 1.3.1 (bugfix release)olivierd2014-01-072-3/+3 * In preparation for Qt 5 ports:makc2014-01-078-151/+13 * Revert the change about xv as the port expect graphics/xv, not libXvbapt2014-01-061-1/+2 * update to 2.8bapt2014-01-065-85/+4 * Support stagebapt2014-01-062-16/+7 * Support stagebapt2014-01-061-3/+5 * Support stagebapt2014-01-062-12/+9 * Support stagebapt2014-01-061-7/+6 * Support stagebapt2014-01-061-46/+18 * Support stagebapt2014-01-062-12/+6 * Support stagebapt2014-01-061-5/+3 * Support stagebapt2014-01-062-6/+3 * - Stage supportantoine2014-01-051-7/+7 * Stage supportantoine2014-01-051-2/+0 * Stage supportantoine2014-01-051-5/+3 * Stage supportantoine2014-01-051-5/+3 * Stage supportantoine2014-01-051-1/+0 * - Stage supportantoine2014-01-051-1/+0 * Stage supportantoine2014-01-051-4/+3 * - Stage supportantoine2014-01-051-3/+1 * Stage supportantoine2014-01-051-5/+2 * - Stage supportantoine2014-01-051-6/+7 * - Stage supportantoine2014-01-051-3/+4 * - Stage supportantoine2014-01-051-2/+1 * - Stage supportantoine2014-01-051-10/+11 * Stage supportantoine2014-01-051-7/+5 * - Stage supportantoine2014-01-051-7/+8 * Stage supportantoine2014-01-051-1/+0 * Convert the tree to USES=famantoine2014-01-053-6/+3 * - Stage supportantoine2014-01-041-8/+7 * - Stage supportantoine2014-01-041-10/+10 * Part 2 at removing now useless FETCH_ARGS redifitionbapt2014-01-032-2/+0 * - Enable all port options by default [1]lme2013-12-312-42/+41 * Add DOCS and EXAMPLES options.tijl2013-12-301-1/+1 * - Update to 1.3.0olivierd2013-12-304-8/+10 * Stage supportantoine2013-12-291-5/+3 * Stage supportantoine2013-12-291-2/+1 * Stage supportantoine2013-12-291-2/+1 * Stage supportantoine2013-12-291-1/+0 * - unbreak when built with GTK2 option enabledjgh2013-12-291-1/+2 * Stage supportantoine2013-12-281-1/+0 * Stage supportantoine2013-12-282-7/+3 * Stage supportantoine2013-12-281-1/+0 * Stage supportantoine2013-12-281-4/+1 * Update poppler to 0.24.4.kwm2013-12-281-1/+2 * - Update to 0.6.3 (bugfix release)olivierd2013-12-274-11/+20 * Update to version 331.20.danfe2013-12-263-6/+28 * In sight of upcoming update, do some cleaning: convert to Uses=kmod and thendanfe2013-12-262-17/+15 * - Fix build on 10.xamdmi32013-12-253-14/+27 * - Improve DEPENDS [1]swills2013-12-225-19/+60 * - Update to 0.10.10swills2013-12-215-421/+627 * - Fix build with clangpawel2013-12-216-12/+90 * Fix build with clangpawel2013-12-213-17/+21 * - update to 5.43 [1]jgh2013-12-213-19/+10 * Fix build with clangpawel2013-12-212-1/+14 * - Fix build with clangpawel2013-12-202-9/+62 * Update to 5.26zeising2013-12-185-66/+241 * - Support stagingamdmi32013-12-172-4/+2 * readd libXp as dependency. This got lost in the update.zeising2013-12-161-0/+1 * Readd missing portrevision.zeising2013-12-161-0/+1 * Switch FreeBSD CURRENT to use the new xorg stack (WITH_NEW_XORG=) [0]zeising2013-12-16177-727/+1056 * Set support for 256 colors on by default.thierry2013-12-161-1/+2 * Use setuptools for all Python ports.wg2013-12-163-15/+8 * Support stagebapt2013-12-151-14/+7 * Support stagebapt2013-12-141-2/+1 * Support stage and packaging as userbapt2013-12-141-1/+1 * Support stagebapt2013-12-141-3/+2 * Support stagebapt2013-12-141-5/+4 * Support stagebapt2013-12-141-11/+5 * Support stagebapt2013-12-141-3/+2 * Support stagebapt2013-12-141-4/+2 * Support stagebapt2013-12-142-5/+3 * Support stagebapt2013-12-141-4/+2 * Support stagebapt2013-12-142-2/+1 * Support stagebapt2013-12-142-4/+2 * Support stagebapt2013-12-141-3/+2 * Support stagebapt2013-12-141-1/+0 * Support stagebapt2013-12-142-6/+4 * Support stagebapt2013-12-142-4/+3 * Support stagebapt2013-12-141-5/+4 * Support stagebapt2013-12-141-4/+1 * Support stagebapt2013-12-141-4/+2 * Support stagebapt2013-12-141-3/+2 * Support stagebapt2013-12-141-9/+4 * Support stagebapt2013-12-141-5/+4 * Support stagebapt2013-12-141-6/+5 * Support stagebapt2013-12-142-7/+3 * Support stagebapt2013-12-141-3/+2 * Convert LIB_DEPENDS for ports depending on boostbapt2013-12-121-14/+14 * - Chase r336083 and bump all ports using NO_ARCH so that users buildingbdrewery2013-12-111-0/+1 * - Stage support for all -reference portsantoine2013-12-103-3/+0 * - Update from 0.25.0 to 0.25.1danilo2013-12-072-3/+3 * - Use recently implemented NO_ARCH knob in my architecture-neutral portsak2013-12-061-1/+3 * - Update from 0.24.1 to 0.25.0danilo2013-12-052-3/+3 * Update to 300ehaupt2013-12-042-3/+3 * Add libXp to xorg-libraries.tijl2013-12-041-0/+2 * - Update to 1.2.2olivierd2013-12-042-3/+3 * Update to 1.6.2.kwm2013-12-032-5/+5 * Enable xkb support. [1]kwm2013-12-033-2045/+2049 * - Add LICENSEsunpoet2013-12-021-8/+6 * - Remove OPTIONS_DEFAULTnemysis2013-12-012-6/+6 * - Update to 0.5.1nemysis2013-12-012-6/+5 * - Change maintainer email to @FreeBSD.orgnemysis2013-12-011-10/+4 * Update to 298ehaupt2013-11-282-3/+3 * x11/roxterm: fix build on currentwg2013-11-272-32/+27 * - Update from 0.24.0 to 0.24.1danilo2013-11-252-9/+5 * Say hello to Mate 1.6.kwm2013-11-23