aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-08-18 19:58:53 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-08-19 15:26:26 +0800
commit8b69b96e01c9b11ac779dcce99c21a1aa7fba7a3 (patch)
tree67a15b9bc615c4732b8c2ef255eacc808404c285 /libempathy-gtk
parent7cbbd2ee8253dfd69994d83e0dfe1a63c7ca4fd0 (diff)
downloadgsoc2013-empathy-8b69b96e01c9b11ac779dcce99c21a1aa7fba7a3.tar
gsoc2013-empathy-8b69b96e01c9b11ac779dcce99c21a1aa7fba7a3.tar.gz
gsoc2013-empathy-8b69b96e01c9b11ac779dcce99c21a1aa7fba7a3.tar.bz2
gsoc2013-empathy-8b69b96e01c9b11ac779dcce99c21a1aa7fba7a3.tar.lz
gsoc2013-empathy-8b69b96e01c9b11ac779dcce99c21a1aa7fba7a3.tar.xz
gsoc2013-empathy-8b69b96e01c9b11ac779dcce99c21a1aa7fba7a3.tar.zst
gsoc2013-empathy-8b69b96e01c9b11ac779dcce99c21a1aa7fba7a3.zip
contact-search-dialog: rely on the factory to prepare TP_CONNECTION_FEATURE_AVATAR_REQUIREMENTS
https://bugzilla.gnome.org/show_bug.cgi?id=656831
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-contact-search-dialog.c60
1 files changed, 10 insertions, 50 deletions
diff --git a/libempathy-gtk/empathy-contact-search-dialog.c b/libempathy-gtk/empathy-contact-search-dialog.c
index a265fa6b2..8b2f7f3b5 100644
--- a/libempathy-gtk/empathy-contact-search-dialog.c
+++ b/libempathy-gtk/empathy-contact-search-dialog.c
@@ -379,37 +379,6 @@ on_server_changed_cb (GtkEditable *editable,
}
#endif
-typedef struct
-{
- EmpathyAccountChooserFilterResultCallback callback;
- gpointer user_data;
-} FilterCallbackData;
-
-static void
-supports_contact_search_cb (GObject *conn,
- GAsyncResult *result,
- gpointer user_data)
-{
- FilterCallbackData *data = user_data;
- GError *error = NULL;
- TpCapabilities *caps;
-
- if (!tp_proxy_prepare_finish (conn, result, &error))
- {
- DEBUG ("Error preparing the connection: %s", error->message);
- data->callback (FALSE, data->user_data);
- g_error_free (error);
- g_slice_free (FilterCallbackData, data);
- return;
- }
-
- caps = tp_connection_get_capabilities (TP_CONNECTION (conn));
- data->callback (tp_capabilities_supports_contact_search (caps, NULL, NULL),
- data->user_data);
-
- g_slice_free (FilterCallbackData, data);
-}
-
static void
empathy_account_chooser_filter_supports_contact_search (
TpAccount *account,
@@ -418,30 +387,21 @@ empathy_account_chooser_filter_supports_contact_search (
gpointer user_data)
{
TpConnection *connection;
- FilterCallbackData *cb_data;
- GQuark features[] = { TP_CONNECTION_FEATURE_CAPABILITIES, 0 };
-
- if (tp_account_get_connection_status (account, NULL)
- != TP_CONNECTION_STATUS_CONNECTED)
- {
- callback (FALSE, callback_data);
- return;
- }
+ gboolean supported = FALSE;
+ TpCapabilities *caps;
- /* check if CM supports contact search */
connection = tp_account_get_connection (account);
if (connection == NULL)
- {
- callback (FALSE, callback_data);
- return;
- }
+ goto out;
+
+ caps = tp_connection_get_capabilities (connection);
+ if (caps == NULL)
+ goto out;
- cb_data = g_slice_new0 (FilterCallbackData);
- cb_data->callback = callback;
- cb_data->user_data = callback_data;
+ supported = tp_capabilities_supports_contact_search (caps, NULL, NULL);
- tp_proxy_prepare_async (connection, features, supports_contact_search_cb,
- cb_data);
+out:
+ callback (supported, callback_data);
}
static void