summaryrefslogtreecommitdiff
path: root/telepathy-glib/connection-manager.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-03-07 14:32:28 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-03-09 15:58:13 +0000
commit1eae5f295c9b57a9a64df7b2c06dc56e627cc06a (patch)
tree418fd672148c85b10448a33d4245452d4897e0b9 /telepathy-glib/connection-manager.c
parentdcb1a9b3a6e3b822299dc1dcf6f8722879a3e43e (diff)
downloadtelepathy-glib-1eae5f295c9b57a9a64df7b2c06dc56e627cc06a.tar.gz
tp_connection_manager_dup_protocols: add
Again, this provides a more introspectable way to get the protocols. Combining dup_protocol_names() and get_protocol() is more type-safe, but less obvious. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46358 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'telepathy-glib/connection-manager.c')
-rw-r--r--telepathy-glib/connection-manager.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/telepathy-glib/connection-manager.c b/telepathy-glib/connection-manager.c
index 3a4aacdf2..b82a99e72 100644
--- a/telepathy-glib/connection-manager.c
+++ b/telepathy-glib/connection-manager.c
@@ -83,10 +83,10 @@
* on a #TpConnectionManager.
*
* After this feature is prepared, basic information about the connection
- * manager's protocols (tp_connection_manager_get_protocol() and
- * tp_connection_manager_dup_protocol_names()), and their available parameters,
- * will have been retrieved, either by activating the connection manager over
- * D-Bus or by reading the .manager file in which that information is cached.
+ * manager's protocols (tp_connection_manager_dup_protocols()), and their
+ * available parameters, will have been retrieved, either by activating the
+ * connection manager over D-Bus or by reading the .manager file in which
+ * that information is cached.
*
* Since 0.11.11, this feature also finds any extra interfaces that
* this connection manager has, and adds them to #TpProxy:interfaces (where
@@ -2281,6 +2281,43 @@ tp_connection_manager_get_protocol_object (TpConnectionManager *self,
return g_hash_table_lookup (self->priv->protocol_objects, protocol);
}
+/* FIXME: in Telepathy 1.0, rename to get_protocols */
+/**
+ * tp_connection_manager_dup_protocols:
+ * @self: a connection manager
+ *
+ * Return objects representing all protocols supported by this connection
+ * manager.
+ *
+ * If this function is called before the connection manager information has
+ * been obtained, the result is always %NULL. Use tp_proxy_prepare_async()
+ * to wait for this.
+ *
+ * The caller must free the list, for instance with
+ * <literal>g_list_free_full (l, g_object_unref)</literal>.
+ *
+ * Returns: (transfer full) (element-type TelepathyGLib.Protocol): a list
+ * of #TpProtocol objects representing the protocols supported by @self,
+ * owned by the caller
+ *
+ * Since: 0.UNRELEASED
+ */
+GList *
+tp_connection_manager_dup_protocols (TpConnectionManager *self)
+{
+ GList *l;
+
+ g_return_val_if_fail (TP_IS_CONNECTION_MANAGER (self), NULL);
+
+ if (self->priv->protocol_objects == NULL)
+ return NULL;
+
+ l = g_hash_table_get_values (self->priv->protocol_objects);
+
+ g_list_foreach (l, (GFunc) g_object_ref, NULL);
+ return l;
+}
+
/**
* tp_connection_manager_has_protocol:
* @self: a connection manager