aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/calendar.c26
-rw-r--r--calendar/gui/calendar.h1
2 files changed, 27 insertions, 0 deletions
diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c
index 482543b84b..efcb157e8b 100644
--- a/calendar/gui/calendar.c
+++ b/calendar/gui/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);
+}
+
diff --git a/calendar/gui/calendar.h b/calendar/gui/calendar.h
index 805076d949..f990caabd6 100644
--- a/calendar/gui/calendar.h
+++ b/calendar/gui/calendar.h
@@ -14,6 +14,7 @@ typedef struct {
time_t created;
int modified;
+ void *temp;
} Calendar;
Calendar *calendar_new (char *title);