diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2014-02-28 17:01:02 +0100 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2014-02-28 17:01:02 +0100 |
commit | e8c68230750766d6dc1d5594cc898f2d914c91fb (patch) | |
tree | 84b0802999bf15fbd1088762e745ab207251a5b7 /telepathy-glib | |
parent | de7f581297e8cc50d5fe9694bbccfb7e131ee009 (diff) | |
download | telepathy-glib-e8c68230750766d6dc1d5594cc898f2d914c91fb.tar.gz |
add tp_protocol_new_vardict()
Diffstat (limited to 'telepathy-glib')
-rw-r--r-- | telepathy-glib/protocol.c | 39 | ||||
-rw-r--r-- | telepathy-glib/protocol.h | 6 |
2 files changed, 45 insertions, 0 deletions
diff --git a/telepathy-glib/protocol.c b/telepathy-glib/protocol.c index 766beda4d..c238d49d4 100644 --- a/telepathy-glib/protocol.c +++ b/telepathy-glib/protocol.c @@ -1015,6 +1015,45 @@ finally: } /** + * tp_protocol_new_vardict: + * @dbus: proxy for the D-Bus daemon; may not be %NULL + * @cm_name: the connection manager name (such as "gabble") + * @protocol_name: the protocol name (such as "jabber") + * @immutable_properties: the immutable D-Bus properties for this protocol + * @error: used to indicate the error if %NULL is returned + * + * Create a new protocol proxy. + * + * If @immutable_properties is a floating reference, this function will + * take ownership of it, much like g_variant_ref_sink(). See documentation of + * that function for details. + * + * Returns: a new protocol proxy, or %NULL on invalid arguments + * + * Since: 0.UNRELEASED + */ +TpProtocol * +tp_protocol_new_vardict (TpDBusDaemon *dbus, + const gchar *cm_name, + const gchar *protocol_name, + GVariant *immutable_properties, + GError **error) +{ + GHashTable *hash; + TpProtocol *ret; + + g_return_val_if_fail (g_variant_is_of_type (immutable_properties, + G_VARIANT_TYPE_VARDICT), NULL); + + g_variant_ref_sink (immutable_properties); + hash = _tp_asv_from_vardict (immutable_properties); + ret = tp_protocol_new (dbus, cm_name, protocol_name, hash, error); + g_hash_table_unref (hash); + g_variant_unref (immutable_properties); + return ret; +} + +/** * tp_protocol_init_known_interfaces: * * Ensure that the known interfaces for TpProtocol have been set up. diff --git a/telepathy-glib/protocol.h b/telepathy-glib/protocol.h index 5d964ea5f..22cf5ff9a 100644 --- a/telepathy-glib/protocol.h +++ b/telepathy-glib/protocol.h @@ -81,6 +81,12 @@ TpProtocol *tp_protocol_new (TpDBusDaemon *dbus, const gchar *cm_name, const gchar *protocol_name, const GHashTable *immutable_properties, GError **error); +TpProtocol * tp_protocol_new_vardict (TpDBusDaemon *dbus, + const gchar *cm_name, + const gchar *protocol_name, + GVariant *immutable_properties, + GError **error); + const gchar *tp_protocol_get_name (TpProtocol *self); _TP_AVAILABLE_IN_0_20 |