diff options
Diffstat (limited to 'calendar/calendar.c')
-rw-r--r-- | calendar/calendar.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/calendar/calendar.c b/calendar/calendar.c index 482543b84b..efcb157e8b 100644 --- a/calendar/calendar.c +++ b/calendar/calendar.c @@ -200,3 +200,29 @@ calendar_load (Calendar *cal, char *fname) calendar_load_from_vobject (cal, vcal); cleanVObject (vcal); } + +void +calendar_save (Calendar *cal, char *fname) +{ + VObject *vcal; + GList *l; + + if (fname == NULL) + fname = cal->filename; + + vcal = newVObject (VCCalProp); + addPropValue (vcal, VCProdIdProp, "-//GNOME//NONSGML GnomeCalendar//EN"); + addPropValue (vcal, VCTimeZoneProp, "NONE"); + addPropValue (vcal, VCVersionProp, VERSION); + cal->temp = vcal; + + for (l = cal->events; l; l = l->next){ + VObject *obj; + + obj = ical_object_to_vobject ((iCalObject *) l->data); + addVObjectProp (vcal, obj); + } + writeVObjectToFile (fname, vcal); + cleanVObject (vcal); +} + |