soc.2010.detachablepurple: cf706f9c: Added exportation of PurpleChat gobjects...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Mon Aug 9 23:58:47 EDT 2010


----------------------------------------------------------------------
Revision: cf706f9c79b878a44fc6aa8af8a4a935af091757
Parent:   7c1aafef03bc2c6f9444e61b688f353c9a5bc9cb
Author:   gillux at soc.pidgin.im
Date:     08/08/10 23:06:19
Branch:   im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/cf706f9c79b878a44fc6aa8af8a4a935af091757

Changelog: 

Added exportation of PurpleChat gobjects, with properties and without methods.

Changes against parent 7c1aafef03bc2c6f9444e61b688f353c9a5bc9cb

  added    libpurple/dbus/chat.c
  added    libpurple/dbus/chat.h
  added    libpurple/dbus/chat.xml
  patched  libpurple/Makefile.am
  patched  libpurple/chat.c
  patched  libpurple/dbus-purple.h

-------------- next part --------------
============================================================
--- libpurple/dbus-purple.h	01198506582871dca3b684735daed5bfdd86b20c
+++ libpurple/dbus-purple.h	f7bfd5ba5dabefd7b472f221af3ed65267a9e1f1
@@ -38,6 +38,9 @@
 #define DBUS_BUDDY_PATH      "/im/pidgin/purple/buddy"
 #define DBUS_BUDDY_INTERFACE "im.pidgin.purple.buddy"
 
+#define DBUS_CHAT_PATH      "/im/pidgin/purple/chat"
+#define DBUS_CHAT_INTERFACE "im.pidgin.purple.chat"
+
 #define DBUS_CONNECTION_PATH      "/im/pidgin/purple/connection"
 #define DBUS_CONNECTION_INTERFACE "im.pidgin.purple.connection"
 
============================================================
--- libpurple/Makefile.am	337d503c340b6b75e49bd4872db5612764f42411
+++ libpurple/Makefile.am	92a4664fb4a5c030b93bb576f5e4d4eaa62b83a1
@@ -210,6 +210,7 @@ purple_builtheaders = \
 	dbus/account-server.h dbus/account-client.h \
 	dbus/blist-server.h dbus/blist-client.h \
 	dbus/buddy-server.h dbus/buddy-client.h \
+	dbus/chat-server.h dbus/chat-client.h \
 	dbus/connection-server.h dbus/connection-client.h \
 	dbus/contact-server.h dbus/contact-client.h \
 	dbus/group-server.h dbus/group-client.h \
@@ -255,6 +256,12 @@ dbus/buddy-client.h: dbus/buddy.xml
 dbus/buddy-client.h: dbus/buddy.xml
 	$(AM_V_GEN)dbus-binding-tool --prefix=DBUS_purple_buddy --mode=glib-client --output=$@ $<
 
+dbus/chat-server.h: dbus/chat.xml
+	$(AM_V_GEN)dbus-binding-tool --prefix=DBUS_purple_chat --mode=glib-server --output=$@ $<
+
+dbus/chat-client.h: dbus/chat.xml
+	$(AM_V_GEN)dbus-binding-tool --prefix=DBUS_purple_chat --mode=glib-client --output=$@ $<
+
 dbus/connection-server.h: dbus/connection.xml
 	$(AM_V_GEN)dbus-binding-tool --prefix=DBUS_purple_connection --mode=glib-server --output=$@ $<
 
@@ -293,6 +300,7 @@ dbus_sources  = dbus-server.c dbus-usefu
 	dbus/callback.c \
 	dbus/account.c \
 	dbus/buddy.c \
+	dbus/chat.c \
 	dbus/connection.c \
 	dbus/contact.c \
 	dbus/blist.c \
@@ -303,6 +311,7 @@ dbus_headers  = dbus-bindings.h dbus-pur
 	dbus/callback.h \
 	dbus/account.h \
 	dbus/buddy.h \
+	dbus/chat.h \
 	dbus/connection.h \
 	dbus/contact.h \
 	dbus/blist.h \
