aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-02-15 18:20:59 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-02-16 18:27:58 +0800
commitd4cc2c6f60ba99c5e7772b08af6407b983f4b7a0 (patch)
tree5979e2113c1e944121bc619db73a1005ee7ae7dc /libempathy-gtk
parentf19e015dc6bc1b62805dd37159176b591a7f9676 (diff)
downloadgsoc2013-empathy-d4cc2c6f60ba99c5e7772b08af6407b983f4b7a0.tar
gsoc2013-empathy-d4cc2c6f60ba99c5e7772b08af6407b983f4b7a0.tar.gz
gsoc2013-empathy-d4cc2c6f60ba99c5e7772b08af6407b983f4b7a0.tar.bz2
gsoc2013-empathy-d4cc2c6f60ba99c5e7772b08af6407b983f4b7a0.tar.lz
gsoc2013-empathy-d4cc2c6f60ba99c5e7772b08af6407b983f4b7a0.tar.xz
gsoc2013-empathy-d4cc2c6f60ba99c5e7772b08af6407b983f4b7a0.tar.zst
gsoc2013-empathy-d4cc2c6f60ba99c5e7772b08af6407b983f4b7a0.zip
only try reconnecting accounts if needed (#642358)
Diffstat (limited to 'libempathy-gtk')
-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 f53df39d3..f4d6f7e9c 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -923,8 +923,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)
{
@@ -961,10 +963,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);
}