[telepathy-glib/master] Add basic proxies for Client

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


---
 docs/reference/telepathy-glib-docs.sgml    |    2 +
 docs/reference/telepathy-glib-sections.txt |  116 ++++++++++++++++++++++++++++
 docs/reference/telepathy-glib.types        |    8 ++
 spec/Client.xml                            |    3 +-
 spec/Client_Approver.xml                   |    3 +-
 spec/Client_Handler.xml                    |    3 +-
 spec/Client_Interface_Requests.xml         |    3 +-
 spec/Client_Observer.xml                   |    3 +-
 telepathy-glib/Makefile.am                 |   12 +++
 telepathy-glib/client.c                    |  114 +++++++++++++++++++++++++++
 telepathy-glib/client.h                    |   70 +++++++++++++++++
 telepathy-glib/client.xml                  |   13 +++
 telepathy-glib/defs.h                      |   14 ++++
 telepathy-glib/extra-gtkdoc.h              |   10 +++
 telepathy-glib/stable-interfaces.xml       |    2 +
 telepathy-glib/svc-client.h                |    6 ++
 tests/dbus/Makefile.am                     |    3 +
 tests/dbus/client.c                        |   74 ++++++++++++++++++
 18 files changed, 449 insertions(+), 10 deletions(-)
 create mode 100644 telepathy-glib/client.c
 create mode 100644 telepathy-glib/client.h
 create mode 100644 telepathy-glib/client.xml
 create mode 100644 telepathy-glib/svc-client.h
 create mode 100644 tests/dbus/client.c

diff --git a/docs/reference/telepathy-glib-docs.sgml b/docs/reference/telepathy-glib-docs.sgml
index cdc2e06..468f0e6 100644
--- a/docs/reference/telepathy-glib-docs.sgml
+++ b/docs/reference/telepathy-glib-docs.sgml
@@ -51,6 +51,7 @@
     <xi:include href="xml/channel-dispatcher.xml"/>
     <xi:include href="xml/channel-dispatch-operation.xml"/>
     <xi:include href="xml/channel-request.xml"/>
+    <xi:include href="xml/client.xml"/>
   </chapter>
 
   <chapter id="ch-service-dbus">
@@ -74,6 +75,7 @@
     <xi:include href="xml/svc-channel-dispatcher.xml"/>
     <xi:include href="xml/svc-channel-dispatch-operation.xml"/>
     <xi:include href="xml/svc-channel-request.xml"/>
+    <xi:include href="xml/svc-client.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 ccc40a5..cf7ca66 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -27,6 +27,8 @@ TP_ACCOUNT_MANAGER_OBJECT_PATH
 TP_ACCOUNT_OBJECT_PATH_BASE
 TP_CHANNEL_DISPATCHER_BUS_NAME
 TP_CHANNEL_DISPATCHER_OBJECT_PATH
+TP_CLIENT_BUS_NAME_BASE
+TP_CLIENT_OBJECT_PATH_BASE
 </SECTION>
 
 <SECTION>
@@ -1950,6 +1952,16 @@ TP_IFACE_MEDIA_STREAM_HANDLER
 TP_IFACE_QUARK_MEDIA_STREAM_HANDLER
 TP_IFACE_PROPERTIES_INTERFACE
 TP_IFACE_QUARK_PROPERTIES_INTERFACE
+TP_IFACE_CLIENT
+TP_IFACE_QUARK_CLIENT
+TP_IFACE_CLIENT_APPROVER
+TP_IFACE_QUARK_CLIENT_APPROVER
+TP_IFACE_CLIENT_HANDLER
+TP_IFACE_QUARK_CLIENT_HANDLER
+TP_IFACE_CLIENT_OBSERVER
+TP_IFACE_QUARK_CLIENT_OBSERVER
+TP_IFACE_CLIENT_INTERFACE_REQUESTS
+TP_IFACE_QUARK_CLIENT_INTERFACE_REQUESTS
 <SUBSECTION Private>
 tp_iface_quark_account
 tp_iface_quark_account_interface_avatar
