Introduce the new calendar monitoring API

It is, as expected, heavily inspired by the ECalDataModel code,
except it uses GDateTime, is timezone aware, and can handle all
day events correctly.
This commit is contained in:
Georges Basile Stavracas Neto
2020-04-01 21:06:51 -03:00
parent 94413c26b1
commit 3692a0ccf6
10 changed files with 2118 additions and 0 deletions
+21
View File
@@ -1829,3 +1829,24 @@ gcal_event_format_date (GcalEvent *self)
return g_steal_pointer (&formatted_string);
}
gboolean
gcal_event_is_within_range (GcalEvent *self,
GDateTime *range_start,
GDateTime *range_end)
{
GDateTime *event_start;
GDateTime *event_end;
event_start = gcal_event_get_date_start (self);
event_end = gcal_event_get_date_end (self);
if (gcal_event_get_all_day (self))
{
return gcal_date_time_compare_date (range_end, event_start) < 0 &&
gcal_date_time_compare_date (range_start, event_end) > 0;
}
return g_date_time_compare (range_end, event_start) > 0 &&
g_date_time_compare (event_end, range_start) > 0;
}