telepathy-glib: debug-client: expose enabled as a property
Guillaume Desmottes
gdesmott at kemper.freedesktop.org
Wed Apr 18 00:08:56 PDT 2012
Module: telepathy-glib
Branch: master
Commit: d68fbb41e865b6615cee62834b0c0aff0714637a
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=d68fbb41e865b6615cee62834b0c0aff0714637a
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date: Fri Apr 13 10:30:40 2012 +0200
debug-client: expose enabled as a property
---
docs/reference/telepathy-glib-sections.txt | 1 +
telepathy-glib/debug-client.c | 58 ++++++++++++++++++++++++++++
telepathy-glib/debug-client.h | 2 +
3 files changed, 61 insertions(+), 0 deletions(-)
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index c463b03..6b7c092 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -7191,6 +7191,7 @@ tp_debug_client_init_known_interfaces
tp_debug_client_new
tp_debug_client_set_enabled_async
tp_debug_client_set_enabled_finish
+tp_debug_client_is_enabled
<SUBSECTION Standard>
TP_DEBUG_CLIENT
TP_DEBUG_CLIENT_CLASS
diff --git a/telepathy-glib/debug-client.c b/telepathy-glib/debug-client.c
index b2b794a..a0f129f 100644
--- a/telepathy-glib/debug-client.c
+++ b/telepathy-glib/debug-client.c
@@ -84,6 +84,11 @@ static void name_owner_changed_cb (TpDBusDaemon *bus,
G_DEFINE_TYPE (TpDebugClient, tp_debug_client, TP_TYPE_PROXY)
+enum
+{
+ PROP_ENABLED = 1
+};
+
static void
tp_debug_client_init (TpDebugClient *self)
{
@@ -92,6 +97,25 @@ tp_debug_client_init (TpDebugClient *self)
}
static void
+tp_debug_client_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ TpDebugClient *self = TP_DEBUG_CLIENT (object);
+
+ switch (property_id)
+ {
+ case PROP_ENABLED:
+ g_value_set_boolean (value, self->priv->enabled);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
tp_debug_client_constructed (GObject *object)
{
TpDebugClient *self = TP_DEBUG_CLIENT (object);
@@ -126,7 +150,9 @@ tp_debug_client_class_init (TpDebugClientClass *klass)
{
GObjectClass *object_class = (GObjectClass *) klass;
TpProxyClass *proxy_class = (TpProxyClass *) klass;
+ GParamSpec *spec;
+ object_class->get_property = tp_debug_client_get_property;
object_class->constructed = tp_debug_client_constructed;
object_class->dispose = tp_debug_client_dispose;
@@ -134,6 +160,22 @@ tp_debug_client_class_init (TpDebugClientClass *klass)
proxy_class->interface = TP_IFACE_QUARK_DEBUG;
proxy_class->list_features = tp_debug_client_list_features;
+ /**
+ * TpDebugClient:enabled:
+ *
+ * %TRUE if debug messages are published on the bus.
+ *
+ * This property is meaningless until the
+ * %TP_DEBUG_CLIENT_FEATURE_CORE feature has been prepared.
+ *
+ * Since: UNRELEASED
+ */
+ spec = g_param_spec_boolean ("enabled", "enabled",
+ "Enabled",
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_ENABLED, spec);
+
g_type_class_add_private (klass, sizeof (TpDebugClientPrivate));
tp_debug_client_init_known_interfaces ();
}
@@ -350,3 +392,19 @@ tp_debug_client_set_enabled_finish (
{
_tp_implement_finish_void (self, tp_debug_client_set_enabled_async)
}
+
+/**
+ * tp_debug_client_is_enabled:
+ * @self: a #TpDebugClient
+ *
+ * Return the #TpDebugClient:enabled property
+ *
+ * Returns: the value of #TpDebugClient:enabled property
+ *
+ * Since: UNRELEASED
+ */
+gboolean
+tp_debug_client_is_enabled (TpDebugClient *self)
+{
+ return self->priv->enabled;
+}
diff --git a/telepathy-glib/debug-client.h b/telepathy-glib/debug-client.h
index 8ac4e4f..9a38b4b 100644
--- a/telepathy-glib/debug-client.h
+++ b/telepathy-glib/debug-client.h
@@ -50,6 +50,8 @@ gboolean tp_debug_client_set_enabled_finish (
GAsyncResult *result,
GError **error);
+gboolean tp_debug_client_is_enabled (TpDebugClient *self);
+
/* Tedious GObject boilerplate */
GType tp_debug_client_get_type (void);
More information about the telepathy-commits
mailing list