From cc9b02bd55fd0a54a358c0724016bc5230b4ea5e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 19 Sep 2012 15:40:29 +0100 Subject: [PATCH 04/15] TpDBusTubeChannel: add parameters-vardict Signed-off-by: Simon McVittie Bug: https://bugs.freedesktop.org/show_bug.cgi?id=55095 --- telepathy-glib/dbus-tube-channel.c | 29 ++++++++++++++++++++++++++++- tests/dbus/dbus-tube.c | 6 ++++++ 2 files changed, 34 insertions(+), 1 deletion(-) 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", ¶meters_vardict, + NULL); + check_parameters_vardict (parameters_vardict); + g_variant_unref (parameters_vardict); } static void -- 1.7.10.4