diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-08-18 22:13:10 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-08-19 15:26:26 +0800 |
commit | 3370401046e7233a98afbe528e9a936fdad18b18 (patch) | |
tree | 04c7a365fa839530054ca48ad944048bf2677a79 | |
parent | a87c7313fa5fca97265a533b5613726c5958e9bd (diff) | |
download | gsoc2013-empathy-3370401046e7233a98afbe528e9a936fdad18b18.tar gsoc2013-empathy-3370401046e7233a98afbe528e9a936fdad18b18.tar.gz gsoc2013-empathy-3370401046e7233a98afbe528e9a936fdad18b18.tar.bz2 gsoc2013-empathy-3370401046e7233a98afbe528e9a936fdad18b18.tar.lz gsoc2013-empathy-3370401046e7233a98afbe528e9a936fdad18b18.tar.xz gsoc2013-empathy-3370401046e7233a98afbe528e9a936fdad18b18.tar.zst gsoc2013-empathy-3370401046e7233a98afbe528e9a936fdad18b18.zip |
new-call-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-call-dialog.c | 61 |
1 files changed, 17 insertions, 44 deletions
diff --git a/libempathy-gtk/empathy-new-call-dialog.c b/libempathy-gtk/empathy-new-call-dialog.c index 01de68df2..f552a6601 100644 --- a/libempathy-gtk/empathy-new-call-dialog.c +++ b/libempathy-gtk/empathy-new-call-dialog.c @@ -106,20 +106,26 @@ out: } static void -conn_prepared_cb (GObject *conn, - GAsyncResult *result, - gpointer user_data) +empathy_new_call_dialog_account_filter (EmpathyContactSelectorDialog *dialog, + EmpathyAccountChooserFilterResultCallback callback, + gpointer callback_data, + TpAccount *account) { - FilterCallbackData *data = user_data; - GError *myerr = NULL; + TpConnection *connection; + gboolean supported = FALSE; + guint i; TpCapabilities *caps; GPtrArray *classes; - guint i; - if (!tp_proxy_prepare_finish (conn, result, &myerr)) + /* check if CM supports calls */ + connection = tp_account_get_connection (account); + if (connection == NULL) + goto out; + + caps = tp_connection_get_capabilities (connection); + if (caps == NULL) goto out; - caps = tp_connection_get_capabilities (TP_CONNECTION (conn)); classes = tp_capabilities_get_channel_classes (caps); for (i = 0; i < classes->len; i++) @@ -141,45 +147,12 @@ conn_prepared_cb (GObject *conn, TP_HANDLE_TYPE_CONTACT) continue; - data->callback (TRUE, data->user_data); - g_slice_free (FilterCallbackData, data); - return; + supported = TRUE; + break; } out: - data->callback (FALSE, data->user_data); - g_slice_free (FilterCallbackData, data); -} - -static void -empathy_new_call_dialog_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; - } - - /* check if CM supports calls */ - connection = tp_account_get_connection (account); - if (connection == NULL) - { - callback (FALSE, callback_data); - return; - } - - 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); + callback (supported, callback_data); } static void |