[evolution-data-server/account-mgmt] ESourceRegistryServer: Update data property sooner.



commit d42950b2ed54d336161655649b842f415b30b495
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue May 29 18:26:51 2012 -0400

    ESourceRegistryServer: Update data property sooner.

 libebackend/e-source-registry-server.c |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/libebackend/e-source-registry-server.c b/libebackend/e-source-registry-server.c
index 1449ea8..7337c13 100644
--- a/libebackend/e-source-registry-server.c
+++ b/libebackend/e-source-registry-server.c
@@ -938,18 +938,10 @@ source_registry_server_source_added (ESourceRegistryServer *server,
 	const gchar *object_name;
 	const gchar *object_path;
 	const gchar *extension_name;
-	gchar *data;
 
 	dbus_object = e_source_ref_dbus_object (source);
 	dbus_source = e_dbus_object_get_source (E_DBUS_OBJECT (dbus_object));
 
-	/* Before we export, make sure the EDBusSource's "data" property
-	 * is up-to-date.  ESource changes get propagated to the "data"
-	 * property from an idle callback, which may still be pending. */
-	data = e_source_to_string (source, NULL);
-	e_dbus_source_set_data (dbus_source, data);
-	g_free (data);
-
 	g_dbus_object_manager_server_export_uniquely (
 		server->priv->object_manager,
 		G_DBUS_OBJECT_SKELETON (dbus_object));
@@ -1216,8 +1208,11 @@ void
 e_source_registry_server_add_source (ESourceRegistryServer *server,
                                      ESource *source)
 {
+	GDBusObject *dbus_object;
+	EDBusSource *dbus_source;
 	const gchar *extension_name;
 	const gchar *uid;
+	gchar *data;
 
 	g_return_if_fail (E_IS_SOURCE_REGISTRY_SERVER (server));
 	g_return_if_fail (E_IS_SERVER_SIDE_SOURCE (source));
@@ -1241,10 +1236,25 @@ e_source_registry_server_add_source (ESourceRegistryServer *server,
 
 	g_mutex_unlock (server->priv->sources_lock);
 
+	/* Before we emit, make sure the EDBusSource's "data" property
+	 * is up-to-date.  ESource changes get propagated to the "data"
+	 * property from an idle callback, which may still be pending. */
+
+	dbus_object = e_source_ref_dbus_object (source);
+	dbus_source = e_dbus_object_get_source (E_DBUS_OBJECT (dbus_object));
+
+	data = e_source_to_string (source, NULL);
+	e_dbus_source_set_data (dbus_source, data);
+	g_free (data);
+
+	g_object_unref (dbus_source);
+	g_object_unref (dbus_object);
+
 	/* If the added source has a [Collection] extension but the
 	 * corresponding ECollectionBackendFactory is not available,
 	 * the source gets permanently inserted in the orphans table
 	 * to prevent it from being exported to client applications. */
+
 	extension_name = E_SOURCE_EXTENSION_COLLECTION;
 	if (e_source_has_extension (source, extension_name)) {
 		ECollectionBackendFactory *backend_factory;



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