@@ -1979,6 +1991,11 @@ tp_iface_quark_channel_dispatcher
 tp_iface_quark_channel_dispatcher_interface_operation_list
 tp_iface_quark_channel_dispatch_operation
 tp_iface_quark_channel_request
+tp_iface_quark_client
+tp_iface_quark_client_approver
+tp_iface_quark_client_handler
+tp_iface_quark_client_interface_requests
+tp_iface_quark_client_observer
 tp_iface_quark_connection
 tp_iface_quark_connection_interface_aliasing
 tp_iface_quark_connection_interface_avatars
@@ -3121,3 +3138,102 @@ TP_SVC_CHANNEL_REQUEST
 TP_SVC_CHANNEL_REQUEST_GET_CLASS
 TP_TYPE_SVC_CHANNEL_REQUEST
 </SECTION>
+
+<SECTION>
+<FILE>client</FILE>
+<INCLUDE>telepathy-glib/client.h</INCLUDE>
+<TITLE>client</TITLE>
+TpClient
+TpClientClass
+<SUBSECTION>
+tp_cli_client_observer_callback_for_observe_channels
+tp_cli_client_observer_call_observe_channels
+<SUBSECTION>
+tp_cli_client_handler_callback_for_handle_channels
+tp_cli_client_handler_call_handle_channels
+tp_cli_client_interface_requests_callback_for_add_request
+tp_cli_client_interface_requests_call_add_request
+tp_cli_client_interface_requests_callback_for_remove_request
+tp_cli_client_interface_requests_call_remove_request
+<SUBSECTION>
+tp_cli_client_approver_callback_for_add_dispatch_operation
+tp_cli_client_approver_call_add_dispatch_operation
+<SUBSECTION Standard>
+tp_client_get_type
+TP_CLIENT
+TP_CLIENT_CLASS
+TP_CLIENT_GET_CLASS
+TP_IS_CLIENT
+TP_IS_CLIENT_CLASS
+TP_TYPE_CLIENT
+TpClientClassPrivate
+TpClientPrivate
+<SUBSECTION Private>
+# leaving these undocumented as a step towards deprecating all _run_ methods
+# (these ones have never been documented)
+tp_cli_client_approver_run_add_dispatch_operation
+tp_cli_client_handler_run_handle_channels
+tp_cli_client_interface_requests_run_add_request
+tp_cli_client_interface_requests_run_remove_request
+tp_cli_client_observer_run_observe_channels
+</SECTION>
+
+<SECTION>
+<FILE>svc-client</FILE>
+<INCLUDE>telepathy-glib/svc-client.h</INCLUDE>
+<TITLE>svc-client</TITLE>
+TpSvcClient
+TpSvcClientClass
+<SUBSECTION>
+TpSvcClientApprover
+TpSvcClientApproverClass
+tp_svc_client_approver_return_from_add_dispatch_operation
+tp_svc_client_approver_add_dispatch_operation_impl
+tp_svc_client_approver_implement_add_dispatch_operation
+<SUBSECTION>
+TpSvcClientHandler
+TpSvcClientHandlerClass
+tp_svc_client_handler_return_from_handle_channels
+tp_svc_client_handler_handle_channels_impl
+tp_svc_client_handler_implement_handle_channels
+TpSvcClientInterfaceRequests
+TpSvcClientInterfaceRequestsClass
+tp_svc_client_interface_requests_return_from_add_request
+tp_svc_client_interface_requests_add_request_impl
+tp_svc_client_interface_requests_implement_add_request
+tp_svc_client_interface_requests_return_from_remove_request
+tp_svc_client_interface_requests_remove_request_impl
+tp_svc_client_interface_requests_implement_remove_request
+<SUBSECTION>
+TpSvcClientObserver
+TpSvcClientObserverClass
+tp_svc_client_observer_return_from_observe_channels
+tp_svc_client_observer_observe_channels_impl
+tp_svc_client_observer_implement_observe_channels
+<SUBSECTION Standard>
+tp_svc_client_get_type
+tp_svc_client_approver_get_type
+tp_svc_client_handler_get_type
+tp_svc_client_interface_requests_get_type
+tp_svc_client_observer_get_type
+TP_IS_SVC_CLIENT
+TP_IS_SVC_CLIENT_APPROVER
+TP_IS_SVC_CLIENT_HANDLER
+TP_IS_SVC_CLIENT_INTERFACE_REQUESTS
+TP_IS_SVC_CLIENT_OBSERVER
+TP_SVC_CLIENT
+TP_SVC_CLIENT_APPROVER
+TP_SVC_CLIENT_APPROVER_GET_CLASS
+TP_SVC_CLIENT_GET_CLASS
+TP_SVC_CLIENT_HANDLER
+TP_SVC_CLIENT_HANDLER_GET_CLASS
+TP_SVC_CLIENT_INTERFACE_REQUESTS
+TP_SVC_CLIENT_INTERFACE_REQUESTS_GET_CLASS
+TP_SVC_CLIENT_OBSERVER
+TP_SVC_CLIENT_OBSERVER_GET_CLASS
+TP_TYPE_SVC_CLIENT
+TP_TYPE_SVC_CLIENT_APPROVER
+TP_TYPE_SVC_CLIENT_HANDLER
+TP_TYPE_SVC_CLIENT_INTERFACE_REQUESTS
+TP_TYPE_SVC_CLIENT_OBSERVER
+</SECTION>
diff --git a/docs/reference/telepathy-glib.types b/docs/reference/telepathy-glib.types
index 1a7171a..5cef397 100644
--- a/docs/reference/telepathy-glib.types
+++ b/docs/reference/telepathy-glib.types
@@ -9,6 +9,7 @@
 #include <telepathy-glib/channel-iface.h>
 #include <telepathy-glib/channel-manager.h>
 #include <telepathy-glib/channel-request.h>