============================================================
--- libpurple/chat.c	1106a3433f241ae8e00d46138f6ca8cc6d0b4da9
+++ libpurple/chat.c	274f603e4a3909ff5d83da17a9af78497dc003af
@@ -28,6 +28,7 @@
 #include "signals.h"
 #include "xmlnode.h"
 #include "chat.h"
+#include "dbus/chat.h"
 #include "blist.h"
 
 #define PURPLE_CHAT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), PURPLE_TYPE_CHAT, PurpleChatPrivate))
@@ -155,6 +156,9 @@ void purple_chat_set_alias(PurpleChat *c
 	PurpleChatPrivate *priv;
 
 	g_return_if_fail(PURPLE_IS_CHAT(chat));
+
+	PURPLE_DBUS_REMOTELY_SET_PROP(chat, g_value_set_string, G_TYPE_STRING, PROP_ALIAS_S, alias);
+
 	priv = PURPLE_CHAT_GET_PRIVATE(chat);
 
 	if ((alias != NULL) && (*alias != '\0'))
@@ -299,6 +303,7 @@ PurpleChat *purple_chat_new(PurpleAccoun
 									PROP_ALIAS_S, alias, 
 									PROP_COMPONENTS_S, components,
 									NULL);
+	purple_chat_dbus_init(chat);
 	return chat;
 }
 
@@ -388,6 +393,8 @@ purple_chat_class_init(PurpleChatClass *
 				_("The components for the chat."),
 				G_PARAM_READABLE | G_PARAM_CONSTRUCT_ONLY)
 			);
+
+	purple_chat_class_dbus_init();
 }
 
 PurpleGroup *
============================================================
--- /dev/null	
+++ libpurple/dbus/chat.c	051bd7975ad5503c7fb6358e4c85d9c919ae7d67
@@ -0,0 +1,59 @@
+/* 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 "core.h"
+#include "chat.h"
+#include "dbus/chat.h"
+#include "dbus/chat-client.h"
+#include "dbus/chat-server.h"
+#include "dbus-purple.h"
+#include "dbus-server.h"
+
+static char *
+purple_chat_build_dbus_path(void)
+{
+	static unsigned int chat_id = 0;
+
+	/* There is nothing to identify chats but this internal id. */
+	return g_strdup_printf(DBUS_CHAT_PATH "/%u", chat_id++);
+}
+
+void
+purple_chat_class_dbus_init(void)
+{
+	if (purple_core_is_daemon_mode()) {
+		/* Install method introspection data */
+		purple_object_type_install_dbus_infos(PURPLE_TYPE_CHAT,
+				&dbus_glib_DBUS_purple_chat_object_info);
+	}
+}
+
+void
+purple_chat_dbus_init(PurpleChat *chat)
+{
+	char* dbus_path;
+
+	dbus_path = purple_chat_build_dbus_path();
+	purple_object_install_dbus_infos(PURPLE_OBJECT(chat),
+	                                 DBUS_CHAT_INTERFACE, dbus_path);
+	g_free(dbus_path);	
+}
============================================================
--- /dev/null	
+++ libpurple/dbus/chat.h	d89ed3fdb02380f2ded98e15081c9846a8700c0e
@@ -0,0 +1,39 @@
+/* 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
+ */
+
+#ifdef HAVE_DBUS
+
+/**
+ * Initialize the dbus data of the chat class.
+ */
+void purple_chat_class_dbus_init(void);
+
+/**
+ * Initialize the dbus data of a new chat.
+ */
+void purple_chat_dbus_init(PurpleChat *chat);
+
+#else /* !HAVE_DBUS */
+
+#define purple_chat_class_dbus_init()                            ((void)0)
+#define purple_chat_dbus_init(chat)                              ((void)0)
+
+#endif /* HAVE_DBUS */
============================================================
--- /dev/null	
+++ libpurple/dbus/chat.xml	36de0ba71048c96bdde48eeda401f7892f4abf3a
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/im/pidgin/purple/chat">
+	<interface name="im.pidgin.purple.chat">
+		<property type="a{ss}" name="components" access="read" />
+		<property type="s"     name="alias"      access="readwrite" />
+	</interface>
+</node>


More information about the Commits mailing list