summaryrefslogtreecommitdiff
path: root/telepathy-glib/debug-client.c
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2010-11-26 12:38:00 +0000
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-04-18 08:57:30 +0200
commitaca908ec4be2849ede0caa4793a036034401b218 (patch)
treeb96bf2d6ab1b64e8dffa489f23260c40867f192f /telepathy-glib/debug-client.c
parent6e70761bddc4def5057ccd240650a45601ce2cab (diff)
downloadtelepathy-glib-aca908ec4be2849ede0caa4793a036034401b218.tar.gz
Generate client Debug code (with a trivial class)
Diffstat (limited to 'telepathy-glib/debug-client.c')
-rw-r--r--telepathy-glib/debug-client.c142
1 files changed, 142 insertions, 0 deletions
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));
+}