diff options
-rw-r--r-- | libempathy-gtk/empathy-account-chooser.c | 55 | ||||
-rw-r--r-- | libempathy-gtk/empathy-avatar-chooser.c | 6 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-search-dialog.c | 60 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-widget.c | 16 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-widget.c | 96 | ||||
-rw-r--r-- | libempathy-gtk/empathy-new-call-dialog.c | 61 | ||||
-rw-r--r-- | libempathy-gtk/empathy-new-message-dialog.c | 55 | ||||
-rw-r--r-- | libempathy/empathy-client-factory.c | 27 | ||||
-rw-r--r-- | libempathy/empathy-ft-handler.c | 25 | ||||
-rw-r--r-- | libempathy/empathy-tp-chat.c | 48 | ||||
-rw-r--r-- | src/empathy-main-window.c | 36 |
11 files changed, 147 insertions, 338 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 diff --git a/libempathy-gtk/empathy-avatar-chooser.c b/libempathy-gtk/empathy-avatar-chooser.c index 2d1c59943..8e64e1fe2 100644 --- a/libempathy-gtk/empathy-avatar-chooser.c +++ b/libempathy-gtk/empathy-avatar-chooser.c @@ -143,11 +143,7 @@ avatar_chooser_set_connection (EmpathyAvatarChooser *self, tp_clear_object (&self->priv->connection); if (connection != NULL) - { - GQuark features[] = { TP_CONNECTION_FEATURE_AVATAR_REQUIREMENTS, 0 }; - self->priv->connection = g_object_ref (connection); - tp_proxy_prepare_async (self->priv->connection, features, NULL, NULL); - } + self->priv->connection = g_object_ref (connection); } static void 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 diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c index 14042bf61..f73d75d19 100644 --- a/libempathy-gtk/empathy-contact-widget.c +++ b/libempathy-gtk/empathy-contact-widget.c @@ -792,16 +792,14 @@ contact_widget_details_request_cb (GObject *object, } static void -contact_widget_details_feature_prepared_cb (GObject *object, - GAsyncResult *res, - gpointer user_data) +fetch_contact_information (EmpathyContactWidget *information, + TpConnection *connection) { - TpConnection *connection = TP_CONNECTION (object); - EmpathyContactWidget *information = user_data; TpContact *contact; TpContactInfoFlags flags; - if (!tp_proxy_prepare_finish (connection, res, NULL)) + if (!tp_proxy_has_interface_by_id (connection, + TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACT_INFO)) { gtk_widget_hide (information->vbox_details); return; @@ -846,13 +844,11 @@ contact_widget_details_update (EmpathyContactWidget *information) if (tp_contact != NULL) { - GQuark features[] = { TP_CONNECTION_FEATURE_CONTACT_INFO, 0 }; TpConnection *connection; - /* First, make sure the CONTACT_INFO feature is ready on the connection */ connection = tp_contact_get_connection (tp_contact); - tp_proxy_prepare_async (connection, features, - contact_widget_details_feature_prepared_cb, information); + + fetch_contact_information (information, connection); } } diff --git a/libempathy-gtk/empathy-individual-widget.c b/libempathy-gtk/empathy-individual-widget.c index 628ed5187..fcc076b9b 100644 --- a/libempathy-gtk/empathy-individual-widget.c +++ b/libempathy-gtk/empathy-individual-widget.c @@ -266,23 +266,6 @@ update_weak_contact (EmpathyIndividualWidget *self) } } -typedef struct { - EmpathyIndividualWidget *widget; /* weak */ - TpContact *contact; /* owned */ -} DetailsData; - -static void -details_data_free (DetailsData *data) -{ - if (data->widget != NULL) - { - g_object_remove_weak_pointer (G_OBJECT (data->widget), - (gpointer *) &data->widget); - } - g_object_unref (data->contact); - g_slice_free (DetailsData, data); -} - static guint details_update_show (EmpathyIndividualWidget *self, TpContact *contact) @@ -373,55 +356,58 @@ details_notify_cb (TpContact *contact, } static void -details_request_cb (TpContact *contact, +details_request_cb (GObject *source, GAsyncResult *res, - DetailsData *data) + gpointer user_data) { - EmpathyIndividualWidget *self = data->widget; + EmpathyIndividualWidget *self = user_data; + EmpathyIndividualWidgetPriv *priv = GET_PRIV (self); + TpContact *contact = (TpContact *) source; gboolean hide_widget = FALSE; GError *error = NULL; if (tp_contact_request_contact_info_finish (contact, res, &error) == TRUE) - details_notify_cb (contact, NULL, self); + { + details_notify_cb (contact, NULL, self); + } else - hide_widget = TRUE; - - g_clear_error (&error); - - if (self != NULL) { - EmpathyIndividualWidgetPriv *priv = GET_PRIV (self); + /* If the request got cancelled it could mean the contact widget is + * destroyed, so we should not dereference information */ + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + { + g_error_free (error); + return; + } - if (hide_widget == TRUE) - gtk_widget_hide (GET_PRIV (self)->vbox_details); + hide_widget = TRUE; + g_error_free (error); + } - tp_clear_object (&priv->details_cancellable); + if (hide_widget == TRUE) + gtk_widget_hide (GET_PRIV (self)->vbox_details); - tp_g_signal_connect_object (contact, "notify::contact-info", - (GCallback) details_notify_cb, self, 0); - } + tp_clear_object (&priv->details_cancellable); - details_data_free (data); + tp_g_signal_connect_object (contact, "notify::contact-info", + (GCallback) details_notify_cb, self, 0); } static void -details_feature_prepared_cb (TpConnection *connection, - GAsyncResult *res, - DetailsData *data) +fetch_contact_information (EmpathyIndividualWidget *self) { - EmpathyIndividualWidget *self = data->widget; - EmpathyIndividualWidgetPriv *priv = NULL; + EmpathyIndividualWidgetPriv *priv = GET_PRIV (self); + TpConnection *connection; - if (tp_proxy_prepare_finish (connection, res, NULL) == FALSE || self == NULL) + connection = tp_contact_get_connection (priv->contact); + + if (!tp_proxy_has_interface_by_id (connection, + TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACT_INFO)) { - if (self != NULL) - gtk_widget_hide (GET_PRIV (self)->vbox_details); - details_data_free (data); + gtk_widget_hide (GET_PRIV (self)->vbox_details); return; } - priv = GET_PRIV (self); - /* Request the Individual's info */ gtk_widget_show (priv->vbox_details); gtk_widget_show (priv->hbox_details_requested); @@ -431,9 +417,9 @@ details_feature_prepared_cb (TpConnection *connection, if (priv->details_cancellable == NULL) { priv->details_cancellable = g_cancellable_new (); - tp_contact_request_contact_info_async (data->contact, - priv->details_cancellable, (GAsyncReadyCallback) details_request_cb, - data); + + tp_contact_request_contact_info_async (priv->contact, + priv->details_cancellable, details_request_cb, self); } } @@ -452,19 +438,7 @@ details_update (EmpathyIndividualWidget *self) if (priv->contact != NULL) { - GQuark features[] = { TP_CONNECTION_FEATURE_CONTACT_INFO, 0 }; - TpConnection *connection; - DetailsData *data; - - data = g_slice_new (DetailsData); - data->widget = self; - g_object_add_weak_pointer (G_OBJECT (self), (gpointer *) &data->widget); - data->contact = g_object_ref (priv->contact); - - /* First, make sure the CONTACT_INFO feature is ready on the connection */ - connection = tp_contact_get_connection (priv->contact); - tp_proxy_prepare_async (connection, features, - (GAsyncReadyCallback) details_feature_prepared_cb, data); + fetch_contact_information (self); } } 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 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 diff --git a/libempathy/empathy-client-factory.c b/libempathy/empathy-client-factory.c index 5055a2628..d3cc57e03 100644 --- a/libempathy/empathy-client-factory.c +++ b/libempathy/empathy-client-factory.c @@ -114,6 +114,21 @@ empathy_client_factory_dup_channel_features (TpSimpleClientFactory *factory, } static GArray * +empathy_client_factory_dup_account_features (TpSimpleClientFactory *factory, + TpAccount *account) +{ + GArray *features; + GQuark feature; + + features = chainup->dup_account_features (factory, account); + + feature = TP_ACCOUNT_FEATURE_CONNECTION; + g_array_append_val (features, feature); + + return features; +} + +static GArray * empathy_client_factory_dup_connection_features (TpSimpleClientFactory *factory, TpConnection *connection) { @@ -125,6 +140,15 @@ empathy_client_factory_dup_connection_features (TpSimpleClientFactory *factory, feature = TP_CONNECTION_FEATURE_CAPABILITIES; g_array_append_val (features, feature); + feature = TP_CONNECTION_FEATURE_AVATAR_REQUIREMENTS; + g_array_append_val (features, feature); + + feature = TP_CONNECTION_FEATURE_CONTACT_INFO; + g_array_append_val (features, feature); + + feature = TP_CONNECTION_FEATURE_BALANCE; + g_array_append_val (features, feature); + return features; } @@ -137,6 +161,9 @@ empathy_client_factory_class_init (EmpathyClientFactoryClass *cls) simple_class->dup_channel_features = empathy_client_factory_dup_channel_features; + simple_class->dup_account_features = + empathy_client_factory_dup_account_features; + simple_class->dup_connection_features = empathy_client_factory_dup_connection_features; } diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c index a1ca07d8b..99b6dc85f 100644 --- a/libempathy/empathy-ft-handler.c +++ b/libempathy/empathy-ft-handler.c @@ -1083,26 +1083,24 @@ out: } static void -conn_prepared_cb (GObject *conn, - GAsyncResult *result, - gpointer user_data) +check_hashing (CallbacksData *data) { - CallbacksData *data = user_data; EmpathyFTHandler *handler = data->handler; EmpathyFTHandlerPriv *priv = GET_PRIV (handler); GError *myerr = NULL; TpCapabilities *caps; GPtrArray *classes; + TpConnection *conn; - if (!tp_proxy_prepare_finish (conn, result, &myerr)) - { - DEBUG ("Failed to prepare connection: %s", myerr->message); + conn = empathy_contact_get_connection (priv->contact); - data->callback (handler, myerr, data->user_data); + caps = tp_connection_get_capabilities (conn); + if (caps == NULL) + { + data->callback (handler, NULL, data->user_data); goto out; } - caps = tp_connection_get_capabilities (TP_CONNECTION (conn)); classes = tp_capabilities_get_channel_classes (caps); /* set whether we support hash and the type of it */ @@ -1202,14 +1200,7 @@ out: else { /* see if FT/hashing are allowed */ - TpConnection *connection; - GQuark features[] = { TP_CONNECTION_FEATURE_CAPABILITIES, 0 }; - - connection = empathy_contact_get_connection (priv->contact); - g_assert (connection != NULL); - - tp_proxy_prepare_async (connection, features, - conn_prepared_cb, cb_data); + check_hashing (cb_data); } } diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index fde1e70ba..27003561e 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -1614,28 +1614,26 @@ empathy_tp_chat_get_feature_ready (void) } static void -conn_prepared_cb (GObject *source, - GAsyncResult *result, +tp_chat_prepare_ready_async (TpProxy *proxy, + const TpProxyFeature *feature, + GAsyncReadyCallback callback, gpointer user_data) { - EmpathyTpChat *self = user_data; - TpChannel *channel = (TpChannel *) self; - GError *error = NULL; - TpHandle handle; - TpConnection *connection = (TpConnection *) source; + EmpathyTpChat *self = (EmpathyTpChat *) proxy; + TpChannel *channel = (TpChannel *) proxy; + TpConnection *connection; - if (!tp_proxy_prepare_finish (source, result, &error)) { - g_simple_async_result_set_from_error (self->priv->ready_result, error); - g_error_free (error); - g_simple_async_result_complete (self->priv->ready_result); - tp_clear_object (&self->priv->ready_result); - return; - } + g_assert (self->priv->ready_result == NULL); + self->priv->ready_result = g_simple_async_result_new (G_OBJECT (self), + callback, user_data, tp_chat_prepare_ready_async); + + connection = tp_channel_borrow_connection (channel); if (tp_proxy_has_interface_by_id (self, TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP)) { const TpIntSet *members; GArray *handles; + TpHandle handle; /* Get self contact from the group's self handle */ handle = tp_channel_group_get_self_handle (channel); @@ -1658,6 +1656,7 @@ conn_prepared_cb (GObject *source, TpCapabilities *caps; GPtrArray *classes; guint i; + TpHandle handle; /* Get the self contact from the connection's self handle */ handle = tp_connection_get_self_handle (connection); @@ -1704,24 +1703,3 @@ conn_prepared_cb (GObject *source, G_OBJECT (self), NULL); } } - -static void -tp_chat_prepare_ready_async (TpProxy *proxy, - const TpProxyFeature *feature, - GAsyncReadyCallback callback, - gpointer user_data) -{ - EmpathyTpChat *self = (EmpathyTpChat *) proxy; - TpChannel *channel = (TpChannel *) proxy; - TpConnection *connection; - GQuark conn_features[] = { TP_CONNECTION_FEATURE_CAPABILITIES, 0 }; - - g_assert (self->priv->ready_result == NULL); - self->priv->ready_result = g_simple_async_result_new (G_OBJECT (self), - callback, user_data, tp_chat_prepare_ready_async); - - connection = tp_channel_borrow_connection (channel); - - tp_proxy_prepare_async (connection, conn_features, - conn_prepared_cb, self); -} diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index 3ecb939a4..e3588c26c 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -1063,24 +1063,20 @@ main_window_setup_balance_create_widget (EmpathyMainWindow *window, } static void -main_window_setup_balance_conn_ready (GObject *source, - GAsyncResult *result, - gpointer user_data) +main_window_setup_balance (EmpathyMainWindow *window, + TpAccount *account) { - EmpathyMainWindow *window = user_data; EmpathyMainWindowPriv *priv = GET_PRIV (window); - TpConnection *conn = TP_CONNECTION (source); - TpAccount *account = g_object_get_data (source, "account"); + TpConnection *conn = tp_account_get_connection (account); GtkAction *action; - GError *error = NULL; const gchar *uri; - if (!tp_proxy_prepare_finish (conn, result, &error)) { - DEBUG ("Failed to prepare connection: %s", error->message); - - g_error_free (error); + if (conn == NULL) return; - } + + /* need to prepare the connection: + * store the account on the connection */ + g_object_set_data (G_OBJECT (conn), "account", account); if (!tp_proxy_is_prepared (conn, TP_CONNECTION_FEATURE_BALANCE)) return; @@ -1110,23 +1106,7 @@ main_window_setup_balance_conn_ready (GObject *source, g_signal_connect (conn, "balance-changed", G_CALLBACK (main_window_balance_changed_cb), action); -} - -static void -main_window_setup_balance (EmpathyMainWindow *window, - TpAccount *account) -{ - TpConnection *conn = tp_account_get_connection (account); - GQuark features[] = { TP_CONNECTION_FEATURE_BALANCE, 0 }; - if (conn == NULL) - return; - - /* need to prepare the connection: - * store the account on the connection */ - g_object_set_data (G_OBJECT (conn), "account", account); - tp_proxy_prepare_async (conn, features, - main_window_setup_balance_conn_ready, window); } static void |