1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 /* 3 * Evolution calendar recurrence rule functions 4 * 5 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) 6 * 7 * This library is free software: you can redistribute it and/or modify it 8 * under the terms of the GNU Lesser General Public License as published by 9 * the Free Software Foundation. 10 * 11 * This library is distributed in the hope that it will be useful, but 12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 14 * for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public License 17 * along with this library. If not, see <http://www.gnu.org/licenses/>. 18 * 19 * Authors: Damon Chaplin <damon@ximian.com> 20 */ 21 22 #if !defined (__LIBECAL_H_INSIDE__) && !defined (LIBECAL_COMPILATION) 23 #error "Only <libecal/libecal.h> should be included directly." 24 #endif 25 26 #ifndef E_CAL_RECUR_H 27 #define E_CAL_RECUR_H 28 29 #include <glib.h> 30 #include <gio/gio.h> 31 32 #include <libical-glib/libical-glib.h> 33 34 #include <libecal/e-cal-component.h> 35 #include <libecal/e-cal-enums.h> 36 37 G_BEGIN_DECLS 38 39 /** 40 * E_CAL_EVOLUTION_ENDDATE_PARAMETER: 41 * 42 * The X parameter name being used to store the enddate in RRULE and EXRULE properties. 43 * 44 * Since: 3.34 45 **/ 46 #define E_CAL_EVOLUTION_ENDDATE_PARAMETER "X-EVOLUTION-ENDDATE" 47 48 /** 49 * ECalRecurResolveTimezoneCb: 50 * @tzid: timezone ID to resolve 51 * @user_data: user data used for this callback 52 * @cancellable: optional #GCancellable object, or %NULL 53 * @error: return location for a #GError, or %NULL 54 * 55 * Resolve timezone by its ID provided as @tzid. The returned object, 56 * if not %NULL, is owned by the callback implementation and should 57 * not be freed. 58 * 59 * Returns: (transfer none) (nullable): an #ICalTimezone object for @tzid, 60 * or %NULL, on error or if not found. 61 * 62 * Since: 3.34 63 **/ 64 typedef ICalTimezone * (* ECalRecurResolveTimezoneCb) (const gchar *tzid, 65 gpointer user_data, 66 GCancellable *cancellable, 67 GError **error); 68 69 /** 70 * ECalRecurInstanceCb: 71 * @icomp: an #ICalComponent 72 * @instance_start: start time of an instance 73 * @instance_end: end time of an instance 74 * @user_data: user data used for this callback in e_cal_recur_generate_instances_sync() 75 * @cancellable: optional #GCancellable object, or %NULL 76 * @error: return location for a #GError, or %NULL 77 * 78 * Callback used by e_cal_recur_generate_instances_sync(), called 79 * for each instance of a (recurring) component within given time range. 80 * 81 * Returns: %TRUE, to continue recurrence generation, %FALSE to stop 82 * 83 * Since: 3.34 84 **/ 85 typedef gboolean (* ECalRecurInstanceCb) (ICalComponent *icomp, 86 ICalTime *instance_start, 87 ICalTime *instance_end, 88 gpointer user_data, 89 GCancellable *cancellable, 90 GError **error); 91 92 gboolean e_cal_recur_generate_instances_sync (ICalComponent *icalcomp, 93 ICalTime *interval_start, 94 ICalTime *interval_end, 95 ECalRecurInstanceCb callback, 96 gpointer callback_user_data, 97 ECalRecurResolveTimezoneCb get_tz_callback, 98 gpointer get_tz_callback_user_data, 99 ICalTimezone *default_timezone, 100 GCancellable *cancellable, 101 GError **error); 102 103 time_t e_cal_recur_obtain_enddate (ICalRecurrence *ir, 104 ICalProperty *prop, 105 ICalTimezone *zone, 106 gboolean convert_end_date); 107 108 gboolean e_cal_recur_ensure_end_dates (ECalComponent *comp, 109 gboolean refresh, 110 ECalRecurResolveTimezoneCb tz_cb, 111 gpointer tz_cb_data, 112 GCancellable *cancellable, 113 GError **error); 114 115 const gchar * e_cal_recur_get_localized_nth (gint nth); 116 117 /** 118 * ECalRecurFormatDateTimeFunc: 119 * @itt: an #ICalTime to format to string 120 * @buffer: a buffer to fill with the result 121 * @buffer_size: the @buffer size, in bytes, not counting the NUL-terminator character 122 * 123 * Format the date/time value from @itt into @buffer, whose size cannot 124 * exceed @buffer_size letters. 125 * 126 * Since: 3.38 127 **/ 128 typedef void (* ECalRecurFormatDateTimeFunc) (ICalTime *itt, 129 gchar *buffer, 130 gint buffer_size); 131 132 gchar * e_cal_recur_describe_recurrence_ex (ICalComponent *icalcomp, 133 GDateWeekday week_start_day, 134 guint32 flags, 135 ECalRecurFormatDateTimeFunc datetime_fmt_func); 136 gchar * e_cal_recur_describe_recurrence (ICalComponent *icalcomp, 137 GDateWeekday week_start_day, 138 guint32 flags); /* bit-or of ECalRecurDescribeRecurrenceFlags */ 139 140 G_END_DECLS 141 142 #endif 143