[empathy] contact-search-dialog: rely on the factory to prepare TP_CONNECTION_FEATURE_AVATAR_REQUIREMENTS
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] contact-search-dialog: rely on the factory to prepare TP_CONNECTION_FEATURE_AVATAR_REQUIREMENTS
- Date: Fri, 19 Aug 2011 07:29:50 +0000 (UTC)
commit 8b69b96e01c9b11ac779dcce99c21a1aa7fba7a3
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Thu Aug 18 13:58:53 2011 +0200
contact-search-dialog: rely on the factory to prepare TP_CONNECTION_FEATURE_AVATAR_REQUIREMENTS
https://bugzilla.gnome.org/show_bug.cgi?id=656831
libempathy-gtk/empathy-contact-search-dialog.c | 60 ++++--------------------
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 a265fa6..8b2f7f3 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]