+#include <telepathy-glib/client.h>
 #include <telepathy-glib/connection.h>
 #include <telepathy-glib/connection-manager.h>
 #include <telepathy-glib/contact.h>
@@ -24,6 +25,7 @@
 #include <telepathy-glib/svc-channel-dispatcher.h>
 #include <telepathy-glib/svc-channel-dispatch-operation.h>
 #include <telepathy-glib/svc-channel-request.h>
+#include <telepathy-glib/svc-client.h>
 #include <telepathy-glib/svc-connection.h>
 #include <telepathy-glib/svc-connection-manager.h>
 #include <telepathy-glib/svc-generic.h>
@@ -41,6 +43,7 @@ tp_channel_dispatch_operation_get_type
 tp_channel_iface_get_type
 tp_channel_manager_get_type
 tp_channel_request_get_type
+tp_client_get_type
 tp_connection_get_type
 tp_connection_manager_get_type
 tp_contact_get_type
@@ -72,6 +75,11 @@ tp_svc_channel_type_room_list_get_type
 tp_svc_channel_type_streamed_media_get_type
 tp_svc_channel_type_text_get_type
 tp_svc_channel_type_tubes_get_type
+tp_svc_client_approver_get_type
+tp_svc_client_get_type
+tp_svc_client_handler_get_type
+tp_svc_client_interface_requests_get_type
+tp_svc_client_observer_get_type
 tp_svc_connection_get_type
 tp_svc_connection_interface_aliasing_get_type
 tp_svc_connection_interface_avatars_get_type
diff --git a/spec/Client.xml b/spec/Client.xml
index ba29900..0253e51 100644
--- a/spec/Client.xml
+++ b/spec/Client.xml
@@ -20,8 +20,7 @@
       02110-1301, USA.</p>
   </tp:license>
 
-  <interface name="org.freedesktop.Telepathy.Client"
-    tp:causes-havoc="not yet final">
+  <interface name="org.freedesktop.Telepathy.Client">
     <tp:added version="0.17.12">(as a draft)</tp:added>
 
     <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
diff --git a/spec/Client_Approver.xml b/spec/Client_Approver.xml
index 62f6694..e6840ad 100644
--- a/spec/Client_Approver.xml
+++ b/spec/Client_Approver.xml
@@ -20,8 +20,7 @@
       02110-1301, USA.</p>
   </tp:license>
 
