/srv/mercurial-server/detachablepurple: da17e07c654f: D-Busified...

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


Changeset: da17e07c654f3b6e86dc3e139f9b0ab98049539e
Author:	 Gilles Bedel <gillux at cpw.pidgin.im>
Date:	 2012-05-20 16:11 +0000
Branch:	 cpw.gillux.detachablepurple
URL: http://hg.pidgin.im/srv/mercurial-server/detachablepurple/rev/da17e07c654f

Description:

D-Busified PurpleBlistNode, so that we could have the whole buddy list
tree exported as-is. Note that previously, we did not do this; we
only loaded the buddy list by creating group/contact/buddy/chat objects.
But that wasn't a good strategy, because we also need to keep track of
any change in the buddy list, and let the user change it arbitrarily.

diffstat:

 libpurple/blist-node.c        |   3 +++
 libpurple/dbus/blist-node.c   |  37 +++++++++++++++++++++++++++++++++++++
 libpurple/dbus/blist-node.h   |  41 +++++++++++++++++++++++++++++++++++++++++
 libpurple/dbus/blist-node.xml |   9 +++++++++
 4 files changed, 90 insertions(+), 0 deletions(-)

diffs (122 lines):

diff --git a/libpurple/blist-node.c b/libpurple/blist-node.c
--- a/libpurple/blist-node.c
+++ b/libpurple/blist-node.c
@@ -24,6 +24,7 @@
 
 #include "internal.h"
 #include "blist-node.h"
+#include "dbus/blist-node.h"
 #include "dbus-maybe.h"
 #include "debug.h"
 #include "server.h"
@@ -893,6 +894,8 @@
 			purple_smarshal_VOID__OBJECT_OBJECT,
 			G_TYPE_NONE,
 			2, PURPLE_TYPE_BLIST_NODE, PURPLE_TYPE_BLIST_NODE);	/* New parent, Old parent */
+
+	purple_blist_node_class_dbus_init(klass);
 }
 
 static void
diff --git a/libpurple/dbus/blist-node.c b/libpurple/dbus/blist-node.c
new file mode 100644
--- /dev/null
+++ b/libpurple/dbus/blist-node.c
@@ -0,0 +1,37 @@
+/* purple
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ */
+
+#include "internal.h"
+#include "dbus/blist-node.h"
+#include "dbus/blist-node.xml.h"
+#include "pobject.h"
+
+void
+purple_blist_node_class_dbus_init(PurpleBlistNodeClass *klass)
+{
+	PurpleObjectClass *pobjclass = PURPLE_OBJECT_CLASS(klass);
+
+	/* Register our interface. */
+	purple_object_class_register_dbus_iface
+	  (pobjclass, PURPLE_TYPE_BLIST_NODE,
+	   &purple_blist_node_interface_info);
+}
+
diff --git a/libpurple/dbus/blist-node.h b/libpurple/dbus/blist-node.h
new file mode 100644
--- /dev/null
+++ b/libpurple/dbus/blist-node.h
@@ -0,0 +1,41 @@
+/* purple
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ */
+#ifndef _PURPLE_DBUS_BLIST_NODE_H
+#define _PURPLE_DBUS_BLIST_NODE_H
+
+#ifdef HAVE_DBUS
+
+G_BEGIN_DECLS
+
+/**
+ * Initialize the dbus data of the blist-node class.
+ */
+void purple_blist_node_class_dbus_init(PurpleBlistNodeClass *klass);
+
+G_END_DECLS
+
+#else /* !HAVE_DBUS */
+
+#define purple_blist_node_class_dbus_init(klass)                 ((void)0)
+
+#endif /* HAVE_DBUS */
+#endif /* _PURPLE_DBUS_BLIST_NODE_H */
+
diff --git a/libpurple/dbus/blist-node.xml b/libpurple/dbus/blist-node.xml
new file mode 100644
--- /dev/null
+++ b/libpurple/dbus/blist-node.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node>
+	<interface name="im.pidgin.purple.blistnode">
+		<property type="o" name="prev"   access="read" />
+		<property type="o" name="next"   access="read" />
+		<property type="o" name="parent" access="read" />
+		<property type="o" name="child"  access="read" />
+	</interface>
+</node>



More information about the Commits mailing list