[telepathy-glib/master] Add channel dispatcher generated code and a very basic proxy

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Jun 9 01:25:39 PDT 2009


---
 docs/reference/telepathy-glib-docs.sgml            |    2 +
 docs/reference/telepathy-glib-sections.txt         |   76 +++++++++++
 docs/reference/telepathy-glib.types                |    5 +
 spec/Channel_Dispatcher.xml                        |    3 +-
 ...Channel_Dispatcher_Interface_Operation_List.xml |    3 +-
 telepathy-glib/Makefile.am                         |   11 ++
 telepathy-glib/channel-dispatcher.c                |  141 ++++++++++++++++++++
 telepathy-glib/channel-dispatcher.h                |   73 ++++++++++
 telepathy-glib/channel-dispatcher.xml              |   10 ++
 telepathy-glib/debug-internal.h                    |    3 +-
 telepathy-glib/debug.c                             |    1 +
 telepathy-glib/defs.h                              |   14 ++
 telepathy-glib/extra-gtkdoc.h                      |   17 +++
 telepathy-glib/stable-interfaces.xml               |    2 +
 telepathy-glib/svc-channel-dispatcher.h            |    6 +
 tests/dbus/Makefile.am                             |    3 +
 tests/dbus/channel-dispatcher.c                    |   70 ++++++++++
 17 files changed, 435 insertions(+), 5 deletions(-)
 create mode 100644 telepathy-glib/channel-dispatcher.c
 create mode 100644 telepathy-glib/channel-dispatcher.h
 create mode 100644 telepathy-glib/channel-dispatcher.xml
 create mode 100644 telepathy-glib/svc-channel-dispatcher.h
 create mode 100644 tests/dbus/channel-dispatcher.c

diff --git a/docs/reference/telepathy-glib-docs.sgml b/docs/reference/telepathy-glib-docs.sgml
index 80410f1..48260d1 100644
--- a/docs/reference/telepathy-glib-docs.sgml
+++ b/docs/reference/telepathy-glib-docs.sgml
@@ -48,6 +48,7 @@
     <xi:include href="xml/media-interfaces.xml"/>
     <xi:include href="xml/account-manager.xml"/>
     <xi:include href="xml/account.xml"/>
+    <xi:include href="xml/channel-dispatcher.xml"/>
   </chapter>
 
   <chapter id="ch-service-dbus">
@@ -68,6 +69,7 @@
     <xi:include href="xml/svc-connection-manager.xml"/>
     <xi:include href="xml/svc-account-manager.xml"/>
     <xi:include href="xml/svc-account.xml"/>
+    <xi:include href="xml/svc-channel-dispatcher.xml"/>
   </chapter>
   <chapter id="ch-service-base">
     <title>Service-side implementation</title>
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 5147a61..11ba907 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -25,6 +25,8 @@ TP_CONN_OBJECT_PATH_BASE
 TP_ACCOUNT_MANAGER_BUS_NAME
 TP_ACCOUNT_MANAGER_OBJECT_PATH
 TP_ACCOUNT_OBJECT_PATH_BASE
+TP_CHANNEL_DISPATCHER_BUS_NAME
+TP_CHANNEL_DISPATCHER_OBJECT_PATH
 </SECTION>
 
 <SECTION>
@@ -1166,6 +1168,10 @@ TP_STRUCT_TYPE_ROOM_INFO
 <SUBSECTION>
 # Account and AM
 TP_STRUCT_TYPE_AVATAR
+<SUBSECTION>
+# CD, CDO and CR
+TP_STRUCT_TYPE_DISPATCH_OPERATION_DETAILS
+TP_ARRAY_TYPE_DISPATCH_OPERATION_DETAILS_LIST
 <SUBSECTION Private>
 tp_type_dbus_array_a_7bsv_7das
 tp_type_dbus_array_oa_7bsv_7d
