[evolution-data-server] Save changes before finalizing ECalBackendStore.



commit ad12a30f349d5ca1a44fcdd607d272a8149ab9cf
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Jan 9 12:02:00 2013 -0500

    Save changes before finalizing ECalBackendStore.

 calendar/backends/caldav/e-cal-backend-caldav.c   |    1 +
 calendar/backends/http/e-cal-backend-http.c       |   13 ++++-----
 calendar/backends/weather/e-cal-backend-weather.c |   30 ++++++++++++++++----
 3 files changed, 31 insertions(+), 13 deletions(-)
---
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index f7f7635..d854b67 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -4966,6 +4966,7 @@ e_cal_backend_caldav_dispose (GObject *object)
 	g_free (priv->schedule_outbox_url);
 
 	if (priv->store != NULL) {
+		e_cal_backend_store_save (priv->store);
 		g_object_unref (priv->store);
 	}
 
diff --git a/calendar/backends/http/e-cal-backend-http.c b/calendar/backends/http/e-cal-backend-http.c
index c2db383..7f3fecf 100644
--- a/calendar/backends/http/e-cal-backend-http.c
+++ b/calendar/backends/http/e-cal-backend-http.c
@@ -119,6 +119,12 @@ e_cal_backend_http_dispose (GObject *object)
 		priv->reload_timeout_id = 0;
 	}
 
+	if (priv->store) {
+		e_cal_backend_store_save (priv->store);
+		g_object_unref (priv->store);
+		priv->store = NULL;
+	}
+
 	if (priv->soup_session) {
 		soup_session_abort (priv->soup_session);
 		g_object_unref (priv->soup_session);
@@ -143,13 +149,6 @@ e_cal_backend_http_finalize (GObject *object)
 
 	priv = E_CAL_BACKEND_HTTP_GET_PRIVATE (object);
 
-	/* Clean up */
-
-	if (priv->store) {
-		g_object_unref (priv->store);
-		priv->store = NULL;
-	}
-
 	g_free (priv->uri);
 	g_free (priv->password);
 
diff --git a/calendar/backends/weather/e-cal-backend-weather.c b/calendar/backends/weather/e-cal-backend-weather.c
index c9e2da8..df08ae0 100644
--- a/calendar/backends/weather/e-cal-backend-weather.c
+++ b/calendar/backends/weather/e-cal-backend-weather.c
@@ -758,29 +758,46 @@ e_cal_backend_weather_notify_online_cb (ECalBackend *backend,
 	}
 }
 
-/* Finalize handler for the weather backend */
 static void
-e_cal_backend_weather_finalize (GObject *object)
+e_cal_backend_weather_dispose (GObject *object)
 {
 	ECalBackendWeatherPrivate *priv;
 
 	priv = E_CAL_BACKEND_WEATHER_GET_PRIVATE (object);
 
-	if (priv->reload_timeout_id)
+	if (priv->reload_timeout_id > 0) {
 		g_source_remove (priv->reload_timeout_id);
+		priv->reload_timeout_id = 0;
+	}
 
-	if (priv->begin_retrival_id)
+	if (priv->begin_retrival_id > 0) {
 		g_source_remove (priv->begin_retrival_id);
+		priv->begin_retrival = 0;
+	}
 
-	if (priv->store) {
+	if (priv->store != NULL) {
+		e_cal_backend_store_save (priv->store);
 		g_object_unref (priv->store);
 		priv->store = NULL;
 	}
 
+	/* Chain up to parent's dispose() method. */
+	G_OBJECT_CLASS (e_cal_backend_weather_parent_class)->
+		dispose (object);
+}
+
+static void
+e_cal_backend_weather_finalize (GObject *object)
+{
+	ECalBackendWeatherPrivate *priv;
+
+	priv = E_CAL_BACKEND_WEATHER_GET_PRIVATE (object);
+
 	g_free (priv->city);
 
 	/* Chain up to parent's finalize() method. */
-	G_OBJECT_CLASS (e_cal_backend_weather_parent_class)->finalize (object);
+	G_OBJECT_CLASS (e_cal_backend_weather_parent_class)->
+		finalize (object);
 }
 
 /* Object initialization function for the weather backend */
@@ -810,6 +827,7 @@ e_cal_backend_weather_class_init (ECalBackendWeatherClass *class)
 	backend_class = (ECalBackendClass *) class;
 	sync_class = (ECalBackendSyncClass *) class;
 
+	object_class->dispose = e_cal_backend_weather_dispose;
 	object_class->finalize = e_cal_backend_weather_finalize;
 
 	sync_class->get_backend_property_sync	= e_cal_backend_weather_get_backend_property;



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