[evolution-data-server] Do not break the api. Add store_put_component_with_time_range. Revert changes from ECalBackendCache



commit 95965b484957fc13aacfa77c2bb37f2e690e91d5
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Tue Sep 7 16:06:18 2010 +0530

    Do not break the api. Add store_put_component_with_time_range. Revert changes from ECalBackendCache

 calendar/backends/caldav/e-cal-backend-caldav.c    |    2 +-
 .../backends/groupwise/e-cal-backend-groupwise.c   |    2 +-
 calendar/backends/http/e-cal-backend-http.c        |    2 +-
 calendar/backends/weather/e-cal-backend-weather.c  |    2 +-
 calendar/libedata-cal/e-cal-backend-cache.c        |   61 +-------------------
 calendar/libedata-cal/e-cal-backend-cache.h        |    5 +-
 calendar/libedata-cal/e-cal-backend-file-store.c   |    3 +-
 calendar/libedata-cal/e-cal-backend-store.c        |   26 +++++++-
 calendar/libedata-cal/e-cal-backend-store.h        |    5 +-
 9 files changed, 36 insertions(+), 72 deletions(-)
---
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index 05d202a..595f6fb 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -287,7 +287,7 @@ put_component_to_store (ECalBackendCalDAV *cbdav,
 				   resolve_tzid, NULL,  icaltimezone_get_utc_timezone (),
 				   e_cal_backend_get_kind (E_CAL_BACKEND (cbdav)));
 
-	return e_cal_backend_store_put_component (priv->store, comp, time_start, time_end);
+	return e_cal_backend_store_put_component_with_time_range (priv->store, comp, time_start, time_end);
 }
 
 
diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise.c b/calendar/backends/groupwise/e-cal-backend-groupwise.c
index 7dbbdc3..4719598 100644
--- a/calendar/backends/groupwise/e-cal-backend-groupwise.c
+++ b/calendar/backends/groupwise/e-cal-backend-groupwise.c
@@ -212,7 +212,7 @@ put_component_to_store (ECalBackendGroupwise *cbgw,
 				   resolve_tzid, NULL, priv->default_zone,
 				   e_cal_backend_get_kind (E_CAL_BACKEND (cbgw)));
 
-	e_cal_backend_store_put_component (priv->store, comp, time_start, time_end);
+	e_cal_backend_store_put_component_with_time_range (priv->store, comp, time_start, time_end);
 }
 
 /* Initialy populate the cache from the server */
diff --git a/calendar/backends/http/e-cal-backend-http.c b/calendar/backends/http/e-cal-backend-http.c
index 2f50c51..46c7937 100644
--- a/calendar/backends/http/e-cal-backend-http.c
+++ b/calendar/backends/http/e-cal-backend-http.c
@@ -300,7 +300,7 @@ put_component_to_store (ECalBackendHttp *cb,
 				   resolve_tzid, NULL, priv->default_zone,
 				   e_cal_backend_get_kind (E_CAL_BACKEND (cb)));
 
-	e_cal_backend_store_put_component (priv->store, comp, time_start, time_end);
+	e_cal_backend_store_put_component_with_time_range (priv->store, comp, time_start, time_end);
 }
 
 
diff --git a/calendar/backends/weather/e-cal-backend-weather.c b/calendar/backends/weather/e-cal-backend-weather.c
index 025b0b6..7b703af 100644
--- a/calendar/backends/weather/e-cal-backend-weather.c
+++ b/calendar/backends/weather/e-cal-backend-weather.c
@@ -160,7 +160,7 @@ put_component_to_store (ECalBackendWeather *cb,
 				   resolve_tzid, NULL, priv->default_zone,
 				   e_cal_backend_get_kind (E_CAL_BACKEND (cb)));
 
-	e_cal_backend_store_put_component (priv->store, comp, time_start, time_end);
+	e_cal_backend_store_put_component_with_time_range (priv->store, comp, time_start, time_end);
 }
 
 static void
diff --git a/calendar/libedata-cal/e-cal-backend-cache.c b/calendar/libedata-cal/e-cal-backend-cache.c
index bbaffb0..dd242d4 100644
--- a/calendar/libedata-cal/e-cal-backend-cache.c
+++ b/calendar/libedata-cal/e-cal-backend-cache.c
@@ -29,7 +29,6 @@
 #include <libecal/e-cal-util.h>
 #include <libedataserver/e-data-server-util.h>
 #include "e-cal-backend-cache.h"
