/srv/mercurial-server/detachablepurple: 9188a67025ca: Adapted Pu...

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


Changeset: 9188a67025caf37d1f4c7ee7b3ccad51ea977baf
Author:	 Gilles Bedel <gillux at cpw.pidgin.im>
Date:	 2011-05-19 20:05 +0000
Branch:	 cpw.gillux.detachablepurple
URL: http://hg.pidgin.im/srv/mercurial-server/detachablepurple/rev/9188a67025ca

Description:

Adapted PurpleAccount to use the new gdbus code.

diffstat:

 libpurple/account.c      |   2 +-
 libpurple/dbus/account.c |  30 ++++++++++++++++++++++++------
 2 files changed, 25 insertions(+), 7 deletions(-)

diffs (69 lines):

diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -755,7 +755,7 @@
 
 #warning TODO: Setup more signals
 
-	purple_account_class_dbus_init();
+	purple_account_class_dbus_init(klass);
 
 	g_type_class_add_private(klass, sizeof(PurpleAccountPrivate));
 }
diff --git a/libpurple/dbus/account.c b/libpurple/dbus/account.c
--- a/libpurple/dbus/account.c
+++ b/libpurple/dbus/account.c
@@ -30,6 +30,10 @@
 #include "marshallers.h"
 #include "nullmarshaller.h"
 
+/* move this, later */
+#include <gio/gio.h>
+#include "account.xml.h"
+
 /**
  * Callback, called when we receive a dbus "NotifyAdded" signal.
  */
@@ -154,12 +158,24 @@
 }
 
 void
-purple_account_class_dbus_init(void)
+purple_account_class_dbus_init(PurpleAccountClass *klass)
 {
+	PurpleObjectClass *pobjclass = PURPLE_OBJECT_CLASS(klass);
 	if (purple_core_is_daemon_mode()) {
-		/* Install method introspection data */
-		purple_object_type_install_dbus_infos(PURPLE_TYPE_ACCOUNT,
-				&dbus_glib_DBUS_purple_account_object_info);
+		pobjclass->dbus_ifaceinfo = &_purple_account_interface_info;
+		purple_object_bind_dbus_method(pobjclass, "Connect",
+		                               (GCallback)purple_account_connect);
+		purple_object_bind_dbus_method(pobjclass, "Disconnect",
+		                               (GCallback)purple_account_disconnect);
+		purple_object_bind_dbus_method(pobjclass, "Register",
+		                               (GCallback)purple_account_register);
+/* Those are more complicated, we will handle them later.
+		purple_object_bind_dbus_method(PURPLE_OBJECT_CLASS(klass),
+		                               "Unregister",
+		                               (GCallback)purple_account_unregister);
+		purple_object_bind_dbus_method(pobjclass, "SetStatusList",
+		                               (GCallback)purple_account_set_status_list);
+*/
 
 		g_signal_new("notify_added",
 		             PURPLE_TYPE_ACCOUNT,
@@ -204,9 +220,11 @@
 	char* dbus_path;
         DBusGProxy* proxy;
 
+	if (purple_core_is_daemon_mode())
+		purple_dbus_register_object(account);
+
 	dbus_path = purple_account_build_dbus_path(username, protocol_id);
-	purple_object_install_dbus_infos(PURPLE_OBJECT(account),
-					DBUS_ACCOUNT_INTERFACE, dbus_path);
+	purple_object_set_dbus_path(PURPLE_OBJECT(account), dbus_path);
 	g_free(dbus_path);	
 
 	if (purple_core_is_remote_mode() || purple_core_is_mirror_mode()) {



More information about the Commits mailing list