cpw.gillux.detachablepurple: 0f0b51f1: Added the simple yet important code that...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Tue Mar 27 17:25:51 EDT 2012


----------------------------------------------------------------------
Revision: 0f0b51f1968aeec1ea7061d50fa0a39a183bf557
Parent:   c412b9258c64846d33a3884684310a9c4a63e10d
Author:   gillux at soc.pidgin.im
Date:     03/27/12 17:13:13
Branch:   im.pidgin.cpw.gillux.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/0f0b51f1968aeec1ea7061d50fa0a39a183bf557

Changelog: 

Added the simple yet important code that make every PurpleObject
to handle the receipt of a PropertyChanged signal. A simple call
to purple_object_dbus_bind_notify() in client context will make
the object to automatically set its exported properties (i.e.
defined in the XML file) according to the PropertyChanged signals
it receives.

Changes against parent c412b9258c64846d33a3884684310a9c4a63e10d

  patched  libpurple/pobject.c

-------------- next part --------------
============================================================
--- libpurple/pobject.c	ff4c2ec108882cc688ab8596665158333fb2ef0d
+++ libpurple/pobject.c	3574249bcdf57f7b38c5b5c45916470719df0bf3
@@ -609,11 +609,21 @@ purple_object_install_dbus_infos(PurpleO
 
 }
 
+/* Handles receipt of PropertyChanged D-Bus signals. */
+static void
+purple_object_dbus_prop_changed(PurpleObject *pobj, const char *prop_name, GVariant *prop_value)
+{
+	if (!purple_object_set_dbus_property(pobj, prop_name, prop_value))
+		purple_debug_warning("dbus", "Ignored a PropertyChanged signal about a property we don't care: %s\n", prop_name);
+}
+
 void
 purple_object_dbus_bind_notify(PurpleObject *pobj)
 {
 	if (purple_core_is_remote_mode() || purple_core_is_mirror_mode()) {
-		/* TODO */	
+		purple_object_bind_dbus_callback
+		  (PURPLE_OBJECT_GET_CLASS(pobj), "PropertyChanged",
+		   G_CALLBACK(purple_object_dbus_prop_changed));
 	} else if (purple_core_is_daemon_mode())
 		g_signal_connect(pobj, "notify",
 		                 G_CALLBACK(purple_object_forward_notify_cb),


More information about the Commits mailing list