cpw.gillux.detachablepurple: 4d8107aa: Keep the initialization of libpurple cli...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Sat May 12 16:56:35 EDT 2012


----------------------------------------------------------------------
Revision: 4d8107aa60bd76af7e49d84c1739ce6778a8d305
Parent:   f53ace8239cc403b8c3b0f96ea236cdf2eb3f123
Author:   gillux at soc.pidgin.im
Date:     05/12/12 16:40:06
Branch:   im.pidgin.cpw.gillux.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/4d8107aa60bd76af7e49d84c1739ce6778a8d305

Changelog: 

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.).

Changes against parent f53ace8239cc403b8c3b0f96ea236cdf2eb3f123

  patched  libpurple/dbus-server.c

-------------- next part --------------
============================================================
--- libpurple/dbus-server.c	0168f367b22b5bff105889e0a983839bad2dc9b2
+++ libpurple/dbus-server.c	2ff849e4ac845960ecde182f1ae7ebd46ae3f06b
@@ -848,7 +848,6 @@ purple_gdbus_init(void)
 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 @@ purple_gdbus_init(void)
 		/* 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