[evolution-data-server] EBookBackend: Initialize "cache-dir" from constructed().



commit b3ba029b86b27cc5fc820ae915d6340f2b5060a4
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Jan 22 14:43:05 2013 -0500

    EBookBackend: Initialize "cache-dir" from constructed().
    
    Also tweak ECalBackend's constructed() method to match.

 addressbook/libedata-book/e-book-backend.c |   16 +++++++++++-----
 calendar/libedata-cal/e-cal-backend.c      |    6 ++++--
 2 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c
index 5c6525f..f84b496 100644
--- a/addressbook/libedata-book/e-book-backend.c
+++ b/addressbook/libedata-book/e-book-backend.c
@@ -202,6 +202,16 @@ book_backend_finalize (GObject *object)
 	G_OBJECT_CLASS (e_book_backend_parent_class)->finalize (object);
 }
 
+static void
+book_backend_constructed (GObject *object)
+{
+	/* Chain up to parent's constructed() method. */
+	G_OBJECT_CLASS (e_book_backend_parent_class)->constructed (object);
+
+	/* Initialize the "cache-dir" property. */
+	book_backend_set_default_cache_dir (E_BOOK_BACKEND (object));
+}
+
 static gboolean
 book_backend_authenticate_sync (EBackend *backend,
                                 ESourceAuthenticator *auth,
@@ -249,6 +259,7 @@ e_book_backend_class_init (EBookBackendClass *class)
 	object_class->get_property = book_backend_get_property;
 	object_class->dispose = book_backend_dispose;
 	object_class->finalize = book_backend_finalize;
+	object_class->constructed = book_backend_constructed;
 
 	backend_class = E_BACKEND_CLASS (class);
 	backend_class->authenticate_sync = book_backend_authenticate_sync;
@@ -440,11 +451,6 @@ e_book_backend_open (EBookBackend *backend,
 		backend->priv->opening = TRUE;
 		g_mutex_unlock (&backend->priv->clients_mutex);
 
-		/* Subclasses may need to call e_book_backend_get_cache_dir() in
-		 * their open() methods, so get the "cache-dir" property
-		 * initialized before we call the method. */
-		book_backend_set_default_cache_dir (backend);
-
 		g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->open != NULL);
 
 		(* E_BOOK_BACKEND_GET_CLASS (backend)->open) (backend, book, opid, cancellable, only_if_exists);
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index 2b69367..508fd5a 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -292,9 +292,11 @@ cal_backend_finalize (GObject *object)
 static void
 cal_backend_constructed (GObject *object)
 {
-	cal_backend_set_default_cache_dir (E_CAL_BACKEND (object));
-
+	/* Chain up to parent's constructed() method. */
 	G_OBJECT_CLASS (e_cal_backend_parent_class)->constructed (object);
+
+	/* Initialize the "cache-dir" property. */
+	cal_backend_set_default_cache_dir (E_CAL_BACKEND (object));
 }
 
 static gboolean



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