diff options
author | Federico Mena Quintero <federico@helixcode.com> | 2000-03-28 16:05:08 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2000-03-28 16:05:08 +0800 |
commit | 8f6adf987eabf47bbe8266f6a0f29de1e7ce2e68 (patch) | |
tree | 5d1d1b5f14f7f5f28893bf4f2a3cd14541642b58 /calendar/pcs/cal-backend.c | |
parent | 8b355664ab9cabed3c0dd1ec25dba20a8e2827a9 (diff) | |
download | gsoc2013-evolution-8f6adf987eabf47bbe8266f6a0f29de1e7ce2e68.tar.gz gsoc2013-evolution-8f6adf987eabf47bbe8266f6a0f29de1e7ce2e68.tar.zst gsoc2013-evolution-8f6adf987eabf47bbe8266f6a0f29de1e7ce2e68.zip |
Use ical_object_to_string().
2000-03-27 Federico Mena Quintero <federico@helixcode.com>
* pcs/cal-backend.c (cal_backend_get_object): Use
ical_object_to_string().
* cal-util/calobj.c (ical_object_to_string): Moved over from
pcs/cal-backend.c (was string_from_ical_object).
(get_calendar_base_vobject): Likewise, moved over from
pcs/cal-backend.c.
* cal-util/cal-util.c: Removed string_to_ical_object(); the
correct function is in calobj.[ch], called
ical_object_find_in_string(). Removed ical_object_to_string,
since we now implement it in calobj.c.
* cal-util/calobj.c: Removed ical_object_new_from_string(); see
above.
* idl/evolution-calendar.idl (CalObjInstance): Calendar object
instances now contain only the UID for the object, not the whole
string representation of the object. This allows clients to
implement caching of objects if they wish.
* pcs/cal.c (Cal_get_events_in_range): Likewise.
* pcs/cal-backend.c (build_event_list): Likewise.
* cal-client/cal-client.c (cal_client_get_events_in_range):
Likewise.
* cal-util/cal-util.h (CalObjInstance): Likewise.
* cal-util/cal-util.c (cal_obj_instance_list_free): Likewise.
(cal_obj_uid_list_free): Assert that the UIDs in the list are not
NULL.
* pcs/tlacuache.gnorba (repo_id): The calendar factory also
supports the Unknown interface.
svn path=/trunk/; revision=2211
Diffstat (limited to 'calendar/pcs/cal-backend.c')
-rw-r--r-- | calendar/pcs/cal-backend.c | 74 |
1 files changed, 3 insertions, 71 deletions
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c index 4406fac599..2d8807d08a 100644 --- a/calendar/pcs/cal-backend.c +++ b/calendar/pcs/cal-backend.c @@ -28,11 +28,6 @@ -/* 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 */ @@ -391,59 +386,6 @@ 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; -} - -/* Builds the string representation of a complete calendar object wrapping the - * specified object --- a complete calendar is needed because of the timezone - * information. The return value must be freed with free(), not g_free(), since - * the internal implementation calls writeMemVObject() from libversit, which - * uses realloc() to allocate this string. - */ -static char * -string_from_ical_object (CalBackend *backend, iCalObject *ico) -{ - VObject *vcalobj, *vobj; - char *buf; - - 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; -} - /** @@ -775,7 +717,7 @@ cal_backend_get_object (CalBackend *backend, const char *uid) { CalBackendPrivate *priv; iCalObject *ico; - char *buf, *retval; + char *buf; g_return_val_if_fail (backend != NULL, NULL); g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); @@ -792,17 +734,8 @@ cal_backend_get_object (CalBackend *backend, const char *uid) if (!ico) return NULL; - /* string_from_ical_object() uses writeMemVObject(), which uses - * realloc(), so we must free its result with free() instead of - * g_free(). We take a copy of the result so that callers can use the - * normal glib function to free it. - */ - - buf = string_from_ical_object (backend, ico); - retval = g_strdup (buf); - free (buf); - - return retval; + buf = ical_object_to_string (ico); + return buf; } struct get_uids_closure { @@ -893,7 +826,6 @@ build_event_list (iCalObject *ico, time_t start, time_t end, void *data) g_assert (ico->uid != NULL); icoi->uid = g_strdup (ico->uid); - icoi->calobj = string_from_ical_object (c->backend, ico); icoi->start = start; icoi->end = end; |