[evolution-mapi] Bug #602945 - Avoid code duplication with timezone fetching from backends
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-mapi] Bug #602945 - Avoid code duplication with timezone fetching from backends
- Date: Mon, 30 Nov 2009 18:39:17 +0000 (UTC)
commit 3f488a41b269cbd06a20c1e5bea5e1afed57bfaa
Author: Milan Crha <mcrha redhat com>
Date: Mon Nov 30 19:38:24 2009 +0100
Bug #602945 - Avoid code duplication with timezone fetching from backends
configure.ac | 4 +-
src/calendar/e-cal-backend-mapi.c | 51 +++----------------------
src/libexchangemapi/exchange-mapi-cal-utils.c | 16 +++++---
src/libexchangemapi/exchange-mapi-cal-utils.h | 3 -
4 files changed, 18 insertions(+), 56 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2f48d74..ac5bbd2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,8 +23,8 @@ EDS_PACKAGE=1.2
dnl *******************
dnl Required Packages
dnl *******************
-m4_define([eds_minimum_version], [2.29.1])
-m4_define([evo_minimum_version], [2.29.1])
+m4_define([eds_minimum_version], [2.29.4])
+m4_define([evo_minimum_version], [2.29.4])
m4_define([libmapi_minimum_version], [0.8])
dnl ***********************************
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index 8f01282..c37f553 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -1977,42 +1977,6 @@ e_cal_backend_mapi_receive_objects (ECalBackendSync *backend, EDataCal *cal, con
return status;
}
-
-static ECalBackendSyncStatus
-e_cal_backend_mapi_get_timezone (ECalBackendSync *backend, EDataCal *cal, const char *tzid, char **object)
-{
- ECalBackendMAPI *cbmapi;
- ECalBackendMAPIPrivate *priv;
-
- icaltimezone *zone;
- icalcomponent *icalcomp;
-
- cbmapi = E_CAL_BACKEND_MAPI (backend);
- priv = cbmapi->priv;
-
- g_return_val_if_fail (tzid != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
-
- if (!strcmp (tzid, "UTC")) {
- zone = icaltimezone_get_utc_timezone ();
- } else {
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
-
- if (!zone && g_str_has_prefix (tzid, OLD_TZID_PREFIX))
- zone = icaltimezone_get_builtin_timezone (tzid + strlen (OLD_TZID_PREFIX));
-
- if (!zone)
- return GNOME_Evolution_Calendar_ObjectNotFound;
- }
-
- icalcomp = icaltimezone_get_component (zone);
- if (!icalcomp)
- return GNOME_Evolution_Calendar_InvalidObject;
-
- *object = icalcomponent_as_ical_string_r (icalcomp);
-
- return GNOME_Evolution_Calendar_Success;
-}
-
static ECalBackendSyncStatus
e_cal_backend_mapi_add_timezone (ECalBackendSync *backend, EDataCal *cal, const char *tzobj)
{
@@ -2316,22 +2280,20 @@ e_cal_backend_mapi_internal_get_default_timezone (ECalBackend *backend)
static icaltimezone *
e_cal_backend_mapi_internal_get_timezone (ECalBackend *backend, const char *tzid)
{
+ ECalBackendMAPI *cbmapi;
icaltimezone *zone;
- g_return_val_if_fail (tzid != NULL, NULL);
- g_return_val_if_fail (backend != NULL, NULL);
+ cbmapi = E_CAL_BACKEND_MAPI (backend);
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+ g_return_val_if_fail (cbmapi != NULL, NULL);
+ g_return_val_if_fail (cbmapi->priv != NULL, NULL);
+ g_return_val_if_fail (tzid != NULL, NULL);
- if (!zone && g_str_has_prefix (tzid, OLD_TZID_PREFIX))
- zone = icaltimezone_get_builtin_timezone (tzid + strlen (OLD_TZID_PREFIX));
+ zone = (icaltimezone *) e_cal_backend_cache_get_timezone (cbmapi->priv->cache, tzid);
if (!zone && E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone)
zone = E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone (backend, tzid);
- if (!zone)
- return icaltimezone_get_utc_timezone ();
-
return zone;
}
@@ -2370,7 +2332,6 @@ e_cal_backend_mapi_class_init (ECalBackendMAPIClass *class)
sync_class->discard_alarm_sync = e_cal_backend_mapi_discard_alarm;
sync_class->receive_objects_sync = e_cal_backend_mapi_receive_objects;
sync_class->send_objects_sync = e_cal_backend_mapi_send_objects;
- sync_class->get_timezone_sync = e_cal_backend_mapi_get_timezone;
sync_class->add_timezone_sync = e_cal_backend_mapi_add_timezone;
sync_class->set_default_zone_sync = e_cal_backend_mapi_set_default_zone;
sync_class->get_freebusy_sync = e_cal_backend_mapi_get_free_busy;
diff --git a/src/libexchangemapi/exchange-mapi-cal-utils.c b/src/libexchangemapi/exchange-mapi-cal-utils.c
index 2146b15..9464703 100644
--- a/src/libexchangemapi/exchange-mapi-cal-utils.c
+++ b/src/libexchangemapi/exchange-mapi-cal-utils.c
@@ -1571,16 +1571,20 @@ get_tzid_location (const gchar *tzid, struct cbdata *cbdata)
if (!tzid || !*tzid || g_str_equal (tzid, "UTC"))
return NULL;
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+ /* ask backend first, if any */
+ if (cbdata && cbdata->get_timezone)
+ zone = cbdata->get_timezone (cbdata->get_tz_data, tzid);
+
+ if (!zone)
+ zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+
+ /* the old TZID prefix used in previous versions of evolution-mapi */
+ #define OLD_TZID_PREFIX "/softwarestudio.org/Tzfile/"
if (!zone && g_str_has_prefix (tzid, OLD_TZID_PREFIX))
zone = icaltimezone_get_builtin_timezone (tzid + strlen (OLD_TZID_PREFIX));
- if (!zone) {
- /* it is not a buildin time zone, try ask backend for it */
- if (cbdata && cbdata->get_timezone)
- zone = cbdata->get_timezone (cbdata->get_tz_data, tzid);
- }
+ #undef OLD_TZID_PREFIX
if (!zone)
return NULL;
diff --git a/src/libexchangemapi/exchange-mapi-cal-utils.h b/src/libexchangemapi/exchange-mapi-cal-utils.h
index 37f2a61..65c0a50 100644
--- a/src/libexchangemapi/exchange-mapi-cal-utils.h
+++ b/src/libexchangemapi/exchange-mapi-cal-utils.h
@@ -33,9 +33,6 @@
#include "exchange-mapi-cal-tz-utils.h"
#include "exchange-mapi-cal-recur-utils.h"
-/* the old TZID prefix used in previous versions of evolution-mapi */
-#define OLD_TZID_PREFIX "/softwarestudio.org/Tzfile/"
-
G_BEGIN_DECLS
typedef enum {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]