cpw.gillux.detachablepurple: 0adfd627: Going multi-interface. Added a D-Bus int...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Sun May 20 13:20:54 EDT 2012


----------------------------------------------------------------------
Revision: 0adfd627cdf14b6bb6102de3dd58f591ff109543
Parent:   70e50cdc3d778baf886cf633f13aa6608330fbcb
Author:   gillux at soc.pidgin.im
Date:     05/20/12 10:36:22
Branch:   im.pidgin.cpw.gillux.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/0adfd627cdf14b6bb6102de3dd58f591ff109543

Changelog: 

Going multi-interface. Added a D-Bus interface for PurpleObjects,
that handle the "PropertyChanged" D-Bus signal. This way, every
child class of PurpleObject will always export this interface.

Changes against parent 70e50cdc3d778baf886cf633f13aa6608330fbcb

  added    libpurple/dbus/pobject.xml
  patched  libpurple/Makefile.am
  patched  libpurple/pobject.c

-------------- next part --------------
============================================================
--- libpurple/Makefile.am	7ffa75dbdf1c225955adcf330e6fe6cfd9277a45
+++ libpurple/Makefile.am	05b6a31d9610885ec791e09ddf3a01cba1621ddf
@@ -215,7 +215,8 @@ purple_builtheaders = \
 	dbus/connection.xml.h \
 	dbus/constructor.xml.h \
 	dbus/contact.xml.h \
-	dbus/group.xml.h
+	dbus/group.xml.h \
+	dbus/pobject.xml.h
 
 purple_enumheaders = \
 	account.h \
============================================================
--- libpurple/pobject.c	9cea83784ec00ea8cc258f39024c0ea24d7108b3
+++ libpurple/pobject.c	477c4b6caae28b2a8b27e19712adc0bccd0ac637
@@ -26,6 +26,7 @@
 #include "dbus-maybe.h"
 #include "marshallers.h"
 #include "pobject.h"
+#include "dbus/pobject.xml.h"
 
 #include "glib-2.30.h"
 
@@ -80,6 +81,9 @@ static GObjectClass *parent_class;
 
 static GObjectClass *parent_class;
 
+/* D-Bus signal handlers. */
+static void purple_object_dbus_prop_changed(PurpleObject *pobj, const char *prop_name, GVariant *prop_value);
+
 static void
 purple_object_dispose(GObject *obj)
 {
@@ -222,6 +226,13 @@ purple_object_class_init(PurpleObjectCla
 		klass->on_dbus_connected = purple_object_generic_dbus_register_object;
 	else if (purple_core_is_remote_mode())
 		klass->on_dbus_connected = purple_object_generic_dbus_signal_subscribe;
+
+	purple_object_class_register_dbus_iface(klass, PURPLE_TYPE_OBJECT,
+	                                        &purple_object_interface_info);
+	if (purple_core_is_remote_mode())
+		purple_object_bind_dbus_callback
+		  (klass, purple_object_interface_info.name, "PropertyChanged",
+		   G_CALLBACK(purple_object_dbus_prop_changed));
 #endif
 }
 
============================================================
--- /dev/null	
+++ libpurple/dbus/pobject.xml	cd5afe959ea193f8995143b68ae0c4104bdaa2bc
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node>
+	<interface name="im.pidgin.purple.object">
+		<signal name="PropertyChanged">
+			<arg type="s" name="property-name" />
+			<arg type="v" name="property-value" />
+		</signal>
+	</interface>
+</node>
+


More information about the Commits mailing list