aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-account-widget.c
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy-gtk/empathy-account-widget.c')
-rw-r--r--libempathy-gtk/empathy-account-widget.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index 7d71f3ac7..63bf9275a 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -766,8 +766,10 @@ account_widget_applied_cb (GObject *source_object,
EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (source_object);
EmpathyAccountWidget *widget = EMPATHY_ACCOUNT_WIDGET (user_data);
EmpathyAccountWidgetPriv *priv = GET_PRIV (widget);
+ gboolean reconnect_required;
- empathy_account_settings_apply_finish (settings, res, &error);
+ empathy_account_settings_apply_finish (settings, res, &reconnect_required,
+ &error);
if (error != NULL)
{
@@ -804,10 +806,19 @@ account_widget_applied_cb (GObject *source_object,
GTK_TOGGLE_BUTTON (priv->enabled_checkbox));
#endif /* HAVE_MEEGO */
- if (tp_account_is_enabled (account) && enabled_checked)
+ /* If the account was offline, we always want to try reconnecting,
+ * to give it a chance to connect if the previous params were wrong.
+ * tp_account_reconnect_async() won't do anything if the requested
+ * presence is offline anyway. */
+ if (tp_account_get_connection_status (account, NULL) ==
+ TP_CONNECTION_STATUS_DISCONNECTED)
+ reconnect_required = TRUE;
+
+ if (reconnect_required && tp_account_is_enabled (account)
+ && enabled_checked)
{
/* After having applied changes to a user account, we
- * automatically reconnect it. This is done so the new
+ * reconnect it if needed. This is done so the new
* information entered by the user is validated on the server. */
tp_account_reconnect_async (account, NULL, NULL);
}