soc.2010.detachablepurple: 6f75d5d3: Added basic exportation of the PurpleCon...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Wed Aug 4 07:39:12 EDT 2010


----------------------------------------------------------------------
Revision: 6f75d5d3f728e25c4167fbaba023c805cdbcfb90
Parent:   59aeba84859d27af961323b710a030e381e99988
Author:   gillux at soc.pidgin.im
Date:     08/01/10 20:30:46
Branch:   im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/6f75d5d3f728e25c4167fbaba023c805cdbcfb90

Changelog: 

Added basic exportation of the PurpleConnection gobjects. No properties,
methods of signals yet exported on the dbus bus, only an empty object.

Changes against parent 59aeba84859d27af961323b710a030e381e99988

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

-------------- next part --------------
============================================================
--- libpurple/connection.c	06957c17314cd959cb85243e576e3feca2e95b65
+++ libpurple/connection.c	b3d849f0b4dbe1559156a763c723ea2d8f3e1542
@@ -29,6 +29,7 @@
 #include "account.h"
 #include "blist.h"
 #include "connection.h"
+#include "connection-dbus.h"
 #include "dbus-maybe.h"
 #include "debug.h"
 #include "log.h"
@@ -219,6 +220,7 @@ _purple_connection_new(PurpleAccount *ac
 
 	gc = g_object_new(PURPLE_TYPE_CONNECTION, "account", account, NULL);
 	PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection);
+	purple_connection_dbus_init(gc, account);
 
 	priv = PURPLE_CONNECTION_GET_PRIVATE(gc);
 
@@ -1063,6 +1065,8 @@ purple_connection_class_init(PurpleConne
 					 G_TYPE_NONE,
 					 0);
 
+	/* Install dbus stuff */
+	purple_connection_class_dbus_init();
 }
 
 /******************************************************************************
============================================================
--- libpurple/dbus-purple.h	9272bd6c1ec2a64164d7bd5bf4ae9ad6a88b1cd1
+++ libpurple/dbus-purple.h	ae1c3dd20bdbc6fdfac57c114ebf2e52ae481a1c
@@ -32,6 +32,9 @@
 #define DBUS_ACCOUNT_PATH	"/im/pidgin/purple/account"
 #define DBUS_ACCOUNT_INTERFACE    "im.pidgin.purple.account"
 
+#define DBUS_CONNECTION_PATH      "/im/pidgin/purple/connection"
+#define DBUS_CONNECTION_INTERFACE "im.pidgin.purple.connection"
+
 #define DBUS_CONSTRUCTOR_PATH      "/im/pidgin/purple/constructor"
 #define DBUS_CONSTRUCTOR_INTERFACE "im.pidgin.purple.constructor"
 
============================================================
--- libpurple/Makefile.am	f9fdfd548e90d78c5c13208d85412bae326603e9
+++ libpurple/Makefile.am	d2add1d1dd5d96a1a5e75d2ecdefe5b1305ae13f
@@ -208,6 +208,7 @@ purple_builtheaders = \
 purple_builtheaders = \
 	purple.h version.h marshallers.h \
 	dbus-account-server.h dbus-account-client.h \
+	dbus-connection-server.h dbus-connection-client.h \
 	dbus-constructor-server.h dbus-constructor-client.h \
 	dbus-callback-server.h dbus-callback-client.h
 
@@ -238,6 +239,12 @@ dbus-account-client.h: dbus-prototypes/a
 dbus-account-client.h: dbus-prototypes/account.xml
 	$(AM_V_GEN)dbus-binding-tool --prefix=DBUS_purple_account --mode=glib-client --output=$@ $<
 
+dbus-connection-server.h: dbus-prototypes/connection.xml
+	$(AM_V_GEN)dbus-binding-tool --prefix=DBUS_purple_connection --mode=glib-server --output=$@ $<
+
+dbus-connection-client.h: dbus-prototypes/connection.xml
+	$(AM_V_GEN)dbus-binding-tool --prefix=DBUS_purple_connection --mode=glib-client --output=$@ $<
+
 CLEANFILES = \
 	dbus-bindings.c \
 	dbus-client-binding.c \
@@ -254,9 +261,9 @@ dbus_sources  = dbus-server.c dbus-usefu
 # purple dbus server
 
 dbus_sources  = dbus-server.c dbus-useful.c \
-	dbus-constructor.c dbus-callback.c account-dbus.c
+	dbus-constructor.c dbus-callback.c account-dbus.c connection-dbus.c
 dbus_headers  = dbus-bindings.h dbus-purple.h dbus-server.h dbus-useful.h dbus-define-api.h dbus-types.h \
-	dbus-constructor.h dbus-callback.h account-dbus.h
+	dbus-constructor.h dbus-callback.h account-dbus.h connection-dbus.h
 
 dbus_exported = dbus-useful.h dbus-define-api.h account.h accountlist.h blist.h buddyicon.h \
                 connection.h conversation.h core.h ft.h log.h notify.h prefs.h roomlist.h \
============================================================
--- /dev/null	
+++ libpurple/connection-dbus.c	294b739f0d9968a4df8f2ee665667f2877965f77
@@ -0,0 +1,67 @@
+/* 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 "connection-dbus.h"
+#include "core.h"
+#include "dbus-connection-client.h"
+#include "dbus-connection-server.h"
+#include "dbus-server.h"
+#include "dbus-purple.h"
+#include "pobject.h"
+
+static char*
+purple_connection_build_dbus_path(PurpleAccount *account)
+{
+	const char *proto;
+	const char *username;
+	gchar *path;
+	gchar *path_valid;
+
+	username = purple_account_get_username(account);
+	proto = purple_account_get_protocol_id(account);
+	path = g_strjoin("/", DBUS_CONNECTION_PATH, proto, username, NULL);
+	path_valid = purple_dbus_sanitize_dbus_path(path);
+	g_free(path);
+
+        return path_valid;
+}
+
+void
+purple_connection_class_dbus_init(void)
+{
+	if (purple_core_is_daemon_mode()) {
+		/* Install method introspection data */
+		purple_object_type_install_dbus_infos(PURPLE_TYPE_CONNECTION,
+		                &dbus_glib_DBUS_purple_connection_object_info);
+	}
+}
+
+void
+purple_connection_dbus_init(PurpleConnection *gc, PurpleAccount *account)
+{
+	char* dbus_path;
+
+	dbus_path = purple_connection_build_dbus_path(account);
+	purple_object_install_dbus_infos(PURPLE_OBJECT(gc),
+	                                 DBUS_CONNECTION_INTERFACE, dbus_path);
+	g_free(dbus_path);
+}
============================================================
--- /dev/null	
+++ libpurple/connection-dbus.h	52db8c215c0c2e93f6e08f9d24e16bb754346f82
@@ -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 connection class.
+ */
+void purple_connection_class_dbus_init(void);
+
+/**
+ * Initialize the dbus data of a new connection.
+ */
+void purple_connection_dbus_init(PurpleConnection *gc, PurpleAccount *account);
+
+#else /* !HAVE_DBUS */
+
+#define purple_connection_class_dbus_init()                 ((void)0)
+#define purple_connection_dbus_init(gc, account)            ((void)0)
+
+#endif /* HAVE_DBUS */
============================================================
--- /dev/null	
+++ libpurple/dbus-prototypes/connection.xml	332b8ba37658a54add9d8ca5ea79b6857254d48b
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/im/pidgin/purple/connection">
+	<interface name="im.pidgin.purple.connection">
+	</interface>
+</node>


More information about the Commits mailing list