@@ -1930,6 +1936,10 @@ TP_IFACE_CHANNEL_INTERFACE_MEDIA_SIGNALLING
 TP_IFACE_QUARK_CHANNEL_INTERFACE_MEDIA_SIGNALLING
 TP_IFACE_CHANNEL_INTERFACE_MESSAGES
 TP_IFACE_QUARK_CHANNEL_INTERFACE_MESSAGES
+TP_IFACE_CHANNEL_DISPATCHER
+TP_IFACE_QUARK_CHANNEL_DISPATCHER
+TP_IFACE_CHANNEL_DISPATCHER_INTERFACE_OPERATION_LIST
+TP_IFACE_QUARK_CHANNEL_DISPATCHER_INTERFACE_OPERATION_LIST
 TP_IFACE_MEDIA_SESSION_HANDLER
 TP_IFACE_QUARK_MEDIA_SESSION_HANDLER
 TP_IFACE_MEDIA_STREAM_HANDLER
@@ -1961,6 +1971,8 @@ tp_iface_quark_channel_type_tubes
 tp_iface_quark_channel_interface_tube
 tp_iface_quark_channel_type_dbus_tube
 tp_iface_quark_channel_type_stream_tube
+tp_iface_quark_channel_dispatcher
+tp_iface_quark_channel_dispatcher_interface_operation_list
 tp_iface_quark_connection
 tp_iface_quark_connection_interface_aliasing
 tp_iface_quark_connection_interface_avatars
@@ -2931,3 +2943,67 @@ TpAccountManagerPrivate
 TpAccountManagerClassPrivate
 tp_cli_account_manager_run_create_account
 </SECTION>
+
+<SECTION>
+<FILE>channel-dispatcher</FILE>
+<INCLUDE>telepathy-glib/channel-dispatcher.h</INCLUDE>
+<TITLE>channel-dispatcher</TITLE>
+TpChannelDispatcher
+TpChannelDispatcherClass
+tp_channel_dispatcher_new
+<SUBSECTION>
+tp_cli_channel_dispatcher_callback_for_create_channel
+tp_cli_channel_dispatcher_call_create_channel
+tp_cli_channel_dispatcher_callback_for_ensure_channel
+tp_cli_channel_dispatcher_call_ensure_channel
+<SUBSECTION>
+tp_cli_channel_dispatcher_interface_operation_list_signal_callback_dispatch_operation_finished
+tp_cli_channel_dispatcher_interface_operation_list_connect_to_dispatch_operation_finished
+tp_cli_channel_dispatcher_interface_operation_list_signal_callback_new_dispatch_operation
+tp_cli_channel_dispatcher_interface_operation_list_connect_to_new_dispatch_operation
+<SUBSECTION Standard>
+TP_CHANNEL_DISPATCHER
+TP_IS_CHANNEL_DISPATCHER
+TP_IS_CHANNEL_DISPATCHER_CLASS
+TP_TYPE_CHANNEL_DISPATCHER
+tp_channel_dispatcher_get_type
+TP_CHANNEL_DISPATCHER_CLASS
+TP_CHANNEL_DISPATCHER_GET_CLASS
+TpChannelDispatcherPrivate
+TpChannelDispatcherClassPrivate
+<SUBSECTION Private>
+# leaving these undocumented as a step towards deprecating all _run_ methods
+# (these ones have never been documented)
+tp_cli_channel_dispatcher_run_create_channel
+tp_cli_channel_dispatcher_run_ensure_channel
+</SECTION>
+
+<SECTION>
+<FILE>svc-channel-dispatcher</FILE>
+<INCLUDE>telepathy-glib/svc-channel-dispatcher.h</INCLUDE>
+<TITLE>svc-channel-dispatcher</TITLE>
+TpSvcChannelDispatcher
+TpSvcChannelDispatcherClass
+tp_svc_channel_dispatcher_return_from_create_channel
+tp_svc_channel_dispatcher_create_channel_impl
+tp_svc_channel_dispatcher_implement_create_channel
+tp_svc_channel_dispatcher_return_from_ensure_channel
+tp_svc_channel_dispatcher_ensure_channel_impl
+tp_svc_channel_dispatcher_implement_ensure_channel
+<SUBSECTION>
+TpSvcChannelDispatcherInterfaceOperationList
+TpSvcChannelDispatcherInterfaceOperationListClass
+tp_svc_channel_dispatcher_interface_operation_list_emit_new_dispatch_operation
+tp_svc_channel_dispatcher_interface_operation_list_emit_dispatch_operation_finished
+<SUBSECTION Standard>
+TP_SVC_CHANNEL_DISPATCHER
+TP_SVC_CHANNEL_DISPATCHER_INTERFACE_OPERATION_LIST
+TP_IS_SVC_CHANNEL_DISPATCHER
+TP_IS_SVC_CHANNEL_DISPATCHER_INTERFACE_OPERATION_LIST
+TP_TYPE_SVC_CHANNEL_DISPATCHER
+TP_TYPE_SVC_CHANNEL_DISPATCHER_INTERFACE_OPERATION_LIST
+tp_svc_channel_dispatcher_get_type
+tp_svc_channel_dispatcher_interface_operation_list_get_type
+TP_SVC_CHANNEL_DISPATCHER_GET_CLASS
+TP_SVC_CHANNEL_DISPATCHER_INTERFACE_OPERATION_LIST_GET_CLASS
+</SECTION>
diff --git a/docs/reference/telepathy-glib.types b/docs/reference/telepathy-glib.types
index 5184ee1..47c5320 100644
--- a/docs/reference/telepathy-glib.types
+++ b/docs/reference/telepathy-glib.types
@@ -4,6 +4,7 @@
 #include <telepathy-glib/base-connection-manager.h>
 #include <telepathy-glib/channel-factory-iface.h>
 #include <telepathy-glib/channel.h>