-#include "e-cal-backend-intervaltree.h"
 
 #define E_CAL_BACKEND_CACHE_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -37,7 +36,6 @@
 
 struct _ECalBackendCachePrivate {
 	GHashTable *timezones;
-	EIntervalTree *intervaltree;
 };
 
 G_DEFINE_TYPE (ECalBackendCache, e_cal_backend_cache, E_TYPE_FILE_CACHE)
@@ -48,10 +46,7 @@ e_cal_backend_cache_finalize (GObject *object)
 	ECalBackendCachePrivate *priv;
 
 	priv = E_CAL_BACKEND_CACHE_GET_PRIVATE (object);
-	if (priv->intervaltree) {
-		e_intervaltree_destroy (priv->intervaltree);
-		priv->intervaltree = NULL;
-	}
+
 	g_hash_table_destroy (priv->timezones);
 
 	/* Chain up to parent's finalize() method. */
@@ -84,8 +79,6 @@ e_cal_backend_cache_init (ECalBackendCache *cache)
 		g_str_hash, g_str_equal,
 		(GDestroyNotify) g_free,
 		(GDestroyNotify) timezones_value_destroy);
-
-	cache->priv->intervaltree = e_intervaltree_new ();
 }
 
 /**
@@ -181,14 +174,12 @@ e_cal_backend_cache_get_component (ECalBackendCache *cache, const gchar *uid, co
  */
 gboolean
 e_cal_backend_cache_put_component (ECalBackendCache *cache,
-				   ECalComponent *comp,
-				   time_t occurence_start,
-				   time_t occurence_end)
+				   ECalComponent *comp)
 {
 	gchar *real_key, *uid, *comp_str;
 	gchar *rid;
 	gboolean retval;
-	ECalBackendCachePrivate *priv = cache->priv;
+
 	g_return_val_if_fail (E_IS_CAL_BACKEND_CACHE (cache), FALSE);
 	g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE);
 
@@ -206,8 +197,6 @@ e_cal_backend_cache_put_component (ECalBackendCache *cache,
 	else
 		retval = e_file_cache_add_object (E_FILE_CACHE (cache), real_key, comp_str);
 
-	e_intervaltree_insert (priv->intervaltree, occurence_start, occurence_end, comp);
-
 	g_free (real_key);
 	g_free (comp_str);
 	g_free (rid);
@@ -249,9 +238,6 @@ e_cal_backend_cache_remove_component (ECalBackendCache *cache,
 	retval = e_file_cache_remove_object (E_FILE_CACHE (cache), real_key);
 	g_free (real_key);
 
-	if (retval)
-		retval = e_intervaltree_remove (priv->intervaltree, uid, rid);
-
 	return retval;
 }
 
@@ -305,47 +291,6 @@ e_cal_backend_cache_get_components (ECalBackendCache *cache)
 }
 
 /**
- * e_cal_backend_cache_get_components_occuring_in_range:
- * @cache: An #ECalBackendCache object.
- * @start:
- * @end:
- *
- * Retrieves a list of components stored in the cache, that are occuring
- * in time range [start, end].
- *
- * Return value: A list of the components. Each item in the list is
- * an #ECalComponent, which should be freed when no longer needed.
- */
-GList *
-e_cal_backend_cache_get_components_occuring_in_range (ECalBackendCache *cache, time_t start, time_t end)
-{
-        GList *l;
-        GList *list = NULL;
-	icalcomponent *icalcomp;
-	ECalBackendCachePrivate *priv;
-	/* return null if cache is not a valid Backend Cache.  */
-	g_return_val_if_fail (E_IS_CAL_BACKEND_CACHE (cache), NULL);
-	priv = cache->priv;
-	if (!(l = e_intervaltree_search (priv->intervaltree, start, end)))
-		return NULL;
-
-	for ( ; l != NULL; l = g_list_next (l)) {
-		ECalComponent *comp = l->data;
-		icalcomp = e_cal_component_get_icalcomponent (comp);
-		if (icalcomp) {
-			icalcomponent_kind kind;
-			kind = icalcomponent_isa (icalcomp);
-			if (kind == ICAL_VEVENT_COMPONENT || kind == ICAL_VTODO_COMPONENT || kind == ICAL_VJOURNAL_COMPONENT) {
-				list = g_list_prepend (list, comp);
-			}
-		}
-	}
-        return list;
-}
-
-
-
-/**
  * e_cal_backend_cache_get_components_by_uid:
  * @cache: An #ECalBackendCache object.
  * @uid: ID of the component to retrieve.
diff --git a/calendar/libedata-cal/e-cal-backend-cache.h b/calendar/libedata-cal/e-cal-backend-cache.h
index ba7202d..d699fd1 100644
--- a/calendar/libedata-cal/e-cal-backend-cache.h
+++ b/calendar/libedata-cal/e-cal-backend-cache.h
@@ -69,9 +69,7 @@ ECalComponent *	e_cal_backend_cache_get_component
 						 const gchar *rid);
 gboolean	e_cal_backend_cache_put_component
 						(ECalBackendCache *cache,
-						ECalComponent *compi,
-						time_t occurence_start,
-						time_t occurence_end);
+						 ECalComponent *comp);
 gboolean	e_cal_backend_cache_remove_component
 						(ECalBackendCache *cache,
 						 const gchar *uid,
@@ -81,7 +79,6 @@ GList *		e_cal_backend_cache_get_components
 GSList *	e_cal_backend_cache_get_components_by_uid
 						(ECalBackendCache *cache,
 						 const gchar *uid);
-GList		   *e_cal_backend_cache_get_components_occuring_in_range (ECalBackendCache *cache, time_t start, time_t end);
 const icaltimezone *
 		e_cal_backend_cache_get_timezone(ECalBackendCache *cache,
 						 const gchar *tzid);
diff --git a/calendar/libedata-cal/e-cal-backend-file-store.c b/calendar/libedata-cal/e-cal-backend-file-store.c
index 4e86f92..902db18 100644
--- a/calendar/libedata-cal/e-cal-backend-file-store.c
+++ b/calendar/libedata-cal/e-cal-backend-file-store.c
@@ -668,10 +668,11 @@ scan_vcalendar (ECalBackendStore *store, icalcomponent *top_icalcomp)
 			g_object_unref (comp);
 			continue;
 		}
+		
 		get_component_occur_times (comp, &time_start, &time_end,
 						resolve_tzid, NULL, NULL, kind);
 
-		e_cal_backend_store_put_component (store, comp, time_start, time_end);
+		e_cal_backend_store_put_component_with_time_range (store, comp, time_start, time_end);
 
 		g_object_unref (comp);
 	}
diff --git a/calendar/libedata-cal/e-cal-backend-store.c b/calendar/libedata-cal/e-cal-backend-store.c
index 3089601..dfa2e99 100644
--- a/calendar/libedata-cal/e-cal-backend-store.c
+++ b/calendar/libedata-cal/e-cal-backend-store.c
@@ -238,12 +238,12 @@ e_cal_backend_store_has_component (ECalBackendStore *store, const gchar *uid, co
 }
 
 /**
- * e_cal_backend_store_put_component:
+ * e_cal_backend_store_put_component_with_time_range:
  *
- * Since: 2.28
+ * Since: 2.32
  **/
 gboolean
