From 2687fc18df80e6e6964b90f7d2b593bbb816a04e Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 5 Nov 2007 11:23:57 +0000 Subject: [PATCH] Added new function 'has-start?' as part of fix for bug #359267. This will 2007-11-05 Milan Crha * libedata-cal/e-cal-backend-sexp.c: (func_has_start), (struct symbols): Added new function 'has-start?' as part of fix for bug #359267. This will check if the component has filled start date or not. svn path=/trunk/; revision=8185 --- calendar/ChangeLog | 7 +++++++ calendar/libedata-cal/e-cal-backend-sexp.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 496ae9a..ab55430 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2007-11-05 Milan Crha + + * libedata-cal/e-cal-backend-sexp.c: (func_has_start), + (struct symbols): Added new function 'has-start?' as part + of fix for bug #359267. This will check if the component + has filled start date or not. + 2007-10-23 Chenthill Palanisamy * libecal/e-cal.c diff --git a/calendar/libedata-cal/e-cal-backend-sexp.c b/calendar/libedata-cal/e-cal-backend-sexp.c index ccf1bac..07598e7 100644 --- a/calendar/libedata-cal/e-cal-backend-sexp.c +++ b/calendar/libedata-cal/e-cal-backend-sexp.c @@ -783,6 +783,35 @@ func_contains (ESExp *esexp, int argc, ESExpResult **argv, void *data) return result; } +/* (has-start?) + * + * A boolean value for components that have/don't have filled start date/time. + * + * Returns: a boolean indicating whether the component has start date/time filled or not. + */ +static ESExpResult * +func_has_start (ESExp *esexp, int argc, ESExpResult **argv, void *data) +{ + SearchContext *ctx = data; + ESExpResult *result; + ECalComponentDateTime dt; + + /* Check argument types */ + + if (argc != 0) { + e_sexp_fatal_error (esexp, _("\"%s\" expects no arguments"), + "has-start"); + return NULL; + } + + e_cal_component_get_dtstart (ctx->comp, &dt); + result = e_sexp_result_new (esexp, ESEXP_RES_BOOL); + result->value.bool = dt.value != NULL; + e_cal_component_free_datetime (&dt); + + return result; +} + /* (has-alarms?) * * A boolean value for components that have/dont have alarms. @@ -1231,6 +1260,7 @@ static struct { { "occur-in-time-range?", func_occur_in_time_range, 0 }, { "due-in-time-range?", func_due_in_time_range, 0 }, { "contains?", func_contains, 0 }, + { "has-start?", func_has_start, 0 }, { "has-alarms?", func_has_alarms, 0 }, { "has-alarms-in-range?", func_has_alarms_in_range, 0 }, { "has-recurrences?", func_has_recurrences, 0 }, -- 2.7.4