-  <interface name="org.freedesktop.Telepathy.Client.Approver"
-    tp:causes-havoc="not yet final">
+  <interface name="org.freedesktop.Telepathy.Client.Approver">
     <tp:added version="0.17.12">(as a draft)</tp:added>
 
     <tp:requires interface="org.freedesktop.Telepathy.Client"/>
diff --git a/spec/Client_Handler.xml b/spec/Client_Handler.xml
index da48701..04dec8a 100644
--- a/spec/Client_Handler.xml
+++ b/spec/Client_Handler.xml
@@ -20,8 +20,7 @@
       02110-1301, USA.</p>
   </tp:license>
 
-  <interface name="org.freedesktop.Telepathy.Client.Handler"
-    tp:causes-havoc="not yet final">
+  <interface name="org.freedesktop.Telepathy.Client.Handler">
     <tp:added version="0.17.12">(as a draft)</tp:added>
 
     <tp:requires interface="org.freedesktop.Telepathy.Client"/>
diff --git a/spec/Client_Interface_Requests.xml b/spec/Client_Interface_Requests.xml
index 1b0de98..0542bea 100644
--- a/spec/Client_Interface_Requests.xml
+++ b/spec/Client_Interface_Requests.xml
@@ -20,8 +20,7 @@
       02110-1301, USA.</p>
   </tp:license>
 
-  <interface name="org.freedesktop.Telepathy.Client.Interface.Requests"
-    tp:causes-havoc="not yet final">
+  <interface name="org.freedesktop.Telepathy.Client.Interface.Requests">
     <tp:added version="0.17.23">(as a draft; functionality
       moved from Handler)</tp:added>
 
diff --git a/spec/Client_Observer.xml b/spec/Client_Observer.xml
index 58b67b3..5f08bfe 100644
--- a/spec/Client_Observer.xml
+++ b/spec/Client_Observer.xml
@@ -20,8 +20,7 @@
       02110-1301, USA.</p>
   </tp:license>
 
-  <interface name="org.freedesktop.Telepathy.Client.Observer"
-    tp:causes-havoc="not yet final">
+  <interface name="org.freedesktop.Telepathy.Client.Observer">
     <tp:added version="0.17.12">(as a draft)</tp:added>
 
     <tp:requires interface="org.freedesktop.Telepathy.Client"/>
diff --git a/telepathy-glib/Makefile.am b/telepathy-glib/Makefile.am
index 6f817c3..98b4c1e 100644
--- a/telepathy-glib/Makefile.am
+++ b/telepathy-glib/Makefile.am
@@ -45,6 +45,7 @@ EXTRA_DIST = \
     channel-dispatcher.xml \
     channel-dispatch-operation.xml \
     channel-request.xml \
+    client.xml \
     connection.xml \
     connection-manager.xml \
     dbus-daemon.xml \
@@ -130,6 +131,7 @@ tpginclude_HEADERS = \
     channel-factory-iface.h \
     channel-manager.h \
     channel-request.h \
+    client.h \
     connection.h \
     connection-manager.h \
     contact.h \
@@ -182,6 +184,7 @@ nodist_libtelepathy_glib_internal_la_SOURCES = \
     _gen/tp-cli-channel-dispatcher-body.h \
     _gen/tp-cli-channel-dispatch-operation-body.h \
     _gen/tp-cli-channel-request-body.h \
+    _gen/tp-cli-client-body.h \
     _gen/tp-cli-connection-body.h \
     _gen/tp-cli-connection-manager-body.h \
     _gen/tp-cli-dbus-daemon-body.h \
@@ -194,6 +197,7 @@ nodist_libtelepathy_glib_internal_la_SOURCES = \
     _gen/tp-svc-channel-dispatcher.c \
     _gen/tp-svc-channel-dispatch-operation.c \
     _gen/tp-svc-channel-request.c \
+    _gen/tp-svc-client.c \
     _gen/tp-svc-connection.c \
     _gen/tp-svc-connection-manager.c \
     _gen/tp-svc-generic.c \
