telepathy-glib: Add tp_account_channel_request_set_hint API
Sjoerd Simons
sjoerd at kemper.freedesktop.org
Thu Aug 30 02:31:35 PDT 2012
Module: telepathy-glib
Branch: master
Commit: 6a1bdcf39bb16c77b25004b77c9272f3dfe0af3d
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=6a1bdcf39bb16c77b25004b77c9272f3dfe0af3d
Author: Sjoerd Simons <sjoerd.simons at collabora.co.uk>
Date: Thu Aug 30 09:29:30 2012 +0200
Add tp_account_channel_request_set_hint API
And an easy and bindable API to add a single hint to the hints
dictionary
---
docs/reference/telepathy-glib-sections.txt | 1 +
telepathy-glib/account-channel-request.c | 36 ++++++++++++++++++++++++++++
telepathy-glib/account-channel-request.h | 4 +++
3 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 1cee1f2..8f4eb54 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -6155,6 +6155,7 @@ tp_account_channel_request_ensure_and_observe_channel_async
tp_account_channel_request_ensure_and_observe_channel_finish
tp_account_channel_request_set_channel_factory
tp_account_channel_request_get_channel_request
+tp_account_channel_request_set_hint
tp_account_channel_request_set_hints
tp_account_channel_request_set_delegate_to_preferred_handler
TpAccountChannelRequestDelegatedChannelCb
diff --git a/telepathy-glib/account-channel-request.c b/telepathy-glib/account-channel-request.c
index ef5b6eb..899c82c 100644
--- a/telepathy-glib/account-channel-request.c
+++ b/telepathy-glib/account-channel-request.c
@@ -1619,6 +1619,42 @@ tp_account_channel_request_ensure_and_observe_channel_finish (
}
/**
+ * tp_account_channel_request_set_hint:
+ * @self: a #TpAccountChannelRequest
+ * @key: the key used for the hint
+ * @value: (transfer none): a variant containting the hint value
+ *
+ * Set additional information about the channel request, which will be used
+ * in the resulting request's #TpChannelRequest:hints property.
+ *
+ * This function can't be called once @self has been used to request a
+ * channel.
+ *
+ * Since: 0.UNRELEASED
+ */
+void
+tp_account_channel_request_set_hint (TpAccountChannelRequest *self,
+ const gchar *key,
+ GVariant *value)
+{
+ GValue one = G_VALUE_INIT, *two;
+
+ g_return_if_fail (!self->priv->requested);
+ g_return_if_fail (key != NULL);
+ g_return_if_fail (value != NULL);
+
+ if (self->priv->hints == NULL)
+ self->priv->hints = tp_asv_new (NULL, NULL);
+
+ dbus_g_value_parse_g_variant (value, &one);
+ two = tp_g_value_slice_dup (&one);
+
+ g_hash_table_insert (self->priv->hints, g_strdup (key), two);
+
+ g_value_unset (&one);
+}
+
+/**
* tp_account_channel_request_set_hints:
* @self: a #TpAccountChannelRequest
* @hints: a #TP_HASH_TYPE_STRING_VARIANT_MAP
diff --git a/telepathy-glib/account-channel-request.h b/telepathy-glib/account-channel-request.h
index efe0bb4..818cba2 100644
--- a/telepathy-glib/account-channel-request.h
+++ b/telepathy-glib/account-channel-request.h
@@ -86,6 +86,10 @@ void tp_account_channel_request_set_channel_factory (
TpChannelRequest * tp_account_channel_request_get_channel_request (
TpAccountChannelRequest *self);
+void tp_account_channel_request_set_hint (TpAccountChannelRequest *self,
+ const gchar *key,
+ GVariant *value);
+
void tp_account_channel_request_set_hints (TpAccountChannelRequest *self,
GHashTable *hints);
More information about the telepathy-commits
mailing list