aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-backend.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-02-04 12:42:34 +0800
committerArturo Espinosa <unammx@src.gnome.org>2000-02-04 12:42:34 +0800
commit5d56cdb0b37b4b8919df92ff35daf06934666061 (patch)
tree1721fac57d85fd8247b966d8ab7de312ca04aebe /calendar/cal-backend.c
parentd5c007ca4f4f12e354e3aae8b13706fb9e358599 (diff)
downloadgsoc2013-evolution-5d56cdb0b37b4b8919df92ff35daf06934666061.tar
gsoc2013-evolution-5d56cdb0b37b4b8919df92ff35daf06934666061.tar.gz
gsoc2013-evolution-5d56cdb0b37b4b8919df92ff35daf06934666061.tar.bz2
gsoc2013-evolution-5d56cdb0b37b4b8919df92ff35daf06934666061.tar.lz
gsoc2013-evolution-5d56cdb0b37b4b8919df92ff35daf06934666061.tar.xz
gsoc2013-evolution-5d56cdb0b37b4b8919df92ff35daf06934666061.tar.zst
gsoc2013-evolution-5d56cdb0b37b4b8919df92ff35daf06934666061.zip
New function to create the base VObject for a calendar.
2000-02-04 Federico Mena Quintero <federico@helixcode.com> * cal-backend.c (get_calendar_base_vobject): New function to create the base VObject for a calendar. (cal_backend_get_object): Create the base calendar and add the sought object to it, then stringify it. * evolution-calendar.idl (Listener::obj_added Listener::obj_changed): Now these pass in just the UIDs, not the complete objects. * cal-listener.c (Listener_obj_added): Changed to pass in the uid, not the object. (Listener_obj_changed): Likewise. * cal-client.h (CalClientClass): Made the obj_added and obj_changed signals take in the UIDs, not the full objects. * cal-client.c (obj_added_cb): Likewise. (obj_changed_cb): Likewise. svn path=/trunk/; revision=1666
Diffstat (limited to 'calendar/cal-backend.c')
-rw-r--r--calendar/cal-backend.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/calendar/cal-backend.c b/calendar/cal-backend.c
index ffbbdab472..72315e3882 100644
--- a/calendar/cal-backend.c
+++ b/calendar/cal-backend.c
@@ -26,6 +26,11 @@
+/* VCalendar product ID */
+#define PRODID "-//Helix Code//NONSGML Tlacuache//EN"
+
+
+
/* Private part of the CalBackend structure */
typedef struct {
/* URI where the calendar data is stored */
@@ -265,6 +270,35 @@ load_from_vobject (CalBackend *backend, VObject *vobject)
}
}
+/* Creates a VObject with the base information of a calendar */
+static VObject *
+get_calendar_base_vobject (CalBackend *backend)
+{
+ VObject *vobj;
+ time_t now;
+ struct tm tm;
+
+ /* We call localtime for the side effect of setting tzname */
+
+ now = time (NULL);
+ tm = *localtime (&now);
+
+ vobj = newVObject (VCCalProp);
+
+ addPropValue (vobj, VCProdIdProp, PRODID);
+
+#if defined (HAVE_TM_ZONE)
+ addPropValue (vobj, VCTimeZoneProp, tm.tm_zone);
+#elif defined (HAVE_TZNAME)
+ addPropValue (vobj, VCTimeZoneProp, tzname[0]);
+#endif
+
+ /* Per the vCalendar spec, this must be "1.0" */
+ addPropValue (vobj, VCVersionProp, "1.0");
+
+ return vobj;
+}
+
/**
@@ -433,6 +467,7 @@ cal_backend_get_object (CalBackend *backend, const char *uid)
{
CalBackendPrivate *priv;
iCalObject *ico;
+ VObject *vcalobj, *vobj;
char *buf;
g_return_val_if_fail (backend != NULL, NULL);
@@ -450,5 +485,14 @@ cal_backend_get_object (CalBackend *backend, const char *uid)
if (!ico)
return NULL;
- /* FIXME */
+ vcalobj = get_calendar_base_vobject (backend);
+ vobj = ical_object_to_vobject (ico);
+ addVObjectProp (vcalobj, vobj);
+
+ buf = writeMemVObject (NULL, NULL, vcalobj);
+
+ cleanVObject (vcalobj);
+ cleanStrTbl ();
+
+ return buf;
}