diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-08-18 23:17:49 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-08-19 15:26:26 +0800 |
commit | c9b5bba619706d6b1a45654f845e7722870a25df (patch) | |
tree | 8d52a2dc648bf8904d14c80770ab3f67ba625aac | |
parent | 686b4e258c29a7adde96606474e81929d62976b1 (diff) | |
download | gsoc2013-empathy-c9b5bba619706d6b1a45654f845e7722870a25df.tar gsoc2013-empathy-c9b5bba619706d6b1a45654f845e7722870a25df.tar.gz gsoc2013-empathy-c9b5bba619706d6b1a45654f845e7722870a25df.tar.bz2 gsoc2013-empathy-c9b5bba619706d6b1a45654f845e7722870a25df.tar.lz gsoc2013-empathy-c9b5bba619706d6b1a45654f845e7722870a25df.tar.xz gsoc2013-empathy-c9b5bba619706d6b1a45654f845e7722870a25df.tar.zst gsoc2013-empathy-c9b5bba619706d6b1a45654f845e7722870a25df.zip |
new-message-dialog: rely on the factory to prepare TP_CONNECTION_FEATURE_CAPABILITIES
https://bugzilla.gnome.org/show_bug.cgi?id=656831
-rw-r--r-- | libempathy-gtk/empathy-new-message-dialog.c | 55 |
1 files changed, 11 insertions, 44 deletions
diff --git a/libempathy-gtk/empathy-new-message-dialog.c b/libempathy-gtk/empathy-new-message-dialog.c index f3186ccf9..1c4bbaad5 100644 --- a/libempathy-gtk/empathy-new-message-dialog.c +++ b/libempathy-gtk/empathy-new-message-dialog.c @@ -42,11 +42,6 @@ #include "empathy-new-message-dialog.h" #include "empathy-account-chooser.h" -typedef struct { - EmpathyAccountChooserFilterResultCallback callback; - gpointer user_data; -} FilterCallbackData; - static EmpathyNewMessageDialog *dialog_singleton = NULL; G_DEFINE_TYPE(EmpathyNewMessageDialog, empathy_new_message_dialog, @@ -102,56 +97,28 @@ out: } static void -conn_prepared_cb (GObject *conn, - GAsyncResult *result, - gpointer user_data) -{ - FilterCallbackData *data = user_data; - GError *myerr = NULL; - TpCapabilities *caps; - - if (!tp_proxy_prepare_finish (conn, result, &myerr)) - { - data->callback (FALSE, data->user_data); - g_slice_free (FilterCallbackData, data); - } - - caps = tp_connection_get_capabilities (TP_CONNECTION (conn)); - data->callback (tp_capabilities_supports_text_chats (caps), - data->user_data); - - g_slice_free (FilterCallbackData, data); -} - -static void empathy_new_message_account_filter (EmpathyContactSelectorDialog *dialog, EmpathyAccountChooserFilterResultCallback callback, gpointer callback_data, TpAccount *account) { 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 1-1 text chat */ 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; - tp_proxy_prepare_async (connection, features, conn_prepared_cb, cb_data); + supported = tp_capabilities_supports_text_chats (caps); + +out: + callback (supported, callback_data); } static void |