diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2010-11-26 12:38:00 +0000 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-04-18 08:57:30 +0200 |
commit | aca908ec4be2849ede0caa4793a036034401b218 (patch) | |
tree | b96bf2d6ab1b64e8dffa489f23260c40867f192f | |
parent | 6e70761bddc4def5057ccd240650a45601ce2cab (diff) |
Generate client Debug code (with a trivial class)
-rw-r--r-- | telepathy-glib/Makefile.am | 2 | ||||
-rw-r--r-- | telepathy-glib/codegen.am | 6 | ||||
-rw-r--r-- | telepathy-glib/debug-client.c | 142 | ||||
-rw-r--r-- | telepathy-glib/debug-client.h | 64 |
4 files changed, 214 insertions, 0 deletions
diff --git a/telepathy-glib/Makefile.am b/telepathy-glib/Makefile.am index 80a2f1514..41a13813a 100644 --- a/telepathy-glib/Makefile.am +++ b/telepathy-glib/Makefile.am @@ -77,6 +77,7 @@ our_headers = \ defs.h \ debug.h \ debug-sender.h \ + debug-client.h \ debug-ansi.h \ dtmf.h \ enums.h \ @@ -235,6 +236,7 @@ libtelepathy_glib_internal_la_SOURCES = \ dbus-properties-mixin.c \ dbus-tube-channel.c \ debug.c \ + debug-client.c \ debug-sender.c \ deprecated-internal.h \ dtmf.c \ diff --git a/telepathy-glib/codegen.am b/telepathy-glib/codegen.am index 46ea3c416..02fe35dac 100644 --- a/telepathy-glib/codegen.am +++ b/telepathy-glib/codegen.am @@ -56,6 +56,7 @@ nodist_geninclude_HEADERS = \ _gen/tp-cli-connection.h \ _gen/tp-cli-connection-manager.h \ _gen/tp-cli-dbus-daemon.h \ + _gen/tp-cli-debug.h \ _gen/tp-cli-generic.h \ _gen/tp-cli-media-session-handler.h \ _gen/tp-cli-media-stream-handler.h \ @@ -100,6 +101,7 @@ nodist_libtelepathy_glib_internal_la_SOURCES = \ _gen/tp-cli-connection-body.h \ _gen/tp-cli-connection-manager-body.h \ _gen/tp-cli-dbus-daemon-body.h \ + _gen/tp-cli-debug-body.h \ _gen/tp-cli-generic-body.h \ _gen/tp-cli-media-session-handler-body.h \ _gen/tp-cli-media-stream-handler-body.h \ @@ -288,6 +290,10 @@ _gen/tp-cli-%-body.h: _gen/tp-spec-%.xml \ subclass=--subclass=TpDBusDaemon; \ subclass_assert=--subclass-assert=TP_IS_DBUS_DAEMON; \ ;; \ + debug) \ + subclass=--subclass=TpDebugClient; \ + subclass_assert=--subclass-assert=TP_IS_DEBUG_CLIENT; \ + ;; \ esac; \ $(PYTHON) $(tools_dir)/glib-client-gen.py \ $$subclass $$subclass_assert \ diff --git a/telepathy-glib/debug-client.c b/telepathy-glib/debug-client.c new file mode 100644 index 000000000..1ab8ae909 --- /dev/null +++ b/telepathy-glib/debug-client.c @@ -0,0 +1,142 @@ +/* + * debug-client.c - proxy for Telepathy debug objects + * + * Copyright © 2010 Collabora Ltd. <http://www.collabora.co.uk/> + * + * 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/debug-client.h> +#include <telepathy-glib/dbus.h> +#include <telepathy-glib/errors.h> +#include <telepathy-glib/interfaces.h> +#include <telepathy-glib/proxy-subclass.h> + +#include "telepathy-glib/_gen/tp-cli-debug-body.h" + +/** + * SECTION:debug-client + * @title: TpDebugClient + * @short_description: proxy objects for Telepathy debug information + * @see_also: #TpProxy + * + * This module provides access to the auxiliary objects used to + * implement #TpSvcDebug. + * + * Since: 0.UNRELEASED + */ + +/** + * TpDebugClientClass: + * + * The class of a #TpDebugClient. + * + * Since: 0.UNRELEASED + */ +struct _TpDebugClientClass { + TpProxyClass parent_class; + /*<private>*/ + gpointer priv; +}; + +/** + * TpDebugClient: + * + * A proxy object for a Telepathy connection manager. + * + * Since: 0.7.1 + */ +struct _TpDebugClient { + TpProxy parent; + /*<private>*/ + TpDebugClientPrivate *priv; +}; + +G_DEFINE_TYPE (TpDebugClient, tp_debug_client, TP_TYPE_PROXY) + +static void +tp_debug_client_init (TpDebugClient *self) +{ +} + +static void +tp_debug_client_class_init (TpDebugClientClass *klass) +{ + TpProxyClass *proxy_class = (TpProxyClass *) klass; + + proxy_class->must_have_unique_name = TRUE; + proxy_class->interface = TP_IFACE_QUARK_DEBUG; + tp_debug_client_init_known_interfaces (); +} + +/** + * tp_debug_client_init_known_interfaces: + * + * Ensure that the known interfaces for TpDebugClient have been set up. + * This is done automatically when necessary, but for correct + * overriding of library interfaces by local extensions, you should + * call this function before calling + * tp_proxy_or_subclass_hook_on_interface_add() with first argument + * %TP_TYPE_DEBUG_CLIENT. + * + * Since: 0.UNRELEASED + */ +void +tp_debug_client_init_known_interfaces (void) +{ + static gsize once = 0; + + if (g_once_init_enter (&once)) + { + GType tp_type = TP_TYPE_DEBUG_CLIENT; + + tp_proxy_init_known_interfaces (); + tp_proxy_or_subclass_hook_on_interface_add (tp_type, + tp_cli_debug_add_signals); + tp_proxy_subclass_add_error_mapping (tp_type, + TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR); + + g_once_init_leave (&once, 1); + } +} + +/** + * tp_debug_client_new: + * @dbus: a D-Bus daemon; may not be %NULL + * @unique_name: the unique name of the process to be debugged; may not be + * %NULL or a well-known name + * + * <!-- --> + * + * Returns: a new debug client proxy, or %NULL on invalid arguments + * + * Since: 0.UNRELEASED + */ +TpDebugClient * +tp_debug_client_new ( + TpDBusDaemon *dbus, + const gchar *unique_name, + GError **error) +{ + if (!tp_dbus_check_valid_bus_name (unique_name, + TP_DBUS_NAME_TYPE_UNIQUE, error)) + return NULL; + + return TP_DEBUG_CLIENT (g_object_new (TP_TYPE_DEBUG_CLIENT, + "dbus-daemon", dbus, + "bus-name", unique_name, + "object-path", TP_DEBUG_OBJECT_PATH, + NULL)); +} diff --git a/telepathy-glib/debug-client.h b/telepathy-glib/debug-client.h new file mode 100644 index 000000000..a575eb97f --- /dev/null +++ b/telepathy-glib/debug-client.h @@ -0,0 +1,64 @@ +/* + * debug-client.h - proxy for Telepathy debug objects + * + * Copyright © 2010 Collabora Ltd. <http://www.collabora.co.uk/> + * + * 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_DEBUG_CLIENT_H +#define TP_DEBUG_CLIENT_H + +#include <telepathy-glib/defs.h> +#include <telepathy-glib/proxy.h> + +G_BEGIN_DECLS + +typedef struct _TpDebugClient TpDebugClient; +typedef struct _TpDebugClientPrivate TpDebugClientPrivate; +typedef struct _TpDebugClientClass TpDebugClientClass; + +TpDebugClient *tp_debug_client_new ( + TpDBusDaemon *dbus, + const gchar *unique_name, + GError **error); + +/* Tedious GObject boilerplate */ + +GType tp_debug_client_get_type (void); + +#define TP_TYPE_DEBUG_CLIENT \ + (tp_debug_client_get_type ()) +#define TP_DEBUG_CLIENT(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), TP_TYPE_DEBUG_CLIENT, \ + TpDebugClient)) +#define TP_DEBUG_CLIENT_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), TP_TYPE_DEBUG_CLIENT, \ + TpDebugClientClass)) +#define TP_IS_DEBUG_CLIENT(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), TP_TYPE_DEBUG_CLIENT)) +#define TP_IS_DEBUG_CLIENT_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), TP_TYPE_DEBUG_CLIENT)) +#define TP_DEBUG_CLIENT_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_DEBUG_CLIENT, \ + TpDebugClientClass)) + +void tp_debug_client_init_known_interfaces (void); + +G_END_DECLS + +#include <telepathy-glib/_gen/tp-cli-debug.h> + +#endif |