build: Support libical 4
libical 4 changed several APIs used by GNOME Calendar: - libical-glib now provides autoptr cleanup for ICalTime, so only define it ourselves for older versions. - i_cal_recurrence_get/set_by_day() were removed in favor of the dynamically sized by-rule arrays; add local helpers on top of i_cal_recurrence_get/set_by(). - i_cal_errno_return() was renamed to i_cal_error_icalerrno(). Also make the create-tzid event test independent of line folding, which differs between libical versions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,30 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#if ICAL_MAJOR_VERSION >= 4
|
||||
/* libical 4 replaced the fixed-size by_day array with dynamically sized arrays */
|
||||
static gshort
|
||||
i_cal_recurrence_get_by_day (ICalRecurrence *rrule,
|
||||
guint index)
|
||||
{
|
||||
if (index >= i_cal_recurrence_get_by_array_size (rrule, I_CAL_BY_DAY))
|
||||
return -1;
|
||||
|
||||
return i_cal_recurrence_get_by (rrule, I_CAL_BY_DAY, index);
|
||||
}
|
||||
|
||||
static void
|
||||
i_cal_recurrence_set_by_day (ICalRecurrence *rrule,
|
||||
guint index,
|
||||
gshort value)
|
||||
{
|
||||
if (index >= i_cal_recurrence_get_by_array_size (rrule, I_CAL_BY_DAY))
|
||||
i_cal_recurrence_resize_by_array (rrule, I_CAL_BY_DAY, index + 1);
|
||||
|
||||
i_cal_recurrence_set_by (rrule, I_CAL_BY_DAY, index, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GcalRecurrence, gcal_recurrence, gcal_recurrence_ref, gcal_recurrence_unref)
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user