[evolution-data-server] Remove e_cal_backend_store_get_timezone().



commit 21c91f474c7a2c802c590e7416dcb167143d07e4
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jan 4 12:50:30 2013 -0500

    Remove e_cal_backend_store_get_timezone().
    
    Use the ETimezoneCache API instead:
    
        cache = e_cal_backend_store_ref_timezone_cache (store);
        zone = e_timezone_cache_get_timezone (cache, tzid);
        ... do what you gotta do with zone ...
        g_object_unref (cache);
    
    This is another API break.  3rd party backends will have to be adjusted.

 calendar/backends/caldav/e-cal-backend-caldav.c    |   23 +++++++------
 calendar/libedata-cal/e-cal-backend-store.c        |   35 --------------------
 calendar/libedata-cal/e-cal-backend-store.h        |    6 ---
 .../libedata-cal/libedata-cal-sections.txt         |    1 -
 4 files changed, 12 insertions(+), 53 deletions(-)
---
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index 8d79618..011785a 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -3370,6 +3370,7 @@ add_timezone_cb (icalparameter *param,
 	const gchar *tzid;
 	icalcomponent *vtz_comp;
 	ForeachTzidData *f_data = (ForeachTzidData *) data;
+	ETimezoneCache *cache;
 
 	tzid = icalparameter_get_tzid (param);
 	if (!tzid)
@@ -3379,22 +3380,22 @@ add_timezone_cb (icalparameter *param,
 	if (tz)
 		return;
 
+	cache = e_cal_backend_store_ref_timezone_cache (f_data->store);
+
 	tz = icalcomponent_get_timezone (f_data->icalcomp, tzid);
-	if (!tz) {
+	if (tz == NULL)
 		tz = icaltimezone_get_builtin_timezone_from_tzid (tzid);
-		if (!tz)
-			tz = (icaltimezone *) e_cal_backend_store_get_timezone (f_data->store, tzid);
-		if (!tz)
-			return;
-	}
+	if (tz == NULL)
+		tz = e_timezone_cache_get_timezone (cache, tzid);
 
 	vtz_comp = icaltimezone_get_component (tz);
-	if (!vtz_comp)
-		return;
 
-	icalcomponent_add_component (
-		f_data->vcal_comp,
-		icalcomponent_new_clone (vtz_comp));
+	if (tz != NULL && vtz_comp != NULL)
+		icalcomponent_add_component (
+			f_data->vcal_comp,
+			icalcomponent_new_clone (vtz_comp));
+
+	g_object_unref (cache);
 }
 
 static void
diff --git a/calendar/libedata-cal/e-cal-backend-store.c b/calendar/libedata-cal/e-cal-backend-store.c
index 4f19c37..cb90cb9 100644
--- a/calendar/libedata-cal/e-cal-backend-store.c
+++ b/calendar/libedata-cal/e-cal-backend-store.c
@@ -711,20 +711,6 @@ end:
 	return ret_val;
 }
 
-static const icaltimezone *
-cal_backend_store_get_timezone (ECalBackendStore *store,
-                                const gchar *tzid)
-{
-	ETimezoneCache *timezone_cache;
-	const icaltimezone *zone = NULL;
-
-	timezone_cache = e_cal_backend_store_ref_timezone_cache (store);
-	zone = e_timezone_cache_get_timezone (timezone_cache, tzid);
-	g_object_unref (timezone_cache);
-
-	return zone;
-}
-
 static gboolean
 cal_backend_store_put_timezone (ECalBackendStore *store,
                                 icaltimezone *zone)
@@ -966,7 +952,6 @@ e_cal_backend_store_class_init (ECalBackendStoreClass *class)
 	class->put_component = cal_backend_store_put_component;
 	class->remove_component = cal_backend_store_remove_component;
 	class->has_component = cal_backend_store_has_component;
-	class->get_timezone = cal_backend_store_get_timezone;
 	class->put_timezone = cal_backend_store_put_timezone;
 	class->get_default_timezone = cal_backend_store_get_default_timezone;
 	class->set_default_timezone = cal_backend_store_set_default_timezone;
@@ -1245,26 +1230,6 @@ e_cal_backend_store_remove_component (ECalBackendStore *store,
 }
 
 /**
- * e_cal_backend_store_get_timezone:
- *
- * Since: 2.28
- **/
-const icaltimezone *
-e_cal_backend_store_get_timezone (ECalBackendStore *store,
-                                  const gchar *tzid)
-{
-	ECalBackendStoreClass *class;
-
-	g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), NULL);
-	g_return_val_if_fail (tzid != NULL, NULL);
-
-	class = E_CAL_BACKEND_STORE_GET_CLASS (store);
-	g_return_val_if_fail (class->get_timezone != NULL, NULL);
-
-	return class->get_timezone (store, tzid);
-}
-
-/**
  * e_cal_backend_store_put_timezone:
  *
  * Since: 2.28
diff --git a/calendar/libedata-cal/e-cal-backend-store.h b/calendar/libedata-cal/e-cal-backend-store.h
index 5b083d2..498cdc4 100644
--- a/calendar/libedata-cal/e-cal-backend-store.h
+++ b/calendar/libedata-cal/e-cal-backend-store.h
@@ -85,9 +85,6 @@ struct _ECalBackendStoreClass {
 	GSList *	(*get_components)	(ECalBackendStore *store);
 
 	GSList *	(*get_component_ids)	(ECalBackendStore *store);
-	const icaltimezone *
-			(*get_timezone)		(ECalBackendStore *store,
-						 const gchar *tzid);
 	gboolean	(*put_timezone)		(ECalBackendStore *store,
 						 icaltimezone *zone);
 	const icaltimezone *
@@ -134,9 +131,6 @@ gboolean	e_cal_backend_store_has_component
 						(ECalBackendStore *store,
 						 const gchar *uid,
 						 const gchar *rid);
-const icaltimezone *
-		e_cal_backend_store_get_timezone (ECalBackendStore *store,
-						  const gchar *tzid);
 gboolean	e_cal_backend_store_put_timezone (ECalBackendStore *store,
 						  icaltimezone *zone);
 const icaltimezone *
diff --git a/docs/reference/calendar/libedata-cal/libedata-cal-sections.txt b/docs/reference/calendar/libedata-cal/libedata-cal-sections.txt
index 6ca17f4..2e32af8 100644
--- a/docs/reference/calendar/libedata-cal/libedata-cal-sections.txt
+++ b/docs/reference/calendar/libedata-cal/libedata-cal-sections.txt
@@ -137,7 +137,6 @@ e_cal_backend_store_put_component_with_time_range
 e_cal_backend_store_put_component
 e_cal_backend_store_remove_component
 e_cal_backend_store_has_component
-e_cal_backend_store_get_timezone
 e_cal_backend_store_put_timezone
 e_cal_backend_store_get_default_timezone
 e_cal_backend_store_set_default_timezone



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]