@@ -211,6 +215,7 @@ nodist_geninclude_HEADERS = \
     _gen/tp-cli-channel-dispatcher.h \
     _gen/tp-cli-channel-dispatch-operation.h \
     _gen/tp-cli-channel-request.h \
+    _gen/tp-cli-client.h \
     _gen/tp-cli-connection.h \
     _gen/tp-cli-connection-manager.h \
     _gen/tp-cli-dbus-daemon.h \
@@ -223,6 +228,7 @@ nodist_geninclude_HEADERS = \
     _gen/tp-svc-channel-dispatcher.h \
     _gen/tp-svc-channel-dispatch-operation.h \
     _gen/tp-svc-channel-request.h \
+    _gen/tp-svc-client.h \
     _gen/tp-svc-connection.h \
     _gen/tp-svc-connection-manager.h \
     _gen/tp-svc-generic.h \
@@ -262,6 +268,7 @@ libtelepathy_glib_internal_la_SOURCES = \
     channel-dispatch-operation.c \
     channel-manager.c \
     channel-request.c \
+    client.c \
     connection.c \
     connection-internal.h \
     connection-handles.c \
@@ -430,6 +437,11 @@ _gen/tp-cli-%-body.h _gen/tp-cli-%.h: _gen/tp-spec-%.xml \
 			subclass_assert=--subclass-assert=TP_IS_CHANNEL_REQUEST; \
 			maybe_reentrant=--generate-reentrant; \
 			;; \
+		client) \
+			subclass=--subclass=TpClient; \
+			subclass_assert=--subclass-assert=TP_IS_CLIENT; \
+			maybe_reentrant=--generate-reentrant; \
+			;; \
 		connection-manager) \
 			subclass=--subclass=TpConnectionManager; \
 			subclass_assert=--subclass-assert=TP_IS_CONNECTION_MANAGER \
