[Telepathy-commits] [telepathy-gabble/master] Add a property getter for Requests.Channels
Simon McVittie
simon.mcvittie at collabora.co.uk
Mon Nov 3 11:20:39 PST 2008
20080725125624-53eee-7576c2677548d5c3c7ab428204bea5c2cf2f9254.gz
---
src/conn-requests.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++-
src/conn-requests.h | 3 ++
2 files changed, 56 insertions(+), 1 deletions(-)
diff --git a/src/conn-requests.c b/src/conn-requests.c
index 4667f66..96c9558 100644
--- a/src/conn-requests.c
+++ b/src/conn-requests.c
@@ -522,7 +522,59 @@ conn_requests_list_channels (TpSvcConnection *iface,
}
-/* The new Requests API (unimplemented) */
+/* The new Requests API */
+
+
+static void
+get_channel_details_foreach (TpChannelIface *chan,
+ gpointer data)
+{
+ GPtrArray *details = data;
+
+ g_ptr_array_add (details, get_channel_details (chan));
+}
+
+
+static GPtrArray *
+conn_requests_get_channel_details (GabbleConnection *self)
+{
+ GPtrArray *details = g_ptr_array_sized_new (self->channel_managers->len * 2);
+ guint i;
+
+ for (i = 0; i < self->channel_managers->len; i++)
+ {
+ TpChannelFactoryIface *factory = g_ptr_array_index
+ (self->channel_managers, i);
+
+ tp_channel_factory_iface_foreach (factory,
+ get_channel_details_foreach, details);
+ }
+
+ return details;
+}
+
+
+void
+gabble_conn_requests_get_dbus_property (GObject *object,
+ GQuark interface,
+ GQuark name,
+ GValue *value,
+ gpointer unused G_GNUC_UNUSED)
+{
+ GabbleConnection *self = GABBLE_CONNECTION (object);
+
+ g_return_if_fail (interface ==
+ GABBLE_IFACE_QUARK_CONNECTION_INTERFACE_REQUESTS);
+
+ if (name == g_quark_from_static_string ("Channels"))
+ {
+ g_value_take_boxed (value, conn_requests_get_channel_details (self));
+ }
+ else
+ {
+ g_return_if_reached ();
+ }
+}
static void
diff --git a/src/conn-requests.h b/src/conn-requests.h
index 9de6289..9ad51b8 100644
--- a/src/conn-requests.h
+++ b/src/conn-requests.h
@@ -27,6 +27,9 @@
G_BEGIN_DECLS
+void gabble_conn_requests_get_dbus_property (GObject *object,
+ GQuark interface, GQuark name, GValue *value, gpointer unused);
+
void gabble_conn_requests_init (GabbleConnection *self);
void gabble_conn_requests_dispose (GabbleConnection *self);
void gabble_conn_requests_iface_init (gpointer, gpointer);
--
1.5.6.5
More information about the Telepathy-commits
mailing list