diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2012-08-30 09:29:30 +0200 |
---|---|---|
committer | Sjoerd Simons <sjoerd@luon.net> | 2012-08-30 11:28:39 +0200 |
commit | 6a1bdcf39bb16c77b25004b77c9272f3dfe0af3d (patch) | |
tree | 8c19c167b30d6204e34464326ff050db3a2a668e | |
parent | 5ce5818887f0d72a5e615c5e293e3eae39965394 (diff) |
Add tp_account_channel_request_set_hint API
And an easy and bindable API to add a single hint to the hints
dictionary
-rw-r--r-- | docs/reference/telepathy-glib-sections.txt | 1 | ||||
-rw-r--r-- | telepathy-glib/account-channel-request.c | 36 | ||||
-rw-r--r-- | 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 1cee1f224..8f4eb54f5 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 ef5b6ebd4..899c82c4e 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 efe0bb42b..818cba25e 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); |