soc.2010.detachablepurple: cf5d7f1c: In the purple_account_unregister() dbus ...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Thu Jul 29 02:01:52 EDT 2010


----------------------------------------------------------------------
Revision: cf5d7f1c946b110205472373537c16d20abd3491
Parent:   c46f30ffc5a3a722ca9f7d399a0cabb68b5967fa
Author:   gillux at soc.pidgin.im
Date:     07/28/10 20:31:31
Branch:   im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/cf5d7f1c946b110205472373537c16d20abd3491

Changelog: 

In the purple_account_unregister() dbus wrapper, added support for not
giving a callback.

Changes against parent c46f30ffc5a3a722ca9f7d399a0cabb68b5967fa

  patched  libpurple/account-dbus.c
  patched  libpurple/dbus-prototypes/account.xml

-------------- next part --------------
============================================================
--- libpurple/account-dbus.c	7a38d6c8e83004ae19e5803da4ee9f2155e1bea9
+++ libpurple/account-dbus.c	0534fb83a25d7693101ed915d8a7fa6dd5bc1bfe
@@ -126,29 +126,38 @@ purple_account_unregister_RPC(PurpleAcco
 	DBusGProxy* proxy;
 	GError *error = NULL;
 	guint64 callback_id;
+	gboolean have_cb = (cb != NULL);
 	GClosure* closure;
 
 	proxy = purple_object_get_dbus_obj_proxy(PURPLE_OBJECT(account));
-	if (!im_pidgin_purple_account_unregister(proxy, &callback_id, &error)) {
+	if (!im_pidgin_purple_account_unregister(proxy, have_cb, &callback_id, &error)) {
 		PURPLE_RPC_FAILED(purple_account_unregister, error);
 		return;
 	}
 
-	closure = g_cclosure_new(G_CALLBACK(cb), user_data, NULL);
-	g_closure_set_marshal(closure, g_cclosure_marshal_VOID__BOOLEAN);
-	purple_dbus_callback_register(callback_id, closure);
+	if (have_cb) {
+		closure = g_cclosure_new(G_CALLBACK(cb), user_data, NULL);
+		g_closure_set_marshal(closure, g_cclosure_marshal_VOID__BOOLEAN);
+		purple_dbus_callback_register(callback_id, closure);
+	}
 }
 
 gboolean
-DBUS_purple_account_unregister(PurpleAccount *account, guint64 *callback_id, GError** error)
+DBUS_purple_account_unregister(PurpleAccount *account, gboolean have_callback, guint64 *callback_id, GError** error)
 {
-	guint64 *id = g_new0(guint64, 1);
+	PurpleAccountUnregistrationCb cb = NULL;
+	guint64 *id = NULL;
 
-	/* Generate a new callback id */
-	*callback_id = *id = purple_dbus_callback_new_id();
+	if (have_callback) {
+		/* Use a void(*cb)(GObject*, gboolean, void*) prototype */
+		cb = (PurpleAccountUnregistrationCb)purple_dbus_callback__b;
+		/* Generate a new callback id */
+		id = g_new0(guint64, 1);
+		*callback_id = *id = purple_dbus_callback_new_id();
+	}
 
-	/* Call the function with a wrapper callback */
-	purple_account_unregister(account, (PurpleAccountUnregistrationCb)purple_dbus_callback__b, id);
+	/* Call the function, perhabs with a wrapper callback */
+	purple_account_unregister(account, cb, id);
 	return TRUE;
 }
 
============================================================
--- libpurple/dbus-prototypes/account.xml	4de2b25b9e670df726f50a2f51c5b25a522bb25d
+++ libpurple/dbus-prototypes/account.xml	7f439e141a20e07c3040c55d1ea012bbc441b9f3
@@ -13,6 +13,7 @@
 		<method name="Connect" />
 		<method name="Register" />
 		<method name="Unregister">
+			<arg type="b"  name="have_callback" direction="in" />
 			<arg type="t"  name="callback_id" direction="out" />
 		</method>
 		<method name="SetStatusList">


More information about the Commits mailing list