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:27:58 +0800 |
commit | d4cc2c6f60ba99c5e7772b08af6407b983f4b7a0 (patch) | |
tree | 5979e2113c1e944121bc619db73a1005ee7ae7dc /libempathy | |
parent | f19e015dc6bc1b62805dd37159176b591a7f9676 (diff) | |
download | gsoc2013-empathy-d4cc2c6f60ba99c5e7772b08af6407b983f4b7a0.tar.gz gsoc2013-empathy-d4cc2c6f60ba99c5e7772b08af6407b983f4b7a0.tar.zst gsoc2013-empathy-d4cc2c6f60ba99c5e7772b08af6407b983f4b7a0.zip |
only try reconnecting accounts if needed (#642358)
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-account-settings.c | 16 | ||||
-rw-r--r-- | libempathy/empathy-account-settings.h | 1 |
2 files changed, 16 insertions, 1 deletions
diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c index 604392202..541a7e113 100644 --- a/libempathy/empathy-account-settings.c +++ b/libempathy/empathy-account-settings.c @@ -1422,9 +1422,10 @@ empathy_account_settings_account_updated (GObject *source, EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); GSimpleAsyncResult *r; GError *error = NULL; + GStrv reconnect_required; if (!tp_account_update_parameters_finish (TP_ACCOUNT (source), - result, NULL, &error)) + result, &reconnect_required, &error)) { g_simple_async_result_set_from_error (priv->apply_result, error); g_error_free (error); @@ -1449,6 +1450,9 @@ empathy_account_settings_account_updated (GObject *source, return; } + g_simple_async_result_set_op_res_gboolean (priv->apply_result, + g_strv_length (reconnect_required) > 0); + out: empathy_account_settings_discard_changes (settings); @@ -1457,6 +1461,7 @@ out: g_simple_async_result_complete (r); g_object_unref (r); + g_strfreev (reconnect_required); } static void @@ -1589,6 +1594,10 @@ empathy_account_settings_apply_async (EmpathyAccountSettings *settings, priv->apply_result = g_simple_async_result_new (G_OBJECT (settings), callback, user_data, empathy_account_settings_apply_finish); + /* We'll have to reconnect only if we change none DBus_Property on an + * existing account. */ + g_simple_async_result_set_op_res_gboolean (priv->apply_result, FALSE); + if (priv->account == NULL) { tp_account_manager_prepare_async (priv->account_manager, NULL, @@ -1605,6 +1614,7 @@ empathy_account_settings_apply_async (EmpathyAccountSettings *settings, gboolean empathy_account_settings_apply_finish (EmpathyAccountSettings *settings, GAsyncResult *result, + gboolean *reconnect_required, GError **error) { if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), @@ -1614,6 +1624,10 @@ empathy_account_settings_apply_finish (EmpathyAccountSettings *settings, g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (settings), empathy_account_settings_apply_finish), FALSE); + if (reconnect_required != NULL) + *reconnect_required = g_simple_async_result_get_op_res_gboolean ( + G_SIMPLE_ASYNC_RESULT (result)); + return TRUE; } diff --git a/libempathy/empathy-account-settings.h b/libempathy/empathy-account-settings.h index 4d5f6ddc9..fb2b8f4c6 100644 --- a/libempathy/empathy-account-settings.h +++ b/libempathy/empathy-account-settings.h @@ -174,6 +174,7 @@ void empathy_account_settings_apply_async (EmpathyAccountSettings *settings, gboolean empathy_account_settings_apply_finish ( EmpathyAccountSettings *settings, GAsyncResult *result, + gboolean *reconnect_required, GError **error); void empathy_account_settings_set_regex (EmpathyAccountSettings *settings, |