aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-04 11:43:48 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-04 11:43:48 +0800
commitc050cb45aa1eb2af7b53451334a4b979b27c5214 (patch)
tree6585e7ce32858b4473776d1d9472e7a977914996
parentbacbb085895ae69e7f443cc39e04b686128a63a3 (diff)
downloadgsoc2013-evolution-c050cb45aa1eb2af7b53451334a4b979b27c5214.tar
gsoc2013-evolution-c050cb45aa1eb2af7b53451334a4b979b27c5214.tar.gz
gsoc2013-evolution-c050cb45aa1eb2af7b53451334a4b979b27c5214.tar.bz2
gsoc2013-evolution-c050cb45aa1eb2af7b53451334a4b979b27c5214.tar.lz
gsoc2013-evolution-c050cb45aa1eb2af7b53451334a4b979b27c5214.tar.xz
gsoc2013-evolution-c050cb45aa1eb2af7b53451334a4b979b27c5214.tar.zst
gsoc2013-evolution-c050cb45aa1eb2af7b53451334a4b979b27c5214.zip
lots more -mig
svn path=/trunk/; revision=105
-rw-r--r--calendar/cal-util/calobj.c35
-rw-r--r--calendar/calendar.c26
-rw-r--r--calendar/calendar.h1
-rw-r--r--calendar/calobj.c35
-rw-r--r--calendar/gui/calendar.c26
-rw-r--r--calendar/gui/calendar.h1
-rw-r--r--calendar/pcs/calobj.c35
7 files changed, 153 insertions, 6 deletions
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c
index 004ba7636d..6dd7fa98db 100644
--- a/calendar/cal-util/calobj.c
+++ b/calendar/cal-util/calobj.c
@@ -250,8 +250,17 @@ ical_object_create_from_vobject (VObject *o, const char *object_name)
return ical;
}
-void
-ical_object_save (iCalObject *ical)
+static char *
+to_str (int num)
+{
+ static char buf [40];
+
+ sprintf (buf, "%d", num);
+ return buf;
+}
+
+VObject *
+ical_object_to_vobject (iCalObject *ical)
{
VObject *o;
@@ -259,5 +268,27 @@ ical_object_save (iCalObject *ical)
o = newVObject (VCEventProp);
else
o = newVObject (VCTodoProp);
+
+ /* uid */
+ if (ical->uid)
+ addPropValue (o, VCUniqueStringProp, ical->uid);
+
+ /* seq */
+ addPropValue (o, VCSequenceProp, to_str (ical->seq));
+
+ /* dtstart */
+ addPropValue (o, VCDTstartProp, isodate_from_time_t (ical->dtstart));
+
+ /* dtend */
+ addPropValue (o, VCDTendProp, isodate_from_time_t (ical->dtend));
+
+ /* dcreated */
+ addPropValue (o, VCDTendProp, isodate_from_time_t (ical->created));
+
+ /* completed */
+ if (ical->completed)
+ addPropValue (o, VCDTendProp, isodate_from_time_t (ical->completed));
+
+ return o;
}
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);
+}
+
diff --git a/calendar/calendar.h b/calendar/calendar.h
index 805076d949..f990caabd6 100644
--- a/calendar/calendar.h
+++ b/calendar/calendar.h
@@ -14,6 +14,7 @@ typedef struct {
time_t created;
int modified;
+ void *temp;
} Calendar;
Calendar *calendar_new (char *title);
diff --git a/calendar/calobj.c b/calendar/calobj.c
index 004ba7636d..6dd7fa98db 100644
--- a/calendar/calobj.c
+++ b/calendar/calobj.c
@@ -250,8 +250,17 @@ ical_object_create_from_vobject (VObject *o, const char *object_name)
return ical;
}
-void
-ical_object_save (iCalObject *ical)
+static char *
+to_str (int num)
+{
+ static char buf [40];
+
+ sprintf (buf, "%d", num);
+ return buf;
+}
+
+VObject *
+ical_object_to_vobject (iCalObject *ical)
{
VObject *o;
@@ -259,5 +268,27 @@ ical_object_save (iCalObject *ical)
o = newVObject (VCEventProp);
else
o = newVObject (VCTodoProp);
+
+ /* uid */
+ if (ical->uid)
+ addPropValue (o, VCUniqueStringProp, ical->uid);
+
+ /* seq */
+ addPropValue (o, VCSequenceProp, to_str (ical->seq));
+
+ /* dtstart */
+ addPropValue (o, VCDTstartProp, isodate_from_time_t (ical->dtstart));
+
+ /* dtend */
+ addPropValue (o, VCDTendProp, isodate_from_time_t (ical->dtend));
+
+ /* dcreated */
+ addPropValue (o, VCDTendProp, isodate_from_time_t (ical->created));
+
+ /* completed */
+ if (ical->completed)
+ addPropValue (o, VCDTendProp, isodate_from_time_t (ical->completed));
+
+ return o;
}
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);
diff --git a/calendar/pcs/calobj.c b/calendar/pcs/calobj.c
index 004ba7636d..6dd7fa98db 100644
--- a/calendar/pcs/calobj.c
+++ b/calendar/pcs/calobj.c
@@ -250,8 +250,17 @@ ical_object_create_from_vobject (VObject *o, const char *object_name)
return ical;
}
-void
-ical_object_save (iCalObject *ical)
+static char *
+to_str (int num)
+{
+ static char buf [40];
+
+ sprintf (buf, "%d", num);
+ return buf;
+}
+
+VObject *
+ical_object_to_vobject (iCalObject *ical)
{
VObject *o;
@@ -259,5 +268,27 @@ ical_object_save (iCalObject *ical)
o = newVObject (VCEventProp);
else
o = newVObject (VCTodoProp);
+
+ /* uid */
+ if (ical->uid)
+ addPropValue (o, VCUniqueStringProp, ical->uid);
+
+ /* seq */
+ addPropValue (o, VCSequenceProp, to_str (ical->seq));
+
+ /* dtstart */
+ addPropValue (o, VCDTstartProp, isodate_from_time_t (ical->dtstart));
+
+ /* dtend */
+ addPropValue (o, VCDTendProp, isodate_from_time_t (ical->dtend));
+
+ /* dcreated */
+ addPropValue (o, VCDTendProp, isodate_from_time_t (ical->created));
+
+ /* completed */
+ if (ical->completed)
+ addPropValue (o, VCDTendProp, isodate_from_time_t (ical->completed));
+
+ return o;
}