soc.2010.detachablepurple: e472622e: Added exportation of the PurpleContact g...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Mon Aug 9 23:59:04 EDT 2010


----------------------------------------------------------------------
Revision: e472622e50534666f2f95b6759baec286cb1cfe1
Parent:   6781f4f21b515e717d0ba7a80e647a176f2c69a3
Author:   gillux at soc.pidgin.im
Date:     08/08/10 16:32:24
Branch:   im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/e472622e50534666f2f95b6759baec286cb1cfe1

Changelog: 

Added exportation of the PurpleContact gobjects, without methods (and without
properties, as there are no ones).

Changes against parent 6781f4f21b515e717d0ba7a80e647a176f2c69a3

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

-------------- next part --------------
============================================================
--- libpurple/dbus-purple.h	6fd14c0fd4d9e3184ac45b5371e11153ce5b28ea
+++ libpurple/dbus-purple.h	dd1a18d203d757b87bdbea550fbab466902ee259
@@ -38,6 +38,9 @@
 #define DBUS_CONNECTION_PATH      "/im/pidgin/purple/connection"
 #define DBUS_CONNECTION_INTERFACE "im.pidgin.purple.connection"
 
+#define DBUS_CONTACT_PATH      "/im/pidgin/purple/contact"
+#define DBUS_CONTACT_INTERFACE "im.pidgin.purple.contact"
+
 #define DBUS_GROUP_PATH      "/im/pidgin/purple/group"
 #define DBUS_GROUP_INTERFACE "im.pidgin.purple.group"
 
============================================================
--- libpurple/Makefile.am	ba682e30a3c53f714d797bdebdad094e10c69703
+++ libpurple/Makefile.am	e6d43fb62de10ff75226978f97107258ae1f77ee
@@ -210,6 +210,7 @@ purple_builtheaders = \
 	dbus/account-server.h dbus/account-client.h \
 	dbus/blist-server.h dbus/blist-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 \
 	dbus/constructor-server.h dbus/constructor-client.h \
 	dbus/callback-server.h dbus/callback-client.h
@@ -253,6 +254,12 @@ dbus/connection-client.h: dbus/connectio
 dbus/connection-client.h: dbus/connection.xml
 	$(AM_V_GEN)dbus-binding-tool --prefix=DBUS_purple_connection --mode=glib-client --output=$@ $<
 
+dbus/contact-server.h: dbus/contact.xml
+	$(AM_V_GEN)dbus-binding-tool --prefix=DBUS_purple_contact --mode=glib-server --output=$@ $<
+
+dbus/contact-client.h: dbus/contact.xml
+	$(AM_V_GEN)dbus-binding-tool --prefix=DBUS_purple_contact --mode=glib-client --output=$@ $<
+
 dbus/group-server.h: dbus/group.xml
 	$(AM_V_GEN)dbus-binding-tool --prefix=DBUS_purple_group --mode=glib-server --output=$@ $<
 
@@ -279,6 +286,7 @@ dbus_sources  = dbus-server.c dbus-usefu
 	dbus/callback.c \
 	dbus/account.c \
 	dbus/connection.c \
+	dbus/contact.c \
 	dbus/blist.c \
 	dbus/group.c
 
@@ -287,6 +295,7 @@ dbus_headers  = dbus-bindings.h dbus-pur
 	dbus/callback.h \
 	dbus/account.h \
 	dbus/connection.h \
+	dbus/contact.h \
 	dbus/blist.h \
 	dbus/group.h
 
============================================================
--- libpurple/contact.c	d67426f798f84484ccea0f14bf0e75f286fe2f93
+++ libpurple/contact.c	abeb6ea293d53e1d2c142de33fab1bbf28e5ca88
@@ -24,6 +24,7 @@
 
 #include "internal.h"
 #include "contact.h"
+#include "dbus/contact.h"
 #include "dbus-maybe.h"
 #include "debug.h"
 #include "server.h"
@@ -208,7 +209,12 @@ PurpleContact *purple_contact_new()
 
 PurpleContact *purple_contact_new()
 {
-	return g_object_new(PURPLE_TYPE_CONTACT, NULL);
+	PurpleContact *contact;
+
+	contact = g_object_new(PURPLE_TYPE_CONTACT, NULL);
+	purple_contact_dbus_init(contact);
+
+	return contact;
 }
 
 PurpleContact *purple_buddy_get_contact(PurpleBuddy *buddy)
@@ -505,6 +511,8 @@ purple_contact_class_init(PurpleContactC
 
 	parent_class = g_type_class_peek_parent(klass);
 	obj_class->finalize = purple_contact_finalize;
+
+	purple_contact_class_dbus_init();
 }
 
 static void
============================================================
--- /dev/null	
+++ libpurple/dbus/contact.c	614ec07718f37f8521a88ba94fd54a9955e47163
@@ -0,0 +1,66 @@
+/* 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 "contact.h"
+#include "dbus/contact.h"
+#include "dbus/contact-client.h"
+#include "dbus/contact-server.h"
+#include "dbus-purple.h"
+#include "dbus-server.h"
+
+static char *
+purple_contact_build_dbus_path(void)
+{
+	static unsigned int contact_id = 0;
+	gchar *path;
+	gchar *path_valid;
+
+	/* Contacts have nothing unique nor that identify themselves
+	 * at the time they are created. So we use a poor id. */
+	path = g_strdup_printf(DBUS_CONTACT_PATH "/%u", contact_id++);
+	path_valid = purple_dbus_sanitize_dbus_path(path);
+	g_free(path);
+
+	return path_valid;
+}
+
+void
+purple_contact_class_dbus_init(void)
+{
+	if (purple_core_is_daemon_mode()) {
+		/* Install method introspection data */
+		purple_object_type_install_dbus_infos(PURPLE_TYPE_CONTACT,
+				&dbus_glib_DBUS_purple_contact_object_info);
+	}
+}
+
+void
+purple_contact_dbus_init(PurpleContact *contact)
+{
+	char* dbus_path;
+
+	dbus_path = purple_contact_build_dbus_path();
+	purple_object_install_dbus_infos(PURPLE_OBJECT(contact),
+					DBUS_CONTACT_INTERFACE, dbus_path);
+	g_free(dbus_path);	
+}
============================================================
--- /dev/null	
+++ libpurple/dbus/contact.h	71fd0e789cc5a6d65906e3d1ddf7110507007eb2
@@ -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 contact class.
+ */
+void purple_contact_class_dbus_init(void);
+
+/**
+ * Initialize the dbus data of a new contact.
+ */
+void purple_contact_dbus_init(PurpleContact *contact);
+
+#else /* !HAVE_DBUS */
+
+#define purple_contact_class_dbus_init()                            ((void)0)
+#define purple_contact_dbus_init(contact)                           ((void)0)
+
+#endif /* HAVE_DBUS */
============================================================
--- /dev/null	
+++ libpurple/dbus/contact.xml	580a5b08c1e05f522a64ab932ec1d390dad56803
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/im/pidgin/purple/contact">
+	<interface name="im.pidgin.purple.contact">
+	</interface>
+</node>


More information about the Commits mailing list