/srv/mercurial-server/detachablepurple: c670cf6118f5: Added the ...
Gilles Bedel
gillux at cpw.pidgin.im
Fri Jun 15 22:01:31 EDT 2012
Changeset: c670cf6118f5fc5139883178439039736581c268
Author: Gilles Bedel <gillux at cpw.pidgin.im>
Date: 2012-03-27 21:13 +0000
Branch: cpw.gillux.detachablepurple
URL: http://hg.pidgin.im/srv/mercurial-server/detachablepurple/rev/c670cf6118f5
Description:
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.
diffstat:
libpurple/pobject.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diffs (26 lines):
diff --git a/libpurple/pobject.c b/libpurple/pobject.c
--- a/libpurple/pobject.c
+++ b/libpurple/pobject.c
@@ -609,11 +609,21 @@
}
+/* 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