+static void
+empathy_account_settings_processed_password (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data,
+ gpointer finish_func)
+{
+ EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (user_data);
+ EmpathyAccountSettingsPriv *priv = GET_PRIV (settings);
+ GSimpleAsyncResult *r;
+ GError *error = NULL;
+ gboolean (*func) (TpAccount *source, GAsyncResult *result, GError **error) =
+ finish_func;
+
+ g_free (priv->password_original);
+ priv->password_original = g_strdup (priv->password);
+
+ if (!func (TP_ACCOUNT (source), result, &error))
+ {
+ g_simple_async_result_set_from_error (priv->apply_result, error);
+ g_error_free (error);
+ }
+
+ empathy_account_settings_discard_changes (settings);
+
+ r = priv->apply_result;
+ priv->apply_result = NULL;
+
+ g_simple_async_result_complete (r);
+ g_object_unref (r);
+}
+
+static void
+empathy_account_settings_set_password_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ empathy_account_settings_processed_password (source, result, user_data,
+ empathy_keyring_set_password_finish);
+}
+
+static void
+empathy_account_settings_delete_password_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ empathy_account_settings_processed_password (source, result, user_data,
+ empathy_keyring_delete_password_finish);
+}
+