diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-02-15 18:20:59 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-02-16 18:28:38 +0800 |
commit | a98b91f97661f7a94ef44f957f1edbfebf680fc2 (patch) | |
tree | e10ee0dd1723c6e4e24b19889e9dd4f606fd5f3a /libempathy-gtk/empathy-account-widget.c | |
parent | 2d295e9cc7b2ce7a173144624e7226765a125c65 (diff) | |
download | gsoc2013-empathy-a98b91f97661f7a94ef44f957f1edbfebf680fc2.tar gsoc2013-empathy-a98b91f97661f7a94ef44f957f1edbfebf680fc2.tar.gz gsoc2013-empathy-a98b91f97661f7a94ef44f957f1edbfebf680fc2.tar.bz2 gsoc2013-empathy-a98b91f97661f7a94ef44f957f1edbfebf680fc2.tar.lz gsoc2013-empathy-a98b91f97661f7a94ef44f957f1edbfebf680fc2.tar.xz gsoc2013-empathy-a98b91f97661f7a94ef44f957f1edbfebf680fc2.tar.zst gsoc2013-empathy-a98b91f97661f7a94ef44f957f1edbfebf680fc2.zip |
only try reconnecting accounts if needed (#642358)
Diffstat (limited to 'libempathy-gtk/empathy-account-widget.c')
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 17 |
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); } |