soc.2010.detachablepurple: e071748c: Added an empty dbus exportation of the P...
gillux at soc.pidgin.im
gillux at soc.pidgin.im
Sun Aug 8 11:14:07 EDT 2010
----------------------------------------------------------------------
Revision: e071748c3c086a743a68ced010f2c62758c0219d
Parent: 8de0a5702d9532490588c4ff1d17bcdc2862eadc
Author: gillux at soc.pidgin.im
Date: 08/06/10 14:09:07
Branch: im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/e071748c3c086a743a68ced010f2c62758c0219d
Changelog:
Added an empty dbus exportation of the PurpleBuddyList object. This will be
used to export the purple_blist_*() functions and the PurpleBlistUiOps.
Changes against parent 8de0a5702d9532490588c4ff1d17bcdc2862eadc
added libpurple/dbus/blist.c
added libpurple/dbus/blist.h
added libpurple/dbus/blist.xml
patched libpurple/Makefile.am
patched libpurple/blist.c
patched libpurple/dbus-purple.h
-------------- next part --------------
============================================================
--- libpurple/blist.c 7909e99778f02790409f8bd400bf3ed6e85339a2
+++ libpurple/blist.c 0c7cecf3a031d32d341c9fc305964ff0f733a35c
@@ -26,6 +26,7 @@
#include "internal.h"
#include "accountlist.h"
#include "dbus-maybe.h"
+#include "dbus/blist.h"
#include "debug.h"
#include "gsignal.h"
#include "server.h"
@@ -1311,6 +1312,8 @@ purple_blist_init(void)
purple_blist_init(void)
{
purple_blist_get_list();
+ /* Create and expose the blist object */
+ purple_blist_init_dbus();
}
void
@@ -1319,6 +1322,9 @@ purple_blist_uninit(void)
PurpleBlistNode *node, *next_node;
PurpleBuddyList *list = PURPLE_BLIST;
+ /* Destroy the blist exposed object */
+ purple_blist_uninit_dbus();
+
if (list->save_timer != 0) {
purple_timeout_remove(list->save_timer);
list->save_timer = 0;
============================================================
--- libpurple/dbus-purple.h ae1c3dd20bdbc6fdfac57c114ebf2e52ae481a1c
+++ libpurple/dbus-purple.h f4acffc58b472dc4d7f507df50787008701ae4b3
@@ -32,6 +32,9 @@
#define DBUS_ACCOUNT_PATH "/im/pidgin/purple/account"
#define DBUS_ACCOUNT_INTERFACE "im.pidgin.purple.account"
+#define DBUS_BLIST_PATH "/im/pidgin/purple/blist"
+#define DBUS_BLIST_INTERFACE "im.pidgin.purple.blist"
+
#define DBUS_CONNECTION_PATH "/im/pidgin/purple/connection"
#define DBUS_CONNECTION_INTERFACE "im.pidgin.purple.connection"
============================================================
--- libpurple/Makefile.am 34c66c44ec65b6b9f0119e20916fcd536d411305
+++ libpurple/Makefile.am 31b0a421fdd742a80c6a90ae72a9cae805502bb0
@@ -208,6 +208,7 @@ purple_builtheaders = \
purple_builtheaders = \
purple.h version.h marshallers.h \
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/constructor-server.h dbus/constructor-client.h \
dbus/callback-server.h dbus/callback-client.h
@@ -239,6 +240,12 @@ dbus/account-client.h: dbus/account.xml
dbus/account-client.h: dbus/account.xml
$(AM_V_GEN)dbus-binding-tool --prefix=DBUS_purple_account --mode=glib-client --output=$@ $<
+dbus/blist-server.h: dbus/blist.xml
+ $(AM_V_GEN)dbus-binding-tool --prefix=DBUS_purple_blist --mode=glib-server --output=$@ $<
+
+dbus/blist-client.h: dbus/blist.xml
+ $(AM_V_GEN)dbus-binding-tool --prefix=DBUS_purple_blist --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=$@ $<
@@ -261,9 +268,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 dbus/account.c dbus/connection.c
+ dbus/constructor.c dbus/callback.c dbus/account.c dbus/connection.c dbus/blist.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 dbus/account.h dbus/connection.h
+ dbus/constructor.h dbus/callback.h dbus/account.h dbus/connection.h dbus/blist.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/dbus/blist.c 9b375eb3b2dabe6cc0d5c2d05be24f1bd780ae9f
@@ -0,0 +1,112 @@
+/*
+ * 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 "blist.h"
+#include "core.h"
+#include "dbus/blist.h"
+#include "dbus/blist-server.h"
+#include "dbus-purple.h"
+
+/**
+ * GObject definition of PurpleBListDBus.
+ *
+ * This object is used to provide the PurpleBuddyList related functions
+ * and uiops (the ones in libpurple/blist.h) over dbus. The PurpleBuddyList
+ * object itself doesn't need dbus-exposing, but it would take less memory if
+ * we could use it to do that. Sadly its gobject definition is not reachable
+ * from outside libpurple/blist.c.
+ */
+
+#define PURPLE_TYPE_BLIST_DBUS (purple_blist_dbus_get_type ())
+#define PURPLE_BLIST_DBUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PURPLE_TYPE_BLIST_DBUS, PurpleBListDBus))
+#define PURPLE_IS_BLIST_DBUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PURPLE_TYPE_BLIST_DBUS))
+#define PURPLE_BLIST_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_TYPE_BLIST_DBUS, PurpleBListDBusClass))
+#define PURPLE_IS_BLIST_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_TYPE_BLIST_DBUS))
+#define PURPLE_GET_BLIST_DBUS_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_TYPE_BLIST_DBUS, PurpleBListDBusClass))
+
+GType purple_blist_dbus_get_type(void);
+
+typedef struct {
+ PurpleObject parent;
+} PurpleBListDBus;
+
+typedef struct {
+ PurpleObjectClass parent;
+ PurpleBListDBus* instance;
+} PurpleBListDBusClass;
+
+G_DEFINE_TYPE(PurpleBListDBus, purple_blist_dbus, PURPLE_TYPE_OBJECT)
+
+static void
+purple_blist_dbus_init(PurpleBListDBus *self)
+{
+}
+
+static void
+purple_blist_dbus_class_init(PurpleBListDBusClass *klass)
+{
+ klass->instance = NULL;
+
+ if (purple_core_is_daemon_mode()) {
+ /* Install method introspection data */
+ purple_object_type_install_dbus_infos(PURPLE_TYPE_BLIST_DBUS,
+ &dbus_glib_DBUS_purple_blist_object_info);
+ }
+}
+
+static PurpleBListDBus *
+purple_blist_dbus_get_instance(void)
+{
+ PurpleBListDBusClass *klass;
+ PurpleBListDBus *instance;
+
+ klass = g_type_class_peek(PURPLE_TYPE_BLIST_DBUS);
+ if (!klass) {
+ instance = g_object_new(PURPLE_TYPE_BLIST_DBUS, NULL);
+ klass = g_type_class_peek(PURPLE_TYPE_BLIST_DBUS);
+ klass->instance = instance;
+
+ /* Register this object on DBus */
+ purple_object_install_dbus_infos(PURPLE_OBJECT(klass->instance),
+ DBUS_BLIST_INTERFACE,
+ DBUS_BLIST_PATH);
+ }
+ return klass->instance;
+}
+
+void
+purple_blist_init_dbus(void)
+{
+ purple_blist_dbus_get_instance();
+}
+
+void
+purple_blist_uninit_dbus(void)
+{
+ PurpleBListDBusClass *klass;
+
+ klass = g_type_class_peek(PURPLE_TYPE_BLIST_DBUS);
+ g_return_if_fail(klass->instance != NULL);
+ g_object_unref(klass->instance);
+}
============================================================
--- /dev/null
+++ libpurple/dbus/blist.h afaa5c56288ed2ee77903ce3b53b6e2658b2e411
@@ -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
+ *
+ */
+
+#ifdef HAVE_DBUS
+
+/**
+ * Creates and exports the PurpleBuddyList dbus equivalent singleton.
+ */
+void purple_blist_init_dbus(void);
+
+/**
+ * Destroys the PurpleBuddyList dbus equivalent singleton.
+ */
+void purple_blist_uninit_dbus(void);
+
+#else /* !HAVE_DBUS */
+
+#define purple_blist_init_dbus() ((void)0)
+#define purple_blist_uninit_dbus() ((void)0)
+
+#endif /* HAVE_DBUS */
============================================================
--- /dev/null
+++ libpurple/dbus/blist.xml 56900a2b6fe7f5483ad9d40112b3e034bc82cbb4
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/im/pidgin/purple/blist">
+ <interface name="im.pidgin.purple.blist">
+ </interface>
+</node>
More information about the Commits
mailing list