aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/calendar.c
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@nuclecu.unam.mx>1998-04-02 15:57:58 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-02 15:57:58 +0800
commitf865d886f5aae9279d44f726a0b8093316a40e09 (patch)
treef397fa0ffb407d2ae4c15c61335bac25cb68d2a0 /calendar/gui/calendar.c
parent33b0ab0d0f19c405445315446fd584748538a1ed (diff)
downloadgsoc2013-evolution-f865d886f5aae9279d44f726a0b8093316a40e09.tar
gsoc2013-evolution-f865d886f5aae9279d44f726a0b8093316a40e09.tar.gz
gsoc2013-evolution-f865d886f5aae9279d44f726a0b8093316a40e09.tar.bz2
gsoc2013-evolution-f865d886f5aae9279d44f726a0b8093316a40e09.tar.lz
gsoc2013-evolution-f865d886f5aae9279d44f726a0b8093316a40e09.tar.xz
gsoc2013-evolution-f865d886f5aae9279d44f726a0b8093316a40e09.tar.zst
gsoc2013-evolution-f865d886f5aae9279d44f726a0b8093316a40e09.zip
New main program that uses our new datatypes and objects.
1998-04-02 Miguel de Icaza <miguel@nuclecu.unam.mx> * main.c: New main program that uses our new datatypes and objects. * calendar.c (calendar_load_from_vobject, calendar_load): Implement loading of vCalendar objects and vCalendar files. * calobj.c (ical_object_create_from_vobject): Implement loading of vCalendar event and todo objects. * timeutil.c (isodate_from_time_t): New function. * gnome-cal.c, gnome-cal.h: Implement a toplevel widget, derived from GnomeApp. It holds all of the day views and arbitrates the display. svn path=/trunk/; revision=93
Diffstat (limited to 'calendar/gui/calendar.c')
-rw-r--r--calendar/gui/calendar.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c
index e077279461..5d7cb1dd8a 100644
--- a/calendar/gui/calendar.c
+++ b/calendar/gui/calendar.c
@@ -13,6 +13,7 @@
*/
#include "calendar.h"
+#include "versit/vcc.h"
Calendar *
calendar_new (char *title)
@@ -28,6 +29,7 @@ calendar_new (char *title)
void
calendar_add_object (Calendar *cal, iCalObject *obj)
{
+ printf ("Adding object\n");
switch (obj->type){
case ICAL_EVENT:
cal->events = g_list_prepend (cal->events, obj);
@@ -133,3 +135,56 @@ calendar_compare_by_dtstart (gpointer a, gpointer b)
return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
}
+
+#define str_val(obj) (char *) vObjectUStringZValue (obj)
+
+/* Loads our calendar contents from a vObject */
+void
+calendar_load_from_vobject (Calendar *cal, VObject *vcal)
+{
+ VObjectIterator i;;
+
+ initPropIterator (&i, vcal);
+
+ while (moreIteration (&i)){
+ VObject *this = nextVObject (&i);
+ iCalObject *ical;
+ const char *object_name = vObjectName (this);
+
+ if (strcmp (object_name, VCDCreatedProp) == 0){
+ cal->created = time_from_isodate (str_val (this));
+ continue;
+ }
+
+ if (strcmp (object_name, VCLocationProp) == 0)
+ continue; /* FIXME: imlement */
+
+ if (strcmp (object_name, VCProdIdProp) == 0)
+ continue; /* FIXME: implement */
+
+ if (strcmp (object_name, VCVersionProp) == 0)
+ continue; /* FIXME: implement */
+
+ ical = ical_object_create_from_vobject (this, object_name);
+
+ if (ical)
+ calendar_add_object (cal, ical);
+ }
+}
+
+/* Loads a calendar from a file */
+void
+calendar_load (Calendar *cal, char *fname)
+{
+ VObject *vcal;
+
+ if (cal->filename){
+ g_warning ("Calendar load called again\n");
+ return;
+ }
+
+ cal->filename = g_strdup (fname);
+ vcal = Parse_MIME_FromFileName (fname);
+ calendar_load_from_vobject (cal, vcal);
+ cleanVObject (vcal);
+}