aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-account-chooser.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-08-18 18:28:05 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-08-19 15:26:26 +0800
commit5a3861854b566ba034bf9ddc2fd581185dcc2ef1 (patch)
tree0982df258f37aadcb8027cceffbf7c9b4cde69c2 /libempathy-gtk/empathy-account-chooser.c
parent5f8f65f8c95b7c01138992190b559e00b0790962 (diff)
downloadgsoc2013-empathy-5a3861854b566ba034bf9ddc2fd581185dcc2ef1.tar
gsoc2013-empathy-5a3861854b566ba034bf9ddc2fd581185dcc2ef1.tar.gz
gsoc2013-empathy-5a3861854b566ba034bf9ddc2fd581185dcc2ef1.tar.bz2
gsoc2013-empathy-5a3861854b566ba034bf9ddc2fd581185dcc2ef1.tar.lz
gsoc2013-empathy-5a3861854b566ba034bf9ddc2fd581185dcc2ef1.tar.xz
gsoc2013-empathy-5a3861854b566ba034bf9ddc2fd581185dcc2ef1.tar.zst
gsoc2013-empathy-5a3861854b566ba034bf9ddc2fd581185dcc2ef1.zip
account-chooser: rely on the factory to prepare TP_CONNECTION_FEATURE_CAPABILITIES,
Also simplify empathy_account_chooser_filter_supports_chatrooms in the process. https://bugzilla.gnome.org/show_bug.cgi?id=656831
Diffstat (limited to 'libempathy-gtk/empathy-account-chooser.c')
-rw-r--r--libempathy-gtk/empathy-account-chooser.c55
1 files changed, 11 insertions, 44 deletions
diff --git a/libempathy-gtk/empathy-account-chooser.c b/libempathy-gtk/empathy-account-chooser.c
index 32b314be1..cb9028c31 100644
--- a/libempathy-gtk/empathy-account-chooser.c
+++ b/libempathy-gtk/empathy-account-chooser.c
@@ -1016,33 +1016,6 @@ empathy_account_chooser_filter_is_connected (
callback (is_connected, callback_data);
}
-typedef struct {
- EmpathyAccountChooserFilterResultCallback callback;
- gpointer user_data;
-} FilterCallbackData;
-
-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);
- return;
- }
-
- caps = tp_connection_get_capabilities (TP_CONNECTION (conn));
- data->callback (tp_capabilities_supports_text_chatrooms (caps),
- data->user_data);
-
- g_slice_free (FilterCallbackData, data);
-}
-
/**
* empathy_account_chooser_filter_supports_multichat:
* @account: a #TpAccount
@@ -1063,28 +1036,22 @@ empathy_account_chooser_filter_supports_chatrooms (
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 multiuser text chat */
connection = tp_account_get_connection (account);
- if (connection == NULL) {
- callback (FALSE, callback_data);
- return;
- }
+ if (connection == NULL)
+ 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_text_chatrooms (caps);
- tp_proxy_prepare_async (connection, features, conn_prepared_cb,
- cb_data);
+out:
+ callback (supported, callback_data);
}
gboolean