/srv/mercurial-server/detachablepurple: fe742e6bfd3d: PurpleAcco...

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


Changeset: fe742e6bfd3d69648e76aa835cda3de75beb16a9
Author:	 Gilles Bedel <gillux at cpw.pidgin.im>
Date:	 2012-05-25 19:11 +0000
Branch:	 cpw.gillux.detachablepurple
URL: http://hg.pidgin.im/srv/mercurial-server/detachablepurple/rev/fe742e6bfd3d

Description:

PurpleAccount: cleaned up the remainings of the dbus-glib code.
The "NotifyAdded" and "RequestAdd" D-Bus signals do not need
wrapper functions anymore, so they are ready.

diffstat:

 libpurple/dbus/account.c   |  56 ++++++---------------------------------------
 libpurple/dbus/account.xml |   4 ---
 2 files changed, 8 insertions(+), 52 deletions(-)

diffs (98 lines):

diff --git a/libpurple/dbus/account.c b/libpurple/dbus/account.c
--- a/libpurple/dbus/account.c
+++ b/libpurple/dbus/account.c
@@ -22,11 +22,8 @@
 #include "internal.h"
 #include "account.h"
 #include "dbus/account.h"
-#include "dbus/account-client.h"
-#include "dbus/account-server.h"
 #include "dbus/callback.h"
 #include "dbus/constructor.h"
-#include "dbus/constructor-client.h"
 #include "dbus-maybe.h"
 #include "marshallers.h"
 #include "nullmarshaller.h"
@@ -35,29 +32,8 @@
 #include <gio/gio.h>
 #include "account.xml.h"
 
-/**
- * Callback, called when we receive a dbus "NotifyAdded" signal.
- */
-static void
-notify_added_cb(DBusGProxy *proxy, const char *remote_user, const char *id,
-                const char *alias, const char *message, gpointer data)
-{
-        PurpleAccount* account = PURPLE_ACCOUNT(
-                purple_dbus_get_gobject_by_path(dbus_g_proxy_get_path(proxy)));
-        purple_account_notify_added(account, remote_user, id, alias, message);
-}
-
-/**
- * Callback, called when we receive a dbus "RequestAdd" signal.
- */
-static void
-request_add_cb(DBusGProxy *proxy, const char *remote_user, const char *id,
-               const char *alias, const char *message, gpointer data)
-{
-        PurpleAccount* account = PURPLE_ACCOUNT(
-                purple_dbus_get_gobject_by_path(dbus_g_proxy_get_path(proxy)));
-        purple_account_request_add(account, remote_user, id, alias, message);
-}
+/* D-Bus methods and callbacks implementations. */
+static GVariant *account_unregister_cb(PurpleAccount *account, gboolean have_callback);
 
 /**
  * Callback called on the client when the user accepted an auth request.
@@ -207,30 +183,14 @@
 		purple_object_bind_dbus_method(pobjclass, "SetStatusList",
 		                               (GCallback)purple_account_set_status_list);
 */
-
-		g_signal_new("notify_added",
-		             PURPLE_TYPE_ACCOUNT,
-		             G_SIGNAL_RUN_LAST,
-		             0, NULL, NULL,
-		             purple_smarshal_VOID__STRING_STRING_STRING_STRING,
-		             G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING,
-		             G_TYPE_STRING, G_TYPE_STRING);
-		g_signal_new("request_add",
-		             PURPLE_TYPE_ACCOUNT,
-		             G_SIGNAL_RUN_LAST,
-		             0, NULL, NULL,
-		             purple_smarshal_VOID__STRING_STRING_STRING_STRING,
-		             G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING,
-		             G_TYPE_STRING, G_TYPE_STRING);
 	}
-	/* In remote mode we need to register the marshallers
-	 * we will use to receive the signals sent by the daemon */
 	else if (purple_core_is_remote_mode()) {
-		/* Marshaller for the NotifyAdded and RequestAdd dbus signals */
-		dbus_g_object_register_marshaller(
-			purple_smarshal_VOID__STRING_STRING_STRING_STRING,
-			G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING,
-			G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
+		purple_object_bind_dbus_callback
+		  (pobjclass, purple_account_interface_info.name,
+		   "NotifyAdded", (GCallback)purple_account_notify_added);
+		purple_object_bind_dbus_callback
+		  (pobjclass, purple_account_interface_info.name,
+		   "RequestAdd", (GCallback)purple_account_request_add);
 		purple_object_bind_dbus_callback
 		  (pobjclass, purple_account_interface_info.name,
 		   "RequestAuthorize", (GCallback)request_authorize_cb);
diff --git a/libpurple/dbus/account.xml b/libpurple/dbus/account.xml
--- a/libpurple/dbus/account.xml
+++ b/libpurple/dbus/account.xml
@@ -24,10 +24,6 @@
 			<arg type="av" name="attributes" direction="in" />
 		</method>
 
-		<signal name="DBusNotify">
-			<arg type="s" name="property-name" />
-			<arg type="v" name="property-value" />
-		</signal>
 		<signal name="NotifyAdded">
 			<arg type="s" name="remote_user" />
 			<arg type="s" name="id" />



More information about the Commits mailing list