+#include <telepathy-glib/channel-dispatcher.h>
 #include <telepathy-glib/channel-iface.h>
 #include <telepathy-glib/channel-manager.h>
 #include <telepathy-glib/connection.h>
@@ -18,6 +19,7 @@
 #include <telepathy-glib/svc-account.h>
 #include <telepathy-glib/svc-account-manager.h>
 #include <telepathy-glib/svc-channel.h>
+#include <telepathy-glib/svc-channel-dispatcher.h>
 #include <telepathy-glib/svc-connection.h>
 #include <telepathy-glib/svc-connection-manager.h>
 #include <telepathy-glib/svc-generic.h>
@@ -30,6 +32,7 @@ tp_base_connection_get_type
 tp_base_connection_manager_get_type
 tp_channel_factory_iface_get_type
 tp_channel_get_type
+tp_channel_dispatcher_get_type
 tp_channel_iface_get_type
 tp_channel_manager_get_type
 tp_connection_get_type
@@ -47,6 +50,8 @@ tp_svc_account_get_type
 tp_svc_account_interface_avatar_get_type
 tp_svc_account_manager_get_type
 tp_svc_channel_get_type
+tp_svc_channel_dispatcher_get_type
+tp_svc_channel_dispatcher_interface_operation_list_get_type
 tp_svc_channel_interface_call_state_get_type
 tp_svc_channel_interface_chat_state_get_type
 tp_svc_channel_interface_dtmf_get_type
diff --git a/spec/Channel_Dispatcher.xml b/spec/Channel_Dispatcher.xml
index 8680f6d..78be228 100644
--- a/spec/Channel_Dispatcher.xml
+++ b/spec/Channel_Dispatcher.xml
@@ -21,8 +21,7 @@
       USA.</p>
   </tp:license>
 
-  <interface name="org.freedesktop.Telepathy.ChannelDispatcher"
-    tp:causes-havoc="not yet final">
+  <interface name="org.freedesktop.Telepathy.ChannelDispatcher">
 
     <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
       <p>The channel dispatcher is responsible for responding to new
diff --git a/spec/Channel_Dispatcher_Interface_Operation_List.xml b/spec/Channel_Dispatcher_Interface_Operation_List.xml
index e3270ce..524ae0d 100644
--- a/spec/Channel_Dispatcher_Interface_Operation_List.xml
+++ b/spec/Channel_Dispatcher_Interface_Operation_List.xml
@@ -21,8 +21,7 @@
       USA.</p>
   </tp:license>
 