diff --git a/telepathy-glib/client.c b/telepathy-glib/client.c
new file mode 100644
index 0000000..5927d91
--- /dev/null
+++ b/telepathy-glib/client.c
@@ -0,0 +1,114 @@
+/*
+ * client.c - proxy for a Telepathy client
+ *
+ * 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/client.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-client-body.h"
+
+/**
+ * SECTION:client
+ * @title: TpClient
+ * @short_description: proxy object for a client of the ChannelDispatcher
+ *
+ * Each client to which the ChannelDispatcher can send channels must implement
+ * the Client interface. This object represents such a client, and is mainly
+ * useful in the implementation of the ChannelDispatcher itself.
+ *
+ * Since: 0.7.UNRELEASED
+ */
+
+/**
+ * TpClient:
+ *
+ * Each client to which the ChannelDispatcher can send channels must implement
+ * the Client interface. This object represents such a client, and is mainly
+ * useful in the implementation of the ChannelDispatcher itself.
+ *
+ * This proxy is usable but very incomplete: accessors for D-Bus properties
+ * will be added in a later version of telepathy-glib, along with a mechanism
+ * similar to tp_connection_call_when_ready().
+ *
+ * Many operations performed on a Client are done via D-Bus properties.
+ * Until convenience methods for this are implemented, use of the generic
+ * tp_cli_dbus_properties_call_get_all() and tp_cli_dbus_properties_call_set()
+ * methods is recommended.
+ *
+ * Since: 0.7.UNRELEASED
+ */
+
+/**
+ * TpClientClass:
+ *
+ * The class of a #TpClient.
+ */
+
+struct _TpClientPrivate {
+    gpointer dummy;
+};
+
+G_DEFINE_TYPE (TpClient, tp_client, TP_TYPE_PROXY);
+
+static void
+tp_client_init (TpClient *self)
+{
+  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, TP_TYPE_CLIENT,
+      TpClientPrivate);
+}
+
+static void
+tp_client_constructed (GObject *object)
+{
+  TpClient *self = TP_CLIENT (object);
+  void (*chain_up) (GObject *) =
+    ((GObjectClass *) tp_client_parent_class)->constructed;
+
+  if (chain_up != NULL)
+    chain_up (object);
+
+  g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL);
+}
+
+static void
+tp_client_class_init (TpClientClass *klass)
+{
+  GType tp_type = TP_TYPE_CLIENT;
+  TpProxyClass *proxy_class = (TpProxyClass *) klass;
+  GObjectClass *object_class = (GObjectClass *) klass;
+
+  g_type_class_add_private (klass, sizeof (TpClientPrivate));
+
+  object_class->constructed = tp_client_constructed;
+
+  proxy_class->interface = TP_IFACE_QUARK_CLIENT;
+  tp_proxy_or_subclass_hook_on_interface_add (tp_type,
+      tp_cli_client_add_signals);
+  tp_proxy_subclass_add_error_mapping (tp_type,
+      TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR);
+}
diff --git a/telepathy-glib/client.h b/telepathy-glib/client.h
new file mode 100644
index 0000000..fc88aef
--- /dev/null
+++ b/telepathy-glib/client.h
@@ -0,0 +1,70 @@
+/*
+ * client.h - proxy for a Telepathy client
+ *
+ * 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_CLIENT_H
+#define TP_CLIENT_H
+
+#include <telepathy-glib/proxy.h>
+#include <telepathy-glib/dbus.h>
+
+G_BEGIN_DECLS
+
+typedef struct _TpClient TpClient;
+typedef struct _TpClientClass TpClientClass;
+typedef struct _TpClientPrivate TpClientPrivate;
+typedef struct _TpClientClassPrivate TpClientClassPrivate;
+
+struct _TpClient {
+    /*<private>*/
+    TpProxy parent;
+    TpClientPrivate *priv;
+};
+
+struct _TpClientClass {
+    /*<private>*/
+    TpProxyClass parent_class;
+    GCallback _padding[7];
+    TpClientClassPrivate *priv;
+};
+
+GType tp_client_get_type (void);
+
+#define TP_TYPE_CLIENT \
+  (tp_client_get_type ())
+#define TP_CLIENT(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), TP_TYPE_CLIENT, \
+                               TpClient))
+#define TP_CLIENT_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), TP_TYPE_CLIENT, \
+                            TpClientClass))
+#define TP_IS_CLIENT(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TP_TYPE_CLIENT))
+#define TP_IS_CLIENT_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), TP_TYPE_CLIENT))
+#define TP_CLIENT_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_CLIENT, \
+                              TpClientClass))
+
+G_END_DECLS
+
+#include <telepathy-glib/_gen/tp-cli-client.h>
+
+#endif
diff --git a/telepathy-glib/client.xml b/telepathy-glib/client.xml
new file mode 100644
index 0000000..2ceb95f
--- /dev/null
+++ b/telepathy-glib/client.xml
@@ -0,0 +1,13 @@
+<tp:spec
+  xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
+  xmlns:xi="http://www.w3.org/2001/XInclude">
+
+<tp:title>Client interfaces</tp:title>
+
+<xi:include href="../spec/Client.xml"/>
+<xi:include href="../spec/Client_Observer.xml"/>
+<xi:include href="../spec/Client_Approver.xml"/>r
+<xi:include href="../spec/Client_Handler.xml"/>
+<xi:include href="../spec/Client_Interface_Requests.xml"/>
+
+</tp:spec>
diff --git a/telepathy-glib/defs.h b/telepathy-glib/defs.h
index 97614d0..5427b90 100644
--- a/telepathy-glib/defs.h
+++ b/telepathy-glib/defs.h
@@ -92,5 +92,19 @@ G_BEGIN_DECLS
  */
 #define TP_CHANNEL_DISPATCHER_OBJECT_PATH "/org/freedesktop/Telepathy/ChannelDispatcher"
 
+/**
+ * TP_CLIENT_BUS_NAME_BASE:
+ *
+ * The common prefix of the well-known bus name for any Telepathy Client.
+ */
+#define TP_CLIENT_BUS_NAME_BASE "org.freedesktop.Telepathy.Client."
+
+/**
+ * TP_CLIENT_OBJECT_PATH_BASE
+ *
+ * The common prefix of the well-known object path for any Telepathy Client.
+ */
+#define TP_CLIENT_OBJECT_PATH_BASE "/org/freedesktop/Telepathy/Client/"
+
 G_END_DECLS
 #endif
