/srv/mercurial-server/detachablepurple: 7dcae5a30b33: Going mult...
Gilles Bedel
gillux at cpw.pidgin.im
Fri Jun 15 22:01:41 EDT 2012
Changeset: 7dcae5a30b33c52f930058c338da516c69ac2ede
Author: Gilles Bedel <gillux at cpw.pidgin.im>
Date: 2012-05-20 14:36 +0000
Branch: cpw.gillux.detachablepurple
URL: http://hg.pidgin.im/srv/mercurial-server/detachablepurple/rev/7dcae5a30b33
Description:
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.
diffstat:
libpurple/Makefile.am | 3 ++-
libpurple/dbus/pobject.xml | 10 ++++++++++
libpurple/pobject.c | 11 +++++++++++
3 files changed, 23 insertions(+), 1 deletions(-)
diffs (63 lines):
diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -215,7 +215,8 @@
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 \
diff --git a/libpurple/dbus/pobject.xml b/libpurple/dbus/pobject.xml
new file mode 100644
--- /dev/null
+++ b/libpurple/dbus/pobject.xml
@@ -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>
+
diff --git a/libpurple/pobject.c b/libpurple/pobject.c
--- a/libpurple/pobject.c
+++ b/libpurple/pobject.c
@@ -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;
+/* 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 @@
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
}
More information about the Commits
mailing list