-  <interface name="org.freedesktop.Telepathy.ChannelDispatcher.Interface.OperationList"
-    tp:causes-havoc="not yet final">
+  <interface name="org.freedesktop.Telepathy.ChannelDispatcher.Interface.OperationList">
 
     <tp:requires interface="org.freedesktop.Telepathy.ChannelDispatcher"/>
 
diff --git a/telepathy-glib/Makefile.am b/telepathy-glib/Makefile.am
index d3ad8ef..29fd8ba 100644
--- a/telepathy-glib/Makefile.am
+++ b/telepathy-glib/Makefile.am
@@ -122,6 +122,7 @@ tpginclude_HEADERS = \
     base-connection-manager.h \
     channel.h \
     channel-iface.h \
+    channel-dispatcher.h \
     channel-factory-iface.h \
     channel-manager.h \
     connection.h \
@@ -173,6 +174,7 @@ nodist_libtelepathy_glib_internal_la_SOURCES = \
     _gen/tp-cli-account-body.h \
     _gen/tp-cli-account-manager-body.h \
     _gen/tp-cli-channel-body.h \
+    _gen/tp-cli-channel-dispatcher-body.h \
     _gen/tp-cli-connection-body.h \
     _gen/tp-cli-connection-manager-body.h \
     _gen/tp-cli-dbus-daemon-body.h \
@@ -182,6 +184,7 @@ nodist_libtelepathy_glib_internal_la_SOURCES = \
     _gen/tp-svc-account.c \
     _gen/tp-svc-account-manager.c \
     _gen/tp-svc-channel.c \
+    _gen/tp-svc-channel-dispatcher.c \
     _gen/tp-svc-connection.c \
     _gen/tp-svc-connection-manager.c \
     _gen/tp-svc-generic.c \
@@ -196,6 +199,7 @@ nodist_geninclude_HEADERS = \
     _gen/tp-cli-account.h \
     _gen/tp-cli-account-manager.h \
     _gen/tp-cli-channel.h \
+    _gen/tp-cli-channel-dispatcher.h \
     _gen/tp-cli-connection.h \
     _gen/tp-cli-connection-manager.h \
     _gen/tp-cli-dbus-daemon.h \
@@ -205,6 +209,7 @@ nodist_geninclude_HEADERS = \
     _gen/tp-svc-account.h \
     _gen/tp-svc-account-manager.h \
     _gen/tp-svc-channel.h \
+    _gen/tp-svc-channel-dispatcher.h \
     _gen/tp-svc-connection.h \
     _gen/tp-svc-connection-manager.h \
     _gen/tp-svc-generic.h \
@@ -240,6 +245,7 @@ libtelepathy_glib_internal_la_SOURCES = \
     channel.c \
     channel-group.c \
     channel-internal.h \
+    channel-dispatcher.c \
     channel-manager.c \
     connection.c \
     connection-internal.h \
@@ -394,6 +400,11 @@ _gen/tp-cli-%-body.h _gen/tp-cli-%.h: _gen/tp-spec-%.xml \
 			subclass_assert=--subclass-assert=TP_IS_CHANNEL; \
 			maybe_reentrant=--generate-reentrant; \
 			;; \
+		channel-dispatcher) \
+			subclass=--subclass=TpChannelDispatcher; \
+			subclass_assert=--subclass-assert=TP_IS_CHANNEL_DISPATCHER; \
+			maybe_reentrant=--generate-reentrant; \
+			;; \
 		connection-manager) \
 			subclass=--subclass=TpConnectionManager; \
 			subclass_assert=--subclass-assert=TP_IS_CONNECTION_MANAGER \