-e_cal_backend_store_put_component (ECalBackendStore *store, ECalComponent *comp, time_t occurence_start, time_t occurence_end)
+e_cal_backend_store_put_component_with_time_range (ECalBackendStore *store, ECalComponent *comp, time_t occurence_start, time_t occurence_end)
 {
 	ECalBackendStorePrivate *priv;
 	g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), FALSE);
@@ -256,7 +256,25 @@ e_cal_backend_store_put_component (ECalBackendStore *store, ECalComponent *comp,
 		return TRUE;
 	}
 	return FALSE;
-}	
+
+}
+
+/**
+ * e_cal_backend_store_put_component:
+ *
+ * Since: 2.28
+ **/
+gboolean
+e_cal_backend_store_put_component (ECalBackendStore *store, ECalComponent *comp)
+{
+	ECalBackendStorePrivate *priv;
+	g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), FALSE);
+	g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE);
+
+	priv = E_CAL_BACKEND_STORE_GET_PRIVATE (store);
+
+	return (E_CAL_BACKEND_STORE_GET_CLASS (store))->put_component (store, comp);
+}
 
 /**
  * e_cal_backend_store_remove_component:
diff --git a/calendar/libedata-cal/e-cal-backend-store.h b/calendar/libedata-cal/e-cal-backend-store.h
index f28b733..c25692b 100644
--- a/calendar/libedata-cal/e-cal-backend-store.h
+++ b/calendar/libedata-cal/e-cal-backend-store.h
@@ -114,11 +114,14 @@ ECalComponent *	e_cal_backend_store_get_component
 						(ECalBackendStore *store,
 						 const gchar *uid,
 						 const gchar *rid);
-gboolean	e_cal_backend_store_put_component
+gboolean	e_cal_backend_store_put_component_with_time_range
 						(ECalBackendStore *store,
 						 ECalComponent *comp,
 						 time_t occurence_start,
 						 time_t occurence_end);
+gboolean	e_cal_backend_store_put_component
+						(ECalBackendStore *store,
+						 ECalComponent *comp);
 gboolean	e_cal_backend_store_remove_component
 						(ECalBackendStore *store,
 						 const gchar *uid,



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