telepathy-glib: DebugClient: add set_enabled_async()

Guillaume Desmottes gdesmott at kemper.freedesktop.org
Wed Apr 18 00:08:55 PDT 2012


Module: telepathy-glib
Branch: master
Commit: b98cfe87b1f5a026abf184ca2452214e7a869c20
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=b98cfe87b1f5a026abf184ca2452214e7a869c20

Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Sat Nov 27 00:05:02 2010 +0000

DebugClient: add set_enabled_async()

This is the only binding I'm going to bother adding for now.

---

 telepathy-glib/debug-client.c |   43 +++++++++++++++++++++++++++++++++++++++++
 telepathy-glib/debug-client.h |   11 ++++++++++
 2 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/telepathy-glib/debug-client.c b/telepathy-glib/debug-client.c
index 0789f0f..45ef935 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 a804cb9..8ac4e4f 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);



More information about the telepathy-commits mailing list