diff --git a/telepathy-glib/extra-gtkdoc.h b/telepathy-glib/extra-gtkdoc.h
index 5ecff48..2677a78 100644
--- a/telepathy-glib/extra-gtkdoc.h
+++ b/telepathy-glib/extra-gtkdoc.h
@@ -301,6 +301,16 @@
  */
 
 /**
+ * SECTION:svc-client
+ * @title: Service-side Client interfaces
+ * @short_description: interfaces used to be an Observer, Approver and Handler
+ *
+ * These interfaces (auto-generated from the telepathy spec) make it easier
+ * to export the objects used to implement a Telepathy client. Methods on
+ * these objects are primarily called by the Channel Dispatcher.
+ */
+
+/**
  * SECTION:defs
  * @title: Miscellaneous definitions
  * @short_description: Definitions useful for working with the Telepathy
diff --git a/telepathy-glib/stable-interfaces.xml b/telepathy-glib/stable-interfaces.xml
index d3a2c16..726dbf5 100644
--- a/telepathy-glib/stable-interfaces.xml
+++ b/telepathy-glib/stable-interfaces.xml
@@ -19,6 +19,8 @@
 <xi:include href="channel-dispatch-operation.xml"/>
 <xi:include href="channel-request.xml"/>
 
+<xi:include href="client.xml"/>
+
 <xi:include href="../spec/generic-types.xml"/>
 <xi:include href="../spec/errors.xml"/>
 
diff --git a/telepathy-glib/svc-client.h b/telepathy-glib/svc-client.h
new file mode 100644
index 0000000..d774a9d
--- /dev/null
+++ b/telepathy-glib/svc-client.h
@@ -0,0 +1,6 @@
+#ifndef __TP_META_SVC_CLIENT_H__
+#define __TP_META_SVC_CLIENT_H__
+
+#include <telepathy-glib/_gen/tp-svc-client.h>
+
+#endif
diff --git a/tests/dbus/Makefile.am b/tests/dbus/Makefile.am
index 073ad35..442ddd1 100644
--- a/tests/dbus/Makefile.am
+++ b/tests/dbus/Makefile.am
@@ -10,6 +10,7 @@ noinst_PROGRAMS = \
     test-channel-introspect \
     test-channel-request \
     test-cli-group \
+    test-client \
     test-cm \
     test-connection \
     test-connection-bug-18845 \
@@ -63,6 +64,8 @@ test_callable_example_LDADD = \
     $(LDADD) \
     $(top_builddir)/examples/cm/callable/libexample-cm-callable.la
 
+test_client_SOURCES = client.c
+
 test_cli_group_SOURCES = cli-group.c
 
 test_cm_SOURCES = cm.c
diff --git a/tests/dbus/client.c b/tests/dbus/client.c
new file mode 100644
index 0000000..2cbf9aa
--- /dev/null
+++ b/tests/dbus/client.c
@@ -0,0 +1,74 @@
+/* A very basic feature test for TpClient
+ *
+ * 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/client.h>
+#include <telepathy-glib/debug.h>
+
+typedef struct {
+    GMainLoop *mainloop;
+    TpDBusDaemon *dbus;
+
+    TpClient *client;
+    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->client = NULL;
+}
+
+static void
+teardown (Test *test,
+          gconstpointer data)
+{
+  if (test->client != NULL)
+    {
+      g_object_unref (test->client);
+      test->client = 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->client = g_object_new (TP_TYPE_CLIENT,
+      "dbus-daemon", test->dbus,
+      "object-path", "/org/freedesktop/Telepathy/Client/whatever",
+      "bus-name", "org.freedesktop.Telepathy.Client.whatever",
+      NULL);
+  g_assert (test->client != 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 ("/client/new", Test, NULL, setup, test_new, teardown);
+
+  return g_test_run ();
+}
-- 
1.5.6.5




More information about the telepathy-commits mailing list