diff --git a/telepathy-glib/channel-dispatcher.c b/telepathy-glib/channel-dispatcher.c
new file mode 100644
index 0000000..7ec49d8
--- /dev/null
+++ b/telepathy-glib/channel-dispatcher.c
@@ -0,0 +1,141 @@
+/*
+ * channel-dispatcher.c - proxy for the Telepathy channel dispatcher
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "telepathy-glib/channel-dispatcher.h"
+
+#include <telepathy-glib/dbus.h>
+#include <telepathy-glib/defs.h>
+#include <telepathy-glib/errors.h>
+#include <telepathy-glib/interfaces.h>
+#include <telepathy-glib/proxy-subclass.h>
+
+#define DEBUG_FLAG TP_DEBUG_DISPATCHER
+#include "telepathy-glib/debug-internal.h"
+
+#include "telepathy-glib/_gen/tp-cli-channel-dispatcher-body.h"
+
+/**
+ * SECTION:channel-dispatcher
+ * @title: TpChannelDispatcher
+ * @short_description: proxy object for the Telepathy channel dispatcher
+ * @see_also: #TpChannelDispatchOperation, #TpChannelRequest
+ *
+ * The #TpChannelDispatcher object can be used to communicate with any
+ * implementation of the Telepathy ChannelDispatcher service to request
+ * new channels.
+ */
+
+/**
+ * TpChannelDispatcher:
+ *
+ * The Channel Dispatcher's main D-Bus API is used to request channels,
+ * which is done by calling tp_cli_channel_dispatcher_call_create_channel() or
+ * tp_cli_channel_dispatcher_call_ensure_channel() as appropriate.
+ *
+ * The Telepathy Channel Dispatcher is also responsible for responding to new
+ * channels and launching client processes to handle them. However, clients
+ * that can work with incoming channels do not have to call methods
+ * on the channel dispatcher: instead, they must register with the channel
+ * dispatcher passively, by taking a bus name starting with
+ * %TP_CLIENT_BUS_NAME_BASE and implementing the #TpSvcClient interface.
+ * See the Telepathy D-Bus Interface Specification for details.
+ *
+ * This proxy is usable but incomplete: convenience methods will be added in
+ * a later version of telepathy-glib, along with a mechanism similar to
+ * tp_connection_call_when_ready().
+ *
+ * Since: 0.7.UNRELEASED
+ */
+
+/**
+ * TpChannelDispatcherClass:
+ *
+ * The class of a #TpChannelDispatcher.
+ */
+
+struct _TpChannelDispatcherPrivate {
+    gpointer dummy;
+};
+
+G_DEFINE_TYPE (TpChannelDispatcher, tp_channel_dispatcher, TP_TYPE_PROXY);
+
+static void
+tp_channel_dispatcher_init (TpChannelDispatcher *self)
+{
+  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, TP_TYPE_CHANNEL_DISPATCHER,
+      TpChannelDispatcherPrivate);
+}
+
+static void
+tp_channel_dispatcher_constructed (GObject *object)
+{
+  TpChannelDispatcher *self = TP_CHANNEL_DISPATCHER (object);
+  void (*chain_up) (GObject *) =
+    ((GObjectClass *) tp_channel_dispatcher_parent_class)->constructed;
+
+  if (chain_up != NULL)
+    chain_up (object);
+
+  g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL);
+}
+
+static void
+tp_channel_dispatcher_class_init (TpChannelDispatcherClass *klass)
+{
+  GType tp_type = TP_TYPE_CHANNEL_DISPATCHER;
+  TpProxyClass *proxy_class = (TpProxyClass *) klass;
+  GObjectClass *object_class = (GObjectClass *) klass;
+
+  g_type_class_add_private (klass, sizeof (TpChannelDispatcherPrivate));
+
+  object_class->constructed = tp_channel_dispatcher_constructed;
+
+  proxy_class->interface = TP_IFACE_QUARK_CHANNEL_DISPATCHER;
+  tp_proxy_or_subclass_hook_on_interface_add (tp_type,
+      tp_cli_channel_dispatcher_add_signals);
+  tp_proxy_subclass_add_error_mapping (tp_type,
+      TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR);
+}
+
+/**
+ * tp_channel_dispatcher_new:
+ * @bus_daemon: Proxy for the D-Bus daemon
+ *
+ * Convenience function to create a new channel dispatcher proxy.
+ *
+ * Returns: a new reference to a channel dispatcher proxy
+ */
+TpChannelDispatcher *
+tp_channel_dispatcher_new (TpDBusDaemon *bus_daemon)
+{
+  TpChannelDispatcher *self;
+
+  g_return_val_if_fail (bus_daemon != NULL, NULL);
+
+  self = TP_CHANNEL_DISPATCHER (g_object_new (TP_TYPE_CHANNEL_DISPATCHER,
+        "dbus-daemon", bus_daemon,
+        "dbus-connection", ((TpProxy *) bus_daemon)->dbus_connection,
+        "bus-name", TP_CHANNEL_DISPATCHER_BUS_NAME,
+        "object-path", TP_CHANNEL_DISPATCHER_OBJECT_PATH,
+        NULL));
+
+  return self;
+}
diff --git a/telepathy-glib/channel-dispatcher.h b/telepathy-glib/channel-dispatcher.h
new file mode 100644
index 0000000..197cd18
--- /dev/null
+++ b/telepathy-glib/channel-dispatcher.h
@@ -0,0 +1,73 @@
+/*
+ * channel-dispatcher.h - proxy for the Telepathy channel dispatcher
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef TP_CHANNEL_DISPATCHER_H
+#define TP_CHANNEL_DISPATCHER_H
+
+#include <telepathy-glib/proxy.h>
+#include <telepathy-glib/dbus.h>
+
+G_BEGIN_DECLS
+
+
+typedef struct _TpChannelDispatcher TpChannelDispatcher;
+typedef struct _TpChannelDispatcherClass TpChannelDispatcherClass;
+typedef struct _TpChannelDispatcherPrivate TpChannelDispatcherPrivate;
+typedef struct _TpChannelDispatcherClassPrivate TpChannelDispatcherClassPrivate;
+
+struct _TpChannelDispatcher {
+    /*<private>*/
+    TpProxy parent;
+    TpChannelDispatcherPrivate *priv;
+};
+
+struct _TpChannelDispatcherClass {
+    /*<private>*/
+    TpProxyClass parent_class;
+    GCallback _padding[7];
+    TpChannelDispatcherClassPrivate *priv;
+};
+
+GType tp_channel_dispatcher_get_type (void);
+
+#define TP_TYPE_CHANNEL_DISPATCHER \
+  (tp_channel_dispatcher_get_type ())
+#define TP_CHANNEL_DISPATCHER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), TP_TYPE_CHANNEL_DISPATCHER, \
+                               TpChannelDispatcher))
+#define TP_CHANNEL_DISPATCHER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), TP_TYPE_CHANNEL_DISPATCHER, \
+                            TpChannelDispatcherClass))
+#define TP_IS_CHANNEL_DISPATCHER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TP_TYPE_CHANNEL_DISPATCHER))
+#define TP_IS_CHANNEL_DISPATCHER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), TP_TYPE_CHANNEL_DISPATCHER))
+#define TP_CHANNEL_DISPATCHER_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_CHANNEL_DISPATCHER, \
+                              TpChannelDispatcherClass))
+
+TpChannelDispatcher *tp_channel_dispatcher_new (TpDBusDaemon *bus_daemon);
+
+G_END_DECLS
+
+#include <telepathy-glib/_gen/tp-cli-channel-dispatcher.h>
+
+#endif
diff --git a/telepathy-glib/channel-dispatcher.xml b/telepathy-glib/channel-dispatcher.xml
new file mode 100644
index 0000000..82d6d63
--- /dev/null
+++ b/telepathy-glib/channel-dispatcher.xml
@@ -0,0 +1,10 @@
+<tp:spec
+  xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
+  xmlns:xi="http://www.w3.org/2001/XInclude">
+
+<tp:title>Channel Dispatcher interfaces</tp:title>
+
+<xi:include href="../spec/Channel_Dispatcher.xml"/>
+<xi:include href="../spec/Channel_Dispatcher_Interface_Operation_List.xml"/>
+
+</tp:spec>
diff --git a/telepathy-glib/debug-internal.h b/telepathy-glib/debug-internal.h
index a45c27e..f355613 100644
--- a/telepathy-glib/debug-internal.h
+++ b/telepathy-glib/debug-internal.h
@@ -26,7 +26,8 @@ typedef enum
   TP_DEBUG_PROXY         = 1 << 9,
   TP_DEBUG_HANDLES       = 1 << 10,
   TP_DEBUG_CONTACTS      = 1 << 11,
