[evolution-data-server/account-mgmt] ESourceRegistryServer: Create backend before exporting.



commit 3db4e1a810799ed4d6049ec3bcf5478be0bad9d3
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue May 29 18:57:51 2012 -0400

    ESourceRegistryServer: Create backend before exporting.

 libebackend/e-source-registry-server.c |   42 ++++++++++++++++---------------
 1 files changed, 22 insertions(+), 20 deletions(-)
---
diff --git a/libebackend/e-source-registry-server.c b/libebackend/e-source-registry-server.c
index 7337c13..8db22e2 100644
--- a/libebackend/e-source-registry-server.c
+++ b/libebackend/e-source-registry-server.c
@@ -932,32 +932,16 @@ source_registry_server_source_added (ESourceRegistryServer *server,
                                      ESource *source)
 {
 	GDBusObject *dbus_object;
-	EDBusSource *dbus_source;
 	GDBusObject *g_dbus_object;
 	const gchar *uid;
 	const gchar *object_name;
 	const gchar *object_path;
 	const gchar *extension_name;
 
-	dbus_object = e_source_ref_dbus_object (source);
-	dbus_source = e_dbus_object_get_source (E_DBUS_OBJECT (dbus_object));
-
-	g_dbus_object_manager_server_export_uniquely (
-		server->priv->object_manager,
-		G_DBUS_OBJECT_SKELETON (dbus_object));
-
-	uid = e_source_get_uid (source);
-
-	g_dbus_object = G_DBUS_OBJECT (dbus_object);
-	object_path = g_dbus_object_get_object_path (g_dbus_object);
-	object_name = strrchr (object_path, '/') + 1;
-
-	g_print ("Adding %s ('%s')\n", uid, object_name);
-
-	g_object_unref (dbus_source);
-	g_object_unref (dbus_object);
-
-	/* Instantiate an ECollectionBackend if appropriate. */
+	/* Instantiate an ECollectionBackend if appropriate.
+	 *
+	 * Do this BEFORE exporting so backends have a chance
+	 * to make any last-minute tweaks to the data source. */
 
 	extension_name = E_SOURCE_EXTENSION_COLLECTION;
 	if (e_source_has_extension (source, extension_name)) {
@@ -985,6 +969,24 @@ source_registry_server_source_added (ESourceRegistryServer *server,
 				backend_name, e_source_get_uid (source));
 		}
 	}
+
+	/* Export the data source to clients over D-Bus. */
+
+	dbus_object = e_source_ref_dbus_object (source);
+
+	g_dbus_object_manager_server_export_uniquely (
+		server->priv->object_manager,
+		G_DBUS_OBJECT_SKELETON (dbus_object));
+
+	uid = e_source_get_uid (source);
+
+	g_dbus_object = G_DBUS_OBJECT (dbus_object);
+	object_path = g_dbus_object_get_object_path (g_dbus_object);
+	object_name = strrchr (object_path, '/') + 1;
+
+	g_print ("Adding %s ('%s')\n", uid, object_name);
+
+	g_object_unref (dbus_object);
 }
 
 static void



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