summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-09-19 14:20:51 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-09-19 16:10:33 +0100
commitc237ecf7801545344e76125f7db2ccdd84b0f427 (patch)
tree86dc4f72071cbb1d584c363684f229bf0900799b
parent360d0c7f539ee8975d9e2d25d58bf7e5b83ed245 (diff)
tp_channel_request_dup_immutable_properties: addvariant
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=55101
-rw-r--r--docs/reference/telepathy-glib-sections.txt1
-rw-r--r--telepathy-glib/channel-request.c50
-rw-r--r--telepathy-glib/channel-request.h3
-rw-r--r--tests/dbus/channel-request.c10
4 files changed, 64 insertions, 0 deletions
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 805c2ca5f..f50622707 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -5527,6 +5527,7 @@ tp_channel_request_new
tp_channel_request_init_known_interfaces
tp_channel_request_set_channel_factory
tp_channel_request_get_immutable_properties
+tp_channel_request_dup_immutable_properties
tp_channel_request_get_account
tp_channel_request_get_user_action_time
tp_channel_request_get_preferred_handler
diff --git a/telepathy-glib/channel-request.c b/telepathy-glib/channel-request.c
index 639a22356..a50892fee 100644
--- a/telepathy-glib/channel-request.c
+++ b/telepathy-glib/channel-request.c
@@ -106,6 +106,7 @@ enum {
enum {
PROP_CHANNEL_FACTORY = 1,
PROP_IMMUTABLE_PROPERTIES,
+ PROP_IMMUTABLE_PROPERTIES_VARDICT,
PROP_ACCOUNT,
PROP_USER_ACTION_TIME,
PROP_PREFERRED_HANDLER,
@@ -176,6 +177,11 @@ tp_channel_request_get_property (GObject *object,
g_value_set_boxed (value, self->priv->immutable_properties);
break;
+ case PROP_IMMUTABLE_PROPERTIES_VARDICT:
+ g_value_take_variant (value,
+ tp_channel_request_dup_immutable_properties (self));
+ break;
+
case PROP_ACCOUNT:
g_value_set_object (value, tp_channel_request_get_account (self));
break;
@@ -414,6 +420,28 @@ tp_channel_request_class_init (TpChannelRequestClass *klass)
param_spec);
/**
+ * TpChannelRequest:immutable-properties-vardict:
+ *
+ * The immutable D-Bus properties of this channel request, represented by a
+ * %G_VARIANT_TYPE_VARDICT where the keys are
+ * D-Bus interface name + "." + property name.
+ *
+ * Note that this property is set only if the immutable properties have been
+ * set during the construction of the #TpChannelRequest.
+ *
+ * Read-only except during construction.
+ *
+ * Since: 0.UNRELEASED
+ */
+ param_spec = g_param_spec_variant ("immutable-properties-vardict",
+ "Immutable D-Bus properties",
+ "A map D-Bus interface + \".\" + property name => variant",
+ G_VARIANT_TYPE_VARDICT, NULL,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class,
+ PROP_IMMUTABLE_PROPERTIES_VARDICT, param_spec);
+
+ /**
* TpChannelRequest:account:
*
* The #TpAccount on which this request was made, not guaranteed
@@ -686,6 +714,28 @@ tp_channel_request_get_immutable_properties (TpChannelRequest *self)
return self->priv->immutable_properties;
}
+/**
+ * tp_channel_request_dup_immutable_properties:
+ * @self: a #TpChannelRequest
+ *
+ * Return the #TpChannelRequest:immutable-properties-vardict property.
+ *
+ * Returns: (transfer full): the value of
+ * #TpChannelRequest:immutable-properties-vardict
+ *
+ * Since: 0.UNRELEASED
+ */
+GVariant *
+tp_channel_request_dup_immutable_properties (TpChannelRequest *self)
+{
+ g_return_val_if_fail (TP_IS_CHANNEL_REQUEST (self), NULL);
+
+ if (self->priv->immutable_properties == NULL)
+ return NULL;
+
+ return _tp_asv_to_vardict (self->priv->immutable_properties);
+}
+
void
_tp_channel_request_ensure_immutable_properties (TpChannelRequest *self,
GHashTable *immutable_properties)
diff --git a/telepathy-glib/channel-request.h b/telepathy-glib/channel-request.h
index 7fcbf325b..61e2cd8eb 100644
--- a/telepathy-glib/channel-request.h
+++ b/telepathy-glib/channel-request.h
@@ -88,6 +88,9 @@ void tp_channel_request_set_channel_factory (TpChannelRequest *self,
const GHashTable * tp_channel_request_get_immutable_properties (
TpChannelRequest *self);
+_TP_AVAILABLE_IN_UNRELEASED
+GVariant *tp_channel_request_dup_immutable_properties (TpChannelRequest *self);
+
TpAccount * tp_channel_request_get_account (TpChannelRequest *self);
gint64 tp_channel_request_get_user_action_time (TpChannelRequest *self);
diff --git a/tests/dbus/channel-request.c b/tests/dbus/channel-request.c
index 779a110fa..c09d9390f 100644
--- a/tests/dbus/channel-request.c
+++ b/tests/dbus/channel-request.c
@@ -317,6 +317,7 @@ test_immutable_properties (Test *test,
{
gboolean ok;
GHashTable *props;
+ GVariant *vardict;
props = tp_asv_new ("badger", G_TYPE_UINT, 42,
NULL);
@@ -337,6 +338,15 @@ test_immutable_properties (Test *test,
g_assert_cmpuint (tp_asv_get_uint32 (props, "badger", NULL), ==, 42);
g_hash_table_unref (props);
+
+ vardict = tp_channel_request_dup_immutable_properties (test->cr);
+ g_assert_cmpuint (tp_vardict_get_uint32 (vardict, "badger", NULL), ==, 42);
+ g_variant_unref (vardict);
+
+ g_object_get (test->cr,
+ "immutable-properties-vardict", &vardict, NULL);
+ g_assert_cmpuint (tp_vardict_get_uint32 (vardict, "badger", NULL), ==, 42);
+ g_variant_unref (vardict);
}
#define ACCOUNT_PATH TP_ACCOUNT_OBJECT_PATH_BASE "a/b/c"