summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-09-19 14:07:52 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-09-26 13:51:42 +0200
commit69305347a64f5cb3ac69db067f525855f6eeaa9c (patch)
tree455d4d5a73cad0b70aadbd9e323189185bc7ba59
parent3a7bc0a5b62c8eae5a3226ffbdfeffa7f1541e03 (diff)
downloadtelepathy-glib-69305347a64f5cb3ac69db067f525855f6eeaa9c.tar.gz
tp_channel_request_dup_hints: add
https://bugs.freedesktop.org/show_bug.cgi?id=55103
-rw-r--r--docs/reference/telepathy-glib-sections.txt1
-rw-r--r--telepathy-glib/channel-request.c48
-rw-r--r--telepathy-glib/channel-request.h3
-rw-r--r--tests/dbus/channel-request.c11
4 files changed, 63 insertions, 0 deletions
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 691d68ea1..8c2949c4f 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -5527,6 +5527,7 @@ tp_channel_request_get_account
tp_channel_request_get_user_action_time
tp_channel_request_get_preferred_handler
tp_channel_request_get_hints
+tp_channel_request_dup_hints
<SUBSECTION>
tp_cli_channel_request_callback_for_cancel
tp_cli_channel_request_call_cancel
diff --git a/telepathy-glib/channel-request.c b/telepathy-glib/channel-request.c
index 69f44e902..639a22356 100644
--- a/telepathy-glib/channel-request.c
+++ b/telepathy-glib/channel-request.c
@@ -40,6 +40,7 @@
#include "telepathy-glib/deprecated-internal.h"
#include "telepathy-glib/proxy-internal.h"
#include "telepathy-glib/simple-client-factory-internal.h"
+#include "telepathy-glib/variant-util-internal.h"
#include "telepathy-glib/_gen/tp-cli-channel-request-body.h"
/**
@@ -109,6 +110,7 @@ enum {
PROP_USER_ACTION_TIME,
PROP_PREFERRED_HANDLER,
PROP_HINTS,
+ PROP_HINTS_VARDICT
};
static guint signals[N_SIGNALS] = { 0 };
@@ -192,6 +194,10 @@ tp_channel_request_get_property (GObject *object,
g_value_set_boxed (value, tp_channel_request_get_hints (self));
break;
+ case PROP_HINTS_VARDICT:
+ g_value_take_variant (value, tp_channel_request_dup_hints (self));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -475,6 +481,23 @@ tp_channel_request_class_init (TpChannelRequestClass *klass)
g_object_class_install_property (object_class, PROP_HINTS, param_spec);
/**
+ * TpChannelRequest:hints-vardict:
+ *
+ * A %G_VARIANT_TYPE_VARDICT of metadata provided by
+ * the channel requester; or %NULL if #TpChannelRequest:immutable-properties
+ * is not defined or if no hints have been defined.
+ *
+ * Read-only.
+ *
+ * Since: 0.UNRELEASED
+ */
+ param_spec = g_param_spec_variant ("hints-vardict", "Hints", "Hints",
+ G_VARIANT_TYPE_VARDICT, NULL,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_HINTS_VARDICT,
+ param_spec);
+
+ /**
* TpChannelRequest::succeeded:
* @self: the channel request proxy
*
@@ -775,3 +798,28 @@ tp_channel_request_get_hints (TpChannelRequest *self)
return tp_asv_get_boxed (self->priv->immutable_properties,
TP_PROP_CHANNEL_REQUEST_HINTS, TP_HASH_TYPE_STRING_VARIANT_MAP);
}
+
+/**
+ * tp_channel_request_dup_hints:
+ * @self: a #TpChannelRequest
+ *
+ * Return the #TpChannelRequest:hints-vardict property
+ *
+ * Returns: (transfer full): the value of #TpChannelRequest:hints-vardict
+ *
+ * Since: 0.UNRELEASED
+ */
+GVariant *
+tp_channel_request_dup_hints (TpChannelRequest *self)
+{
+ const GHashTable *hints;
+
+ g_return_val_if_fail (TP_IS_CHANNEL_REQUEST (self), NULL);
+
+ hints = tp_channel_request_get_hints (self);
+
+ if (hints == NULL)
+ return NULL;
+
+ return _tp_asv_to_vardict (hints);
+}
diff --git a/telepathy-glib/channel-request.h b/telepathy-glib/channel-request.h
index 85a943756..7fcbf325b 100644
--- a/telepathy-glib/channel-request.h
+++ b/telepathy-glib/channel-request.h
@@ -96,6 +96,9 @@ const gchar * tp_channel_request_get_preferred_handler (TpChannelRequest *self);
const GHashTable * tp_channel_request_get_hints (TpChannelRequest *self);
+_TP_AVAILABLE_IN_UNRELEASED
+GVariant *tp_channel_request_dup_hints (TpChannelRequest *self);
+
G_END_DECLS
#include <telepathy-glib/_gen/tp-cli-channel-request.h>
diff --git a/tests/dbus/channel-request.c b/tests/dbus/channel-request.c
index 5d8318267..779a110fa 100644
--- a/tests/dbus/channel-request.c
+++ b/tests/dbus/channel-request.c
@@ -350,6 +350,7 @@ test_properties (Test *test,
TpAccount *account;
gint64 user_action_time;
const gchar *handler;
+ GVariant *vardict;
hints = tp_asv_new ("test", G_TYPE_STRING, "hi", NULL);
@@ -402,6 +403,16 @@ test_properties (Test *test,
g_assert_cmpstr (tp_asv_get_string (hints, "test"), ==, "hi");
g_hash_table_unref (hints);
+
+ vardict = tp_channel_request_dup_hints (test->cr);
+ g_assert_cmpstr (tp_vardict_get_string (vardict, "test"), ==, "hi");
+ g_variant_unref (vardict);
+
+ g_object_get (test->cr,
+ "hints-vardict", &vardict,
+ NULL);
+ g_assert_cmpstr (tp_vardict_get_string (vardict, "test"), ==, "hi");
+ g_variant_unref (vardict);
}
int