summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2014-03-26 13:52:30 -0400
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-03-27 15:35:05 +0000
commit7e42919268f02802c33489705a25603dcee2c2b4 (patch)
tree4da9aec42313225249ab7c71dd97f225e4e378d5
parentf61bd5eee438b338a1e430298285d1026c5077b6 (diff)
downloadtelepathy-glib-7e42919268f02802c33489705a25603dcee2c2b4.tar.gz
TpConnection: Remove tp_list_connection_names()
Applications should use TpAccountManager to list online accounts. The only user of this function is MissionControl but it can call ListNames itself. Note that example code was even wrong. It says "list installed connection managers" but what is actually do is listing currently running CMs. Conflicts: examples/client/Makefile.am Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r--docs/reference/telepathy-glib/telepathy-glib-sections.txt2
-rw-r--r--examples/client/Makefile.am3
-rw-r--r--examples/client/list-connections.c89
-rw-r--r--telepathy-glib/connection.c136
-rw-r--r--telepathy-glib/connection.h10
-rw-r--r--telepathy-glib/versions/main-1.0.abi1
6 files changed, 0 insertions, 241 deletions
diff --git a/docs/reference/telepathy-glib/telepathy-glib-sections.txt b/docs/reference/telepathy-glib/telepathy-glib-sections.txt
index 4493bec65..baa1447eb 100644
--- a/docs/reference/telepathy-glib/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib/telepathy-glib-sections.txt
@@ -3245,8 +3245,6 @@ tp_cli_connection_interface_service_point1_signal_callback_service_points_change
<FILE>connection</FILE>
<TITLE>connection</TITLE>
<INCLUDE>telepathy-glib/telepathy-glib.h</INCLUDE>
-TpConnectionNameListCb
-tp_list_connection_names
TpConnection
TpConnectionClass
TP_CONNECTION_FEATURE_CORE
diff --git a/examples/client/Makefile.am b/examples/client/Makefile.am
index bacb0f61b..4e69b47c5 100644
--- a/examples/client/Makefile.am
+++ b/examples/client/Makefile.am
@@ -14,9 +14,6 @@ telepathy_1_example_inspect_contact_SOURCES = inspect-contact.c
EXAMPLES += telepathy-1-example-inspect-cm
telepathy_1_example_inspect_cm_SOURCES = inspect-cm.c
-EXAMPLES += telepathy-1-example-list-connections
-telepathy_1_example_list_connections_SOURCES = list-connections.c
-
EXAMPLES += telepathy-1-example-list-managers
telepathy_1_example_list_managers_SOURCES = list-managers.c
diff --git a/examples/client/list-connections.c b/examples/client/list-connections.c
deleted file mode 100644
index 3df69ee1e..000000000
--- a/examples/client/list-connections.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * telepathy-example-list-managers - list installed connection managers
- *
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * Copying and distribution of this file, with or without modification,
- * are permitted in any medium without royalty provided the copyright
- * notice and this notice are preserved.
- */
-
-#include "config.h"
-
-#include <telepathy-glib/telepathy-glib.h>
-
-typedef struct {
- GMainLoop *mainloop;
- int exit_code;
-} ExampleData;
-
-static void
-got_connections (const gchar * const *bus_names,
- gsize n,
- const gchar * const *cms,
- const gchar * const *protocols,
- const GError *error,
- gpointer user_data,
- GObject *unused)
-{
- ExampleData *data = user_data;
-
- if (error != NULL)
- {
- g_warning ("%s", error->message);
- data->exit_code = 1;
- }
- else
- {
- gsize i;
-
- g_message ("Found %" G_GSIZE_FORMAT " connections:", n);
-
- for (i = 0; i < n; i++)
- {
- g_message ("%s", bus_names[i]);
- g_message ("- CM %s, protocol %s", cms[i], protocols[i]);
- }
-
- /* all the arrays are also NULL-terminated */
- g_assert (bus_names[n] == NULL && cms[n] == NULL &&
- protocols[n] == NULL);
- }
-
- g_main_loop_quit (data->mainloop);
-}
-
-int
-main (int argc,
- char **argv)
-{
- ExampleData data = { g_main_loop_new (NULL, FALSE), 0 };
- TpDBusDaemon *bus_daemon;
- GError *error = NULL;
-
- tp_debug_set_flags (g_getenv ("EXAMPLE_DEBUG"));
-
- bus_daemon = tp_dbus_daemon_dup (&error);
-
- if (bus_daemon == NULL)
- {
- g_warning ("%s", error->message);
- g_error_free (error);
- data.exit_code = 1;
- goto out;
- }
-
- tp_list_connection_names (bus_daemon, got_connections, &data, NULL, NULL);
-
- g_main_loop_run (data.mainloop);
-
-out:
- if (data.mainloop != NULL)
- g_main_loop_unref (data.mainloop);
-
- if (bus_daemon != NULL)
- g_object_unref (bus_daemon);
-
- return data.exit_code;
-}
diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c
index b81ca7dfc..26ce9329c 100644
--- a/telepathy-glib/connection.c
+++ b/telepathy-glib/connection.c
@@ -2140,32 +2140,6 @@ tp_connection_get_protocol_name (TpConnection *self)
return self->priv->proto_name;
}
-/**
- * TpConnectionNameListCb:
- * @names: (array zero-terminated=1): %NULL-terminated array of @n
- * connection bus names, or %NULL on error
- * @n: number of names (not including the final %NULL), or 0 on error
- * @cms: (array zero-terminated=1): %NULL-terminated array of @n
- * connection manager names (e.g. "gabble") in the same order as @names, or
- * %NULL on error
- * @protocols: (array zero-terminated=1): %NULL-terminated array of
- * @n protocol names as defined in the Telepathy spec (e.g. "jabber") in the
- * same order as @names, or %NULL on error
- * @error: %NULL on success, or an error that occurred
- * @user_data: user-supplied data
- * @weak_object: user-supplied weakly referenced object
- *
- * Signature of the callback supplied to tp_list_connection_names().
- *
- * Since: 0.7.1
- */
-
-typedef struct {
- TpConnectionNameListCb callback;
- gpointer user_data;
- GDestroyNotify destroy;
-} _ListContext;
-
static gboolean
_tp_connection_parse (const gchar *path_or_bus_name,
char delimiter,
@@ -2242,116 +2216,6 @@ OUT:
return TRUE;
}
-static void
-tp_list_connection_names_helper (TpDBusDaemon *bus_daemon,
- const gchar * const *names,
- const GError *error,
- gpointer user_data,
- GObject *user_object)
-{
- _ListContext *list_context = user_data;
- const gchar * const *iter;
- /* array of borrowed strings */
- GPtrArray *bus_names;
- /* array of dup'd strings */
- GPtrArray *cms;
- /* array of borrowed strings */
- GPtrArray *protocols;
-
- if (error != NULL)
- {
- list_context->callback (NULL, 0, NULL, NULL, error,
- list_context->user_data, user_object);
- return;
- }
-
- bus_names = g_ptr_array_new ();
- cms = g_ptr_array_new ();
- protocols = g_ptr_array_new ();
-
- for (iter = names; iter != NULL && *iter != NULL; iter++)
- {
- gchar *proto, *cm_name;
-
- if (_tp_connection_parse (*iter, '.', &proto, &cm_name))
- {
- /* the casts here are because g_ptr_array contains non-const pointers -
- * but in this case I'll only be passing pdata to a callback with const
- * arguments, so it's fine */
- g_ptr_array_add (bus_names, (gpointer) *iter);
- g_ptr_array_add (cms, cm_name);
- g_ptr_array_add (protocols, proto);
- continue;
- }
- }
-
- g_ptr_array_add (bus_names, NULL);
- g_ptr_array_add (cms, NULL);
- g_ptr_array_add (protocols, NULL);
-
- list_context->callback ((const gchar * const *) bus_names->pdata,
- bus_names->len - 1, (const gchar * const *) cms->pdata,
- (const gchar * const *) protocols->pdata,
- NULL, list_context->user_data, user_object);
-
- g_ptr_array_unref (bus_names);
- g_strfreev ((char **) g_ptr_array_free (cms, FALSE));
- g_strfreev ((char **) g_ptr_array_free (protocols, FALSE));
-}
-
-static void
-list_context_free (gpointer p)
-{
- _ListContext *list_context = p;
-
- if (list_context->destroy != NULL)
- list_context->destroy (list_context->user_data);
-
- g_slice_free (_ListContext, list_context);
-}
-
-/**
- * tp_list_connection_names:
- * @bus_daemon: proxy for the D-Bus daemon
- * @callback: callback to be called when listing the connections succeeds or
- * fails; not called if the D-Bus connection fails completely or if the
- * @weak_object goes away
- * @user_data: user-supplied data for the callback
- * @destroy: callback to destroy the user-supplied data, called after
- * @callback, but also if the D-Bus connection fails or if the @weak_object
- * goes away
- * @weak_object: (allow-none): if not %NULL, will be weakly referenced; the callback will
- * not be called if the object has vanished
- *
- * List the bus names of all the connections that currently exist, together
- * with the connection manager name and the protocol name for each connection.
- * Call the callback when done.
- *
- * The bus names passed to the callback can be used to construct #TpConnection
- * objects for any connections that are of interest.
- *
- * Since: 0.7.1
- */
-void
-tp_list_connection_names (TpDBusDaemon *bus_daemon,
- TpConnectionNameListCb callback,
- gpointer user_data,
- GDestroyNotify destroy,
- GObject *weak_object)
-{
- _ListContext *list_context = g_slice_new0 (_ListContext);
-
- g_return_if_fail (TP_IS_DBUS_DAEMON (bus_daemon));
- g_return_if_fail (callback != NULL);
-
- list_context->callback = callback;
- list_context->user_data = user_data;
-
- tp_dbus_daemon_list_names (bus_daemon, 2000,
- tp_list_connection_names_helper, list_context,
- list_context_free, weak_object);
-}
-
static guint
get_presence_type_availability (TpConnectionPresenceType type)
{
diff --git a/telepathy-glib/connection.h b/telepathy-glib/connection.h
index 183f2d76e..76704d7ec 100644
--- a/telepathy-glib/connection.h
+++ b/telepathy-glib/connection.h
@@ -167,16 +167,6 @@ void tp_connection_set_contact_info_async (TpConnection *self,
gboolean tp_connection_set_contact_info_finish (TpConnection *self,
GAsyncResult *result, GError **error);
-typedef void (*TpConnectionNameListCb) (const gchar * const *names,
- gsize n, const gchar * const *cms, const gchar * const *protocols,
- const GError *error, gpointer user_data,
- GObject *weak_object);
-
-void tp_list_connection_names (TpDBusDaemon *bus_daemon,
- TpConnectionNameListCb callback,
- gpointer user_data, GDestroyNotify destroy,
- GObject *weak_object);
-
gint tp_connection_presence_type_cmp_availability (TpConnectionPresenceType p1,
TpConnectionPresenceType p2);
diff --git a/telepathy-glib/versions/main-1.0.abi b/telepathy-glib/versions/main-1.0.abi
index 1cfc87250..6f8377ee2 100644
--- a/telepathy-glib/versions/main-1.0.abi
+++ b/telepathy-glib/versions/main-1.0.abi
@@ -1009,7 +1009,6 @@ tp_intset_union
tp_intset_union_update
tp_list_connection_managers_async
tp_list_connection_managers_finish
-tp_list_connection_names
tp_logger_dup
tp_logger_get_type
tp_message_append_part