-  TP_DEBUG_ACCOUNTS      = 1 << 12
+  TP_DEBUG_ACCOUNTS      = 1 << 12,
+  TP_DEBUG_DISPATCHER    = 1 << 13
 } TpDebugFlags;
 
 gboolean _tp_debug_flag_is_set (TpDebugFlags flag);
diff --git a/telepathy-glib/debug.c b/telepathy-glib/debug.c
index 3ed586f..e043a1a 100644
--- a/telepathy-glib/debug.c
+++ b/telepathy-glib/debug.c
@@ -109,6 +109,7 @@ static GDebugKey keys[] = {
   { "handles",       TP_DEBUG_HANDLES },
   { "contacts",      TP_DEBUG_CONTACTS },
   { "accounts",      TP_DEBUG_ACCOUNTS },
+  { "dispatcher",    TP_DEBUG_DISPATCHER },
   { 0, }
 };
 
diff --git a/telepathy-glib/defs.h b/telepathy-glib/defs.h
index 124794f..97614d0 100644
--- a/telepathy-glib/defs.h
+++ b/telepathy-glib/defs.h
@@ -78,5 +78,19 @@ G_BEGIN_DECLS
  */
 #define TP_ACCOUNT_OBJECT_PATH_BASE "/org/freedesktop/Telepathy/Account/"
 
