evolution-data-server r9028 - in trunk: . calendar/backends/file calendar/libecal
- From: pohly svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r9028 - in trunk: . calendar/backends/file calendar/libecal
- Date: Sun, 22 Jun 2008 13:12:20 +0000 (UTC)
Author: pohly
Date: Sun Jun 22 13:12:20 2008
New Revision: 9028
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9028&view=rev
Log:
bug #52890: improved time zone support - merged 9022:9026 from gnome-2-22 branch
Added:
trunk/calendar/libecal/e-cal-check-timezones.c
- copied unchanged from r9026, /branches/gnome-2-22/calendar/libecal/e-cal-check-timezones.c
trunk/calendar/libecal/e-cal-check-timezones.h
- copied unchanged from r9026, /branches/gnome-2-22/calendar/libecal/e-cal-check-timezones.h
Modified:
trunk/ChangeLog
trunk/calendar/backends/file/e-cal-backend-file.c
trunk/calendar/libecal/Makefile.am
trunk/calendar/libecal/e-cal.c
trunk/configure.in
Modified: trunk/calendar/backends/file/e-cal-backend-file.c
==============================================================================
--- trunk/calendar/backends/file/e-cal-backend-file.c (original)
+++ trunk/calendar/backends/file/e-cal-backend-file.c Sun Jun 22 13:12:20 2008
@@ -38,6 +38,7 @@
#include <libecal/e-cal-recur.h>
#include <libecal/e-cal-time-util.h>
#include <libecal/e-cal-util.h>
+#include <libecal/e-cal-check-timezones.h>
#include <libedata-cal/e-cal-backend-util.h>
#include <libedata-cal/e-cal-backend-sexp.h>
#include "e-cal-backend-file-events.h"
@@ -2626,6 +2627,27 @@
g_list_free (del_comps);
+ /* check and patch timezones */
+ {
+ GError *error = NULL;
+ if (!e_cal_check_timezones(toplevel_comp,
+ NULL,
+ e_cal_tzlookup_icomp,
+ priv->icalcomp,
+ &error)) {
+ /*
+ * This makes assumptions about what kind of
+ * errors can occur inside e_cal_check_timezones().
+ * We control it, so that should be safe, but
+ * is the code really identical with the calendar
+ * status?
+ */
+ status = error->code;
+ g_clear_error(&error);
+ goto error;
+ }
+ }
+
/* Merge the iCalendar components with our existing VCALENDAR,
resolving any conflicting TZIDs. */
icalcomponent_merge_component (priv->icalcomp, toplevel_comp);
Modified: trunk/calendar/libecal/Makefile.am
==============================================================================
--- trunk/calendar/libecal/Makefile.am (original)
+++ trunk/calendar/libecal/Makefile.am Sun Jun 22 13:12:20 2008
@@ -48,6 +48,7 @@
e-cal-listener.h \
e-cal-recur.c \
e-cal-time-util.c \
+ e-cal-check-timezones.c \
e-cal-util.c \
e-cal-view.c \
e-cal-view-listener.c \
@@ -71,6 +72,7 @@
e-cal-component.h \
e-cal-recur.h \
e-cal-time-util.h \
+ e-cal-check-timezones.h \
e-cal-types.h \
e-cal-util.h \
e-cal-view.h
Modified: trunk/calendar/libecal/e-cal.c
==============================================================================
--- trunk/calendar/libecal/e-cal.c (original)
+++ trunk/calendar/libecal/e-cal.c Sun Jun 22 13:12:20 2008
@@ -31,6 +31,7 @@
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-main.h>
+#include "libecal/e-cal-check-timezones.h"
#include "libedataserver/e-component-listener.h"
#include "libedataserver/e-flag.h"
#include "libedataserver/e-url.h"
@@ -4634,9 +4635,10 @@
{
ECalPrivate *priv;
CORBA_Environment ev;
- ECalendarStatus status;
+ ECalendarStatus status = E_CALENDAR_STATUS_OK;
ECalendarOp *our_op;
icalcomponent *icalcomp;
+ const char *systzid;
e_return_error_if_fail (ecal && E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
e_return_error_if_fail (zone, E_CALENDAR_STATUS_INVALID_ARG);
@@ -4687,34 +4689,74 @@
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OK, error);
}
- /* call the backend */
- CORBA_exception_init (&ev);
+ /*
+ * Try to replace the original time zone with a more complete
+ * and/or potentially updated system time zone. Note that this
+ * also applies to TZIDs which match system time zones exactly:
+ * they are extracted via icaltimezone_get_builtin_timezone_from_tzid()
+ * below without a roundtrip to the backend.
+ */
+ systzid = e_cal_match_tzid (tzid);
+ if (!systzid) {
+ /* call the backend */
+ CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Cal_getTimezone (priv->cal, tzid, &ev);
- if (BONOBO_EX (&ev)) {
- e_calendar_remove_op (ecal, our_op);
- e_calendar_free_op (our_op);
+ GNOME_Evolution_Calendar_Cal_getTimezone (priv->cal, tzid, &ev);
+ if (BONOBO_EX (&ev)) {
+ e_calendar_remove_op (ecal, our_op);
+ e_calendar_free_op (our_op);
- CORBA_exception_free (&ev);
+ CORBA_exception_free (&ev);
- g_warning (G_STRLOC ": Unable to contact backend");
+ g_warning (G_STRLOC ": Unable to contact backend");
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
- }
+ E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
+ }
- CORBA_exception_free (&ev);
+ CORBA_exception_free (&ev);
- e_flag_wait (our_op->done);
+ e_flag_wait (our_op->done);
- status = our_op->status;
- if (status != E_CALENDAR_STATUS_OK){
- icalcomp = NULL;
- } else {
- icalcomp = icalparser_parse_string (our_op->string);
- if (!icalcomp)
+ status = our_op->status;
+ if (status != E_CALENDAR_STATUS_OK){
+ icalcomp = NULL;
+ } else {
+ icalcomp = icalparser_parse_string (our_op->string);
+ if (!icalcomp)
+ status = E_CALENDAR_STATUS_INVALID_OBJECT;
+ }
+ g_free (our_op->string);
+ } else {
+ /*
+ * Use built-in time zone *and* rename it:
+ * if the caller is asking for a TZID=FOO,
+ * then likely because it has an event with
+ * such a TZID. Returning a different TZID
+ * would lead to broken VCALENDARs in the
+ * caller.
+ */
+ icaltimezone *syszone = icaltimezone_get_builtin_timezone_from_tzid (systzid);
+ g_assert (syszone);
+ if (syszone) {
+ gboolean found = FALSE;
+ icalproperty *prop;
+
+ icalcomp = icalcomponent_new_clone (icaltimezone_get_component (syszone));
+ prop = icalcomponent_get_first_property(icalcomp,
+ ICAL_ANY_PROPERTY);
+ while (!found && prop) {
+ if (icalproperty_isa(prop) == ICAL_TZID_PROPERTY) {
+ icalproperty_set_value_from_string(prop, tzid, "NO");
+ found = TRUE;
+ }
+ prop = icalcomponent_get_next_property(icalcomp,
+ ICAL_ANY_PROPERTY);
+ }
+ g_assert (found);
+ } else {
status = E_CALENDAR_STATUS_INVALID_OBJECT;
+ }
}
- g_free (our_op->string);
if (!icalcomp) {
e_calendar_remove_op (ecal, our_op);
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Sun Jun 22 13:12:20 2008
@@ -59,9 +59,9 @@
LIBEDATASERVERUI_REVISION=0
LIBEDATASERVERUI_AGE=1
-LIBECAL_CURRENT=8
+LIBECAL_CURRENT=9
LIBECAL_REVISION=1
-LIBECAL_AGE=1
+LIBECAL_AGE=2
LIBEDATACAL_CURRENT=6
LIBEDATACAL_REVISION=2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]