/srv/mercurial-server/detachablepurple: d69aa126e270: Going mult...

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


Changeset: d69aa126e27097dfb2e88916aceaa46cd076ea5e
Author:	 Gilles Bedel <gillux at cpw.pidgin.im>
Date:	 2012-05-20 14:55 +0000
Branch:	 cpw.gillux.detachablepurple
URL: http://hg.pidgin.im/srv/mercurial-server/detachablepurple/rev/d69aa126e270

Description:

Going multi-interface, adapted PurpleAccount, PurpleConnection
and PurpleConstructor accordingly.

diffstat:

 libpurple/dbus/account.c     |  15 +++++++++------
 libpurple/dbus/connection.c  |   7 ++++---
 libpurple/dbus/constructor.c |  19 ++++++++++++-------
 3 files changed, 25 insertions(+), 16 deletions(-)

diffs (85 lines):

diff --git a/libpurple/dbus/account.c b/libpurple/dbus/account.c
--- a/libpurple/dbus/account.c
+++ b/libpurple/dbus/account.c
@@ -193,12 +193,15 @@
 	pobjclass->dbus_init = purple_account_dbus_init;
 	if (purple_core_is_daemon_mode()) {
 		pobjclass->build_dbus_path = purple_account_build_dbus_path;
-		purple_object_bind_dbus_callback(pobjclass, "Connect",
-		                                 (GCallback)purple_account_connect);
-		purple_object_bind_dbus_callback(pobjclass, "Disconnect",
-		                                 (GCallback)purple_account_disconnect);
-		purple_object_bind_dbus_callback(pobjclass, "Register",
-		                                 (GCallback)purple_account_register);
+		purple_object_bind_dbus_callback
+		  (pobjclass, purple_account_interface_info.name,
+		   "Connect", (GCallback)purple_account_connect);
+		purple_object_bind_dbus_callback
+		  (pobjclass, purple_account_interface_info.name,
+		   "Disconnect", (GCallback)purple_account_disconnect);
+		purple_object_bind_dbus_callback
+		  (pobjclass, purple_account_interface_info.name,
+		   "Register", (GCallback)purple_account_register);
 /* Those are more complicated, we will handle them later.
 		purple_object_bind_dbus_method(PURPLE_OBJECT_CLASS(klass),
 		                               "Unregister",
diff --git a/libpurple/dbus/connection.c b/libpurple/dbus/connection.c
--- a/libpurple/dbus/connection.c
+++ b/libpurple/dbus/connection.c
@@ -55,8 +55,6 @@
 
 	/* Publish/listen for the object on the bus. */
 	purple_dbus_connect_object(gc);
-	/* Keep the properties synchronized between client and daemon. */
-	purple_object_dbus_bind_notify(pobject);
 
 	if (purple_core_is_daemon_mode()) {
 		/* Tell the clients about this new account. */
@@ -69,7 +67,10 @@
 {
 	PurpleObjectClass *pobjclass = PURPLE_OBJECT_CLASS(klass);
 
-	pobjclass->dbus_ifaceinfo = &purple_connection_interface_info;
+	/* Register our interface. */
+	purple_object_class_register_dbus_iface
+	  (pobjclass, PURPLE_TYPE_CONNECTION,
+	   &purple_connection_interface_info);
 	pobjclass->dbus_init = purple_connection_dbus_init;
 	if (purple_core_is_daemon_mode()) {
 		/* Only the daemon shall build path names,
diff --git a/libpurple/dbus/constructor.c b/libpurple/dbus/constructor.c
--- a/libpurple/dbus/constructor.c
+++ b/libpurple/dbus/constructor.c
@@ -80,20 +80,25 @@
 {
 	PurpleObjectClass *pobjclass = PURPLE_OBJECT_CLASS(klass);
 
-	pobjclass->dbus_ifaceinfo = &purple_constructor_interface_info;
+	/* Register our interface. */
+	purple_object_class_register_dbus_iface(pobjclass, PURPLE_TYPE_CONSTRUCTOR,
+	                                        &purple_constructor_interface_info);
 	/* Both client and daemon can build this well-known name. */
 	pobjclass->build_dbus_path = purple_constructor_build_dbus_path;
 	if (purple_core_is_daemon_mode()) {
 		/* D-Bus method handlers. */
-		purple_object_bind_dbus_callback(pobjclass, "GetAllAccounts",
-		                                 (GCallback)purple_constructor_get_all_accounts);
-		purple_object_bind_dbus_callback(pobjclass, "NewAccount",
-		                                 (GCallback)purple_constructor_new_account);
+		purple_object_bind_dbus_callback
+		  (pobjclass, purple_constructor_interface_info.name,
+		   "GetAllAccounts", (GCallback)purple_constructor_get_all_accounts);
+		purple_object_bind_dbus_callback
+		  (pobjclass, purple_constructor_interface_info.name,
+		   "NewAccount", (GCallback)purple_constructor_new_account);
 	}
 	else if (purple_core_is_remote_mode()) {
 		/* D-Bus signal handlers. */
-		purple_object_bind_dbus_callback(pobjclass, "PurpleObjectCreated",
-		                                 (GCallback)purple_constructor_pobj_created);
+		purple_object_bind_dbus_callback
+		  (pobjclass, purple_constructor_interface_info.name,
+		   "PurpleObjectCreated", (GCallback)purple_constructor_pobj_created);
 	}
 }
 



More information about the Commits mailing list