summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2010-11-27 00:05:02 +0000
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-04-18 08:57:31 +0200
commitb98cfe87b1f5a026abf184ca2452214e7a869c20 (patch)
treeacc555b59d6a826a9d0a0f449d17b338babd4fd2
parente8bb33b6c8213d82562d4b8436a2a4de0ffde172 (diff)
DebugClient: add set_enabled_async()
This is the only binding I'm going to bother adding for now.
-rw-r--r--telepathy-glib/debug-client.c43
-rw-r--r--telepathy-glib/debug-client.h11
2 files changed, 54 insertions, 0 deletions
diff --git a/telepathy-glib/debug-client.c b/telepathy-glib/debug-client.c
index 0789f0fb4..45ef9350e 100644
--- a/telepathy-glib/debug-client.c
+++ b/telepathy-glib/debug-client.c
@@ -28,6 +28,7 @@
#define DEBUG_FLAG TP_DEBUG_DEBUGGER
#include "telepathy-glib/debug-internal.h"
#include "telepathy-glib/proxy-internal.h"
+#include "telepathy-glib/util-internal.h"
#include "telepathy-glib/_gen/tp-cli-debug-body.h"
@@ -281,3 +282,45 @@ tp_debug_client_new (
"object-path", TP_DEBUG_OBJECT_PATH,
NULL));
}
+
+static void
+set_enabled_cb (
+ TpProxy *proxy,
+ const GError *error,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ GSimpleAsyncResult *result = G_SIMPLE_ASYNC_RESULT (user_data);
+
+ if (error != NULL)
+ g_simple_async_result_set_from_error (result, error);
+
+ g_simple_async_result_complete (result);
+}
+
+void
+tp_debug_client_set_enabled_async (
+ TpDebugClient *self,
+ gboolean enabled,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *result = g_simple_async_result_new (G_OBJECT (self),
+ callback, user_data, tp_debug_client_set_enabled_async);
+ GValue v = { 0, };
+
+ g_value_init (&v, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&v, enabled);
+ tp_cli_dbus_properties_call_set (self, -1, TP_IFACE_DEBUG, "Enabled", &v,
+ set_enabled_cb, result, g_object_unref, NULL);
+ g_value_unset (&v);
+}
+
+gboolean
+tp_debug_client_set_enabled_finish (
+ TpDebugClient *self,
+ GAsyncResult *result,
+ GError **error)
+{
+ _tp_implement_finish_void (self, tp_debug_client_set_enabled_async)
+}
diff --git a/telepathy-glib/debug-client.h b/telepathy-glib/debug-client.h
index a804cb96a..8ac4e4f78 100644
--- a/telepathy-glib/debug-client.h
+++ b/telepathy-glib/debug-client.h
@@ -39,6 +39,17 @@ TpDebugClient *tp_debug_client_new (
(tp_debug_client_get_feature_quark_core ())
GQuark tp_debug_client_get_feature_quark_core (void) G_GNUC_CONST;
+void tp_debug_client_set_enabled_async (
+ TpDebugClient *self,
+ gboolean enabled,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+gboolean tp_debug_client_set_enabled_finish (
+ TpDebugClient *self,
+ GAsyncResult *result,
+ GError **error);
+
/* Tedious GObject boilerplate */
GType tp_debug_client_get_type (void);