+/**
+ * TP_CHANNEL_DISPATCHER_BUS_NAME:
+ *
+ * The channel dispatcher's well-known bus name
+ */
+#define TP_CHANNEL_DISPATCHER_BUS_NAME "org.freedesktop.Telepathy.ChannelDispatcher"
+
+/**
+ * TP_CHANNEL_DISPATCHER_OBJECT_PATH:
+ *
+ * The channel dispatcher's standard object path
+ */
+#define TP_CHANNEL_DISPATCHER_OBJECT_PATH "/org/freedesktop/Telepathy/ChannelDispatcher"
+
 G_END_DECLS
 #endif
diff --git a/telepathy-glib/extra-gtkdoc.h b/telepathy-glib/extra-gtkdoc.h
index e803cca..26d289c 100644
--- a/telepathy-glib/extra-gtkdoc.h
+++ b/telepathy-glib/extra-gtkdoc.h
@@ -227,6 +227,23 @@
  */
 
 /**
+ * SECTION:svc-channel-dispatcher
+ * @title: Service-side Channel Dispatcher interface
+ * @short_description: GInterfaces for Telepathy ChannelDispatcher object
+ *
+ * The #TpSvcChannelDispatcher interface (auto-generated from the Telepathy
+ * spec) makes it easier to export an object implementing the Telepathy
+ * ChannelDispatcher interface, with the correct method and signal signatures,
+ * and emit signals from that object in a type-safe way.
+ *
+ * Similarly, #TpSvcChannelDispatcherInterfaceOperationList helps to
+ * implement the optional OperationList interface.
+ *
+ * You don't need these interfaces unless you're implementing a
+ * Telepathy ChannelDispatcher, such as Mission Control.
+ */
+
+/**
  * SECTION:svc-media-interfaces
  * @title: Service-side media streaming helper interfaces
  * @short_description: media session and media stream
diff --git a/telepathy-glib/stable-interfaces.xml b/telepathy-glib/stable-interfaces.xml
index ff66d09..1f710ab 100644
--- a/telepathy-glib/stable-interfaces.xml
+++ b/telepathy-glib/stable-interfaces.xml
@@ -15,6 +15,8 @@
 <xi:include href="account-manager.xml"/>
 <xi:include href="account.xml"/>
 
+<xi:include href="channel-dispatcher.xml"/>
+
 <xi:include href="../spec/generic-types.xml"/>
 <xi:include href="../spec/errors.xml"/>
 
diff --git a/telepathy-glib/svc-channel-dispatcher.h b/telepathy-glib/svc-channel-dispatcher.h
new file mode 100644
index 0000000..87ad459
--- /dev/null
+++ b/telepathy-glib/svc-channel-dispatcher.h
@@ -0,0 +1,6 @@
+#ifndef __TP_META_SVC_CHANNEL_DISPATCHER_H__
+#define __TP_META_SVC_CHANNEL_DISPATCHER_H__
+
+#include <telepathy-glib/_gen/tp-svc-channel-dispatcher.h>
+
+#endif
diff --git a/tests/dbus/Makefile.am b/tests/dbus/Makefile.am
index 41bcbb0..7a1b1f8 100644
--- a/tests/dbus/Makefile.am
+++ b/tests/dbus/Makefile.am
@@ -5,6 +5,7 @@ noinst_PROGRAMS = \
     test-account-manager \
     test-call-cancellation \
     test-callable-example \
+    test-channel-dispatcher \
     test-channel-introspect \
     test-cli-group \
     test-cm \
@@ -47,6 +48,8 @@ test_account_manager_SOURCES = account-manager.c
 
 test_call_cancellation_SOURCES = call-cancellation.c
 
+test_channel_dispatcher_SOURCES = channel-dispatcher.c
+
 test_channel_introspect_SOURCES = channel-introspect.c
 
 test_callable_example_SOURCES = callable-example.c
diff --git a/tests/dbus/channel-dispatcher.c b/tests/dbus/channel-dispatcher.c
new file mode 100644
index 0000000..f350ec8
--- /dev/null
+++ b/tests/dbus/channel-dispatcher.c
@@ -0,0 +1,70 @@
+/* A very basic feature test for TpChannelDispatcher
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * Copying and distribution of this file, with or without modification,
+ * are permitted in any medium without royalty provided the copyright
+ * notice and this notice are preserved.
+ */
+
+#include <telepathy-glib/channel-dispatcher.h>
+#include <telepathy-glib/debug.h>
+
+typedef struct {
+    GMainLoop *mainloop;
+    TpDBusDaemon *dbus;
+
+    TpChannelDispatcher *cd;
+    GError *error /* initialized where needed */;
+} Test;
+
+static void
+setup (Test *test,
+       gconstpointer data)
+{
+  g_type_init ();
+  tp_debug_set_flags ("all");
+
+  test->mainloop = g_main_loop_new (NULL, FALSE);
+  test->dbus = tp_dbus_daemon_dup (NULL);
+  g_assert (test->dbus != NULL);
+
+  test->cd = NULL;
+}
+
+static void
+teardown (Test *test,
+          gconstpointer data)
+{
+  if (test->cd != NULL)
+    {
+      g_object_unref (test->cd);
+      test->cd = NULL;
+    }
+
+  g_object_unref (test->dbus);
+  test->dbus = NULL;
+  g_main_loop_unref (test->mainloop);
+  test->mainloop = NULL;
+}
+
+static void
+test_new (Test *test,
+          gconstpointer data G_GNUC_UNUSED)
+{
+  test->cd = tp_channel_dispatcher_new (test->dbus);
+  g_assert (test->cd != NULL);
+}
+
+int
+main (int argc,
+      char **argv)
+{
+  g_test_init (&argc, &argv, NULL);
+  g_test_bug_base ("http://bugs.freedesktop.org/show_bug.cgi?id=");
+
+  g_test_add ("/cd/new", Test, NULL, setup, test_new, teardown);
+
+  return g_test_run ();
+}
-- 
1.5.6.5




More information about the telepathy-commits mailing list