Files
federated-calendar/src/gcal-recurrence.h
T
Yash Singh 27bb337f54 recurrence: Add recurrence struct to parse recurrence-rules
Currently, gnome-calendar has no component to deal
with recurrence-rules of events. This missing component
is however required to create and modify recurring events.

This patch adds the required GcalRecurrence component
which parses the recurrence-rules with details like:

 * Frequency of the recurring event
 * Duration of the recurrences:
	** If they repeat until a particular date
	** If they repeat a fixed number of times
	** If they repeat forever

and then stores these details in a suitable format
in the GcalRecurrence structure. The gcal-recurrence
functions simplify the task of handling and editing
recurrences. This structure is the first step towards
creating a new 'recurrence' property of an event.

https://bugzilla.gnome.org/show_bug.cgi?id=782755
2017-07-04 10:32:48 -03:00

77 lines
2.1 KiB
C

/* -*- mode: c; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* gcal-recurrence.h
* Copyright (C) 2017 Yash Singh <yashdev10p@gmail.com>
*
* gnome-calendar is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* gnome-calendar is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GCAL_RECURRENCE_H
#define GCAL_RECURRENCE_H
#include <glib-object.h>
#include <libecal/libecal.h>
G_BEGIN_DECLS
#define GCAL_TYPE_RECURRENCE (gcal_recurrence_get_type())
typedef struct _GcalRecurrence GcalRecurrence;
typedef enum
{
GCAL_RECURRENCE_NO_REPEAT,
GCAL_RECURRENCE_DAILY,
GCAL_RECURRENCE_MON_FRI,
GCAL_RECURRENCE_WEEKLY,
GCAL_RECURRENCE_MONTHLY,
GCAL_RECURRENCE_YEARLY,
GCAL_RECURRENCE_OTHER
} GcalRecurrenceFrequency;
typedef enum
{
GCAL_RECURRENCE_FOREVER,
GCAL_RECURRENCE_COUNT,
GCAL_RECURRENCE_UNTIL
} GcalRecurrenceLimitType;
struct _GcalRecurrence
{
GcalRecurrenceFrequency frequency;
GcalRecurrenceLimitType limit_type;
struct {
GDateTime *until;
guint count;
} limit;
};
GType gcal_recurrence_get_type (void) G_GNUC_CONST;
GcalRecurrence* gcal_recurrence_new (void);
GcalRecurrence* gcal_recurrence_copy (GcalRecurrence *recur);
void gcal_recurrence_free (GcalRecurrence *recur);
GcalRecurrence* gcal_recurrence_parse_recurrence_rules (ECalComponent *comp);
struct icalrecurrencetype* gcal_recurrence_to_rrule (GcalRecurrence *recur);
G_END_DECLS
#endif /* GCAL_RECURRENCE_H */