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



commit 5874ce5078b37ba728c9bdacdb1636d9496e3213
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jan 4 13:03:43 2013 -0500

    Remove e_cal_backend_store_put_timezone().
    
    Use the ETimezoneCache API instead:
    
        cache = e_cal_backend_store_ref_timezone_cache (store);
        e_timezone_cache_add_timezone (cache, 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    |   11 ++++--
 calendar/backends/http/e-cal-backend-http.c        |   12 ++++---
 calendar/libedata-cal/e-cal-backend-store.c        |   39 --------------------
 calendar/libedata-cal/e-cal-backend-store.h        |    4 --
 .../libedata-cal/libedata-cal-sections.txt         |    1 -
 5 files changed, 15 insertions(+), 52 deletions(-)
---
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index 011785a..f7f7635 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -4094,6 +4094,7 @@ static gboolean
 extract_timezones (ECalBackendCalDAV *cbdav,
                    icalcomponent *icomp)
 {
+	ETimezoneCache *timezone_cache;
 	GSList *timezones = NULL, *iter;
 	icaltimezone *zone;
 	GError *err = NULL;
@@ -4101,6 +4102,8 @@ extract_timezones (ECalBackendCalDAV *cbdav,
 	g_return_val_if_fail (cbdav != NULL, FALSE);
 	g_return_val_if_fail (icomp != NULL, FALSE);
 
+	timezone_cache = E_TIMEZONE_CACHE (cbdav);
+
 	extract_objects (icomp, ICAL_VTIMEZONE_COMPONENT, &timezones, &err);
 	if (err) {
 		g_error_free (err);
@@ -4110,7 +4113,7 @@ extract_timezones (ECalBackendCalDAV *cbdav,
 	zone = icaltimezone_new ();
 	for (iter = timezones; iter; iter = iter->next) {
 		if (icaltimezone_set_component (zone, iter->data)) {
-			e_cal_backend_store_put_timezone (cbdav->priv->store, zone);
+			e_timezone_cache_add_timezone (timezone_cache, zone);
 		} else {
 			icalcomponent_free (iter->data);
 		}
@@ -4458,10 +4461,12 @@ caldav_add_timezone (ECalBackendSync *backend,
                      const gchar *tzobj,
                      GError **error)
 {
-	icalcomponent *tz_comp;
+	ETimezoneCache *timezone_cache;
 	ECalBackendCalDAV *cbdav;
+	icalcomponent *tz_comp;
 
 	cbdav = E_CAL_BACKEND_CALDAV (backend);
+	timezone_cache = E_TIMEZONE_CACHE (backend);
 
 	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_CALDAV (cbdav), InvalidArg);
 	e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
@@ -4478,7 +4483,7 @@ caldav_add_timezone (ECalBackendSync *backend,
 		zone = icaltimezone_new ();
 		icaltimezone_set_component (zone, tz_comp);
 
-		e_cal_backend_store_put_timezone (cbdav->priv->store, zone);
+		e_timezone_cache_add_timezone (timezone_cache, zone);
 
 		icaltimezone_free (zone, TRUE);
 	} else {
diff --git a/calendar/backends/http/e-cal-backend-http.c b/calendar/backends/http/e-cal-backend-http.c
index a0b837b..4943810 100644
--- a/calendar/backends/http/e-cal-backend-http.c
+++ b/calendar/backends/http/e-cal-backend-http.c
@@ -452,6 +452,7 @@ cal_backend_http_load (ECalBackendHttp *backend,
                        GError **error)
 {
 	ECalBackendHttpPrivate *priv = backend->priv;
+	ETimezoneCache *timezone_cache;
 	SoupMessage *soup_message;
 	SoupSession *soup_session;
 	icalcomponent *icalcomp, *subcomp;
@@ -468,6 +469,8 @@ cal_backend_http_load (ECalBackendHttp *backend,
 		SoupMessage *soup_message;
 	} cancel_data;
 
+	timezone_cache = E_TIMEZONE_CACHE (backend);
+
 	soup_session = backend->priv->soup_session;
 	soup_message = cal_backend_http_new_message (backend, uri);
 
@@ -653,7 +656,7 @@ cal_backend_http_load (ECalBackendHttp *backend,
 
 			zone = icaltimezone_new ();
 			icaltimezone_set_component (zone, icalcomponent_new_clone (subcomp));
-			e_cal_backend_store_put_timezone (priv->store, zone);
+			e_timezone_cache_add_timezone (timezone_cache, zone);
 
 			icaltimezone_free (zone, 1);
 		}
@@ -1018,17 +1021,16 @@ e_cal_backend_http_add_timezone (ECalBackendSync *backend,
                                  GError **error)
 {
 	ECalBackendHttp *cbhttp;
-	ECalBackendHttpPrivate *priv;
+	ETimezoneCache *timezone_cache;
 	icalcomponent *tz_comp;
 	icaltimezone *zone;
 
 	cbhttp = (ECalBackendHttp *) backend;
+	timezone_cache = E_TIMEZONE_CACHE (backend);
 
 	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_HTTP (cbhttp), InvalidArg);
 	e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
 
-	priv = cbhttp->priv;
-
 	tz_comp = icalparser_parse_string (tzobj);
 	if (!tz_comp) {
 		g_propagate_error (error, EDC_ERROR (InvalidObject));
@@ -1043,7 +1045,7 @@ e_cal_backend_http_add_timezone (ECalBackendSync *backend,
 
 	zone = icaltimezone_new ();
 	icaltimezone_set_component (zone, tz_comp);
-	e_cal_backend_store_put_timezone (priv->store, zone);
+	e_timezone_cache_add_timezone (timezone_cache, zone);
 }
 
 /* Get_objects_in_range handler for the file backend */
diff --git a/calendar/libedata-cal/e-cal-backend-store.c b/calendar/libedata-cal/e-cal-backend-store.c
index cb90cb9..cd41f2b 100644
--- a/calendar/libedata-cal/e-cal-backend-store.c
+++ b/calendar/libedata-cal/e-cal-backend-store.c
@@ -711,24 +711,6 @@ end:
 	return ret_val;
 }
 
-static gboolean
-cal_backend_store_put_timezone (ECalBackendStore *store,
-                                icaltimezone *zone)
-{
-	ETimezoneCache *timezone_cache;
-
-	timezone_cache = e_cal_backend_store_ref_timezone_cache (store);
-	e_timezone_cache_add_timezone (timezone_cache, zone);
-	g_object_unref (timezone_cache);
-
-	store->priv->dirty = TRUE;
-
-	if (!store->priv->freeze_changes)
-		cal_backend_store_save_cache (store);
-
-	return TRUE;
-}
-
 static const icaltimezone *
 cal_backend_store_get_default_timezone (ECalBackendStore *store)
 {
@@ -952,7 +934,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->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;
 	class->get_components_by_uid = cal_backend_store_get_components_by_uid;
@@ -1230,26 +1211,6 @@ e_cal_backend_store_remove_component (ECalBackendStore *store,
 }
 
 /**
- * e_cal_backend_store_put_timezone:
- *
- * Since: 2.28
- **/
-gboolean
-e_cal_backend_store_put_timezone (ECalBackendStore *store,
-                                  icaltimezone *zone)
-{
-	ECalBackendStoreClass *class;
-
-	g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), FALSE);
-	g_return_val_if_fail (zone != NULL, FALSE);
-
-	class = E_CAL_BACKEND_STORE_GET_CLASS (store);
-	g_return_val_if_fail (class->put_timezone != NULL, FALSE);
-
-	return class->put_timezone (store, zone);
-}
-
-/**
  * e_cal_backend_store_get_default_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 498cdc4..7816cfd 100644
--- a/calendar/libedata-cal/e-cal-backend-store.h
+++ b/calendar/libedata-cal/e-cal-backend-store.h
@@ -85,8 +85,6 @@ struct _ECalBackendStoreClass {
 	GSList *	(*get_components)	(ECalBackendStore *store);
 
 	GSList *	(*get_component_ids)	(ECalBackendStore *store);
-	gboolean	(*put_timezone)		(ECalBackendStore *store,
-						 icaltimezone *zone);
 	const icaltimezone *
 			(*get_default_timezone)	(ECalBackendStore *store);
 	gboolean	(*set_default_timezone)	(ECalBackendStore *store,
@@ -131,8 +129,6 @@ gboolean	e_cal_backend_store_has_component
 						(ECalBackendStore *store,
 						 const gchar *uid,
 						 const gchar *rid);
-gboolean	e_cal_backend_store_put_timezone (ECalBackendStore *store,
-						  icaltimezone *zone);
 const icaltimezone *
 		e_cal_backend_store_get_default_timezone
 						(ECalBackendStore *store);
diff --git a/docs/reference/calendar/libedata-cal/libedata-cal-sections.txt b/docs/reference/calendar/libedata-cal/libedata-cal-sections.txt
index 2e32af8..d4bf314 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_put_timezone
 e_cal_backend_store_get_default_timezone
 e_cal_backend_store_set_default_timezone
 e_cal_backend_store_get_components_by_uid



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