/srv/mercurial-server/detachablepurple: 312688f28e6c: Keep the i...

Gilles Bedel gillux at cpw.pidgin.im
Fri Jun 15 22:01:34 EDT 2012


Changeset: 312688f28e6c19070bafd80b09df4013f28d0846
Author:	 Gilles Bedel <gillux at cpw.pidgin.im>
Date:	 2012-05-12 20:40 +0000
Branch:	 cpw.gillux.detachablepurple
URL: http://hg.pidgin.im/srv/mercurial-server/detachablepurple/rev/312688f28e6c

Description:

Keep the initialization of libpurple clients synchronous for the time being.
This initialization process is a big deal. If we make it synchronous
(that is, acquisition of the bus and synchronization of a client block),
then we won't need to change much of the current libpurple initialization
code. This is good for the moment, as we just want to get this detachable
session branch working (and it could be backward compatible).
But (much more) later, we will need to make an asynchronous initialization
process, so that UIs would be able to interact (e.g. prividing the address
of the daemon, cancelling connection, reporting errors etc.).

diffstat:

 libpurple/dbus-server.c |  15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diffs (33 lines):

diff --git a/libpurple/dbus-server.c b/libpurple/dbus-server.c
--- a/libpurple/dbus-server.c
+++ b/libpurple/dbus-server.c
@@ -848,7 +848,6 @@
 purple_gdbus_init(void)
 {
 	guint owner_id;
-	GError *error = NULL;
 
 	if (purple_core_is_remote_mode()) {
 		/* Initialize the "dbus path name -> gobject" hash table */
@@ -869,7 +868,21 @@
 		/* TODO: handle fail of owning the name. */
 	}
 	else if(purple_core_is_remote_mode()) {
+#if 0
+		/* TODO: asynchronous purple initialization, to allow
+		 * UI controlled detachable sessions. */
 		g_bus_get(G_BUS_TYPE_SESSION, NULL, on_client_connected, NULL);
+#else
+		purple_gdbus_connection = g_bus_get_sync(G_BUS_TYPE_SESSION,
+		                                         NULL, NULL);
+		if (purple_gdbus_connection) {
+			connect_waiting_objects(purple_gdbus_connection);
+		} else {
+			/* Quick and dirty failure. */
+			purple_debug_error("dbus", "Couldn't get the bus, aborting!");
+			exit(1);
+		}
+#endif
 	}
 
 	/* In remote and daemon mode, we create our singleton objects */



More information about the Commits mailing list