[next] telepathy-glib: TpDBusTubeChannel: add parameters-vardict

Simon McVittie smcv at kemper.freedesktop.org
Mon Oct 8 08:23:23 PDT 2012


Module: telepathy-glib
Branch: next
Commit: 3a7bc0a5b62c8eae5a3226ffbdfeffa7f1541e03
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=3a7bc0a5b62c8eae5a3226ffbdfeffa7f1541e03

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Wed Sep 19 15:40:29 2012 +0100

TpDBusTubeChannel: add parameters-vardict

Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=55095

https://bugs.freedesktop.org/show_bug.cgi?id=55024

---

 telepathy-glib/dbus-tube-channel.c |   29 ++++++++++++++++++++++++++++-
 tests/dbus/dbus-tube.c             |    6 ++++++
 2 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/telepathy-glib/dbus-tube-channel.c b/telepathy-glib/dbus-tube-channel.c
index 41ec5db..f2bb4fd 100644
--- a/telepathy-glib/dbus-tube-channel.c
+++ b/telepathy-glib/dbus-tube-channel.c
@@ -116,7 +116,8 @@ struct _TpDBusTubeChannelPrivate
 enum
 {
   PROP_SERVICE_NAME = 1,
-  PROP_PARAMETERS
+  PROP_PARAMETERS,
+  PROP_PARAMETERS_VARDICT
 };
 
 static void
@@ -151,6 +152,11 @@ tp_dbus_tube_channel_get_property (GObject *object,
         g_value_set_boxed (value, self->priv->parameters);
         break;
 
+      case PROP_PARAMETERS_VARDICT:
+        g_value_take_variant (value,
+            tp_dbus_tube_channel_dup_parameters_vardict (self));
+        break;
+
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
         break;
@@ -429,6 +435,10 @@ tp_dbus_tube_channel_class_init (TpDBusTubeChannelClass *klass)
    *
    * Will be %NULL for outgoing tubes until the tube has been offered.
    *
+   * In high-level language bindings, use
+   * tp_dbus_tube_channel_dup_parameters_vardict() to get the same information
+   * in a more convenient format.
+   *
    * Since: 0.18.0
    */
   param_spec = g_param_spec_boxed ("parameters", "Parameters",
@@ -437,6 +447,22 @@ tp_dbus_tube_channel_class_init (TpDBusTubeChannelClass *klass)
       G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
   g_object_class_install_property (gobject_class, PROP_PARAMETERS, param_spec);
 
+  /**
+   * TpDBusTubeChannel:parameters-vardict:
+   *
+   * A %G_VARIANT_TYPE_VARDICT representing the parameters of the tube.
+   *
+   * Will be %NULL for outgoing tubes until the tube has been offered.
+   *
+   * Since: 0.UNRELEASED
+   */
+  param_spec = g_param_spec_variant ("parameters-vardict", "Parameters",
+      "The parameters of the D-Bus tube",
+      G_VARIANT_TYPE_VARDICT, NULL,
+      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+  g_object_class_install_property (gobject_class, PROP_PARAMETERS_VARDICT,
+      param_spec);
+
   g_type_class_add_private (gobject_class, sizeof (TpDBusTubeChannelPrivate));
 }
 
@@ -614,6 +640,7 @@ proxy_prepare_offer_cb (GObject *source,
     self->priv->parameters = tp_asv_new (NULL, NULL);
 
   g_object_notify (G_OBJECT (self), "parameters");
+  g_object_notify (G_OBJECT (self), "parameters-vardict");
 
   /* TODO: provide a way to use TP_SOCKET_ACCESS_CONTROL_LOCALHOST if you're in
    * an environment where you need to disable authentication. tp-glib can't
diff --git a/tests/dbus/dbus-tube.c b/tests/dbus/dbus-tube.c
index 27ac21c..ae9c831 100644
--- a/tests/dbus/dbus-tube.c
+++ b/tests/dbus/dbus-tube.c
@@ -234,6 +234,12 @@ test_properties (Test *test,
 
   g_hash_table_unref (parameters);
   g_variant_unref (parameters_vardict);
+
+  g_object_get (test->tube,
+      "parameters-vardict", &parameters_vardict,
+      NULL);
+  check_parameters_vardict (parameters_vardict);
+  g_variant_unref (parameters_vardict);
 }
 
 static void



More information about the telepathy-commits mailing list