remember_password_toggled_cb (GtkToggleButton *button,
EmpathyAccountWidget *self)
{
- if (gtk_toggle_button_get_active (button))
- {
- gtk_widget_set_sensitive (self->priv->param_password_widget, TRUE);
- }
- else
- {
- gtk_widget_set_sensitive (self->priv->param_password_widget, FALSE);
- gtk_entry_set_text (GTK_ENTRY (self->priv->param_password_widget), "");
- empathy_account_settings_unset (self->priv->settings, "password");
- }
+ empathy_account_settings_set_remember_password (self->priv->settings,
+ gtk_toggle_button_get_active (button));
}
static void
&& !empathy_account_settings_supports_sasl (self->priv->settings))
{
gtk_widget_set_visible (self->priv->remember_password_widget, FALSE);
+ empathy_account_settings_set_remember_password (self->priv->settings,
+ TRUE);
}
/* dup and init the account-manager */
gboolean supports_sasl;
gboolean password_changed;
+ gboolean remember_password;
gchar *password;
gchar *password_original;
/* FIXME: we shouldn't save the password if we
* can't (MaySaveResponse=False) but we don't have API to check that
* at this point (fdo #35382). */
- empathy_keyring_set_account_password_async (priv->account, priv->password,
+ empathy_keyring_set_account_password_async (priv->account,
+ priv->password, priv->remember_password,
empathy_account_settings_set_password_cb, settings);
}
else
* can't (MaySaveResponse=False) but we don't have API to check that
* at this point (fdo #35382). */
empathy_keyring_set_account_password_async (priv->account,
- priv->password, empathy_account_settings_set_password_cb,
+ priv->password, priv->remember_password,
+ empathy_account_settings_set_password_cb,
settings);
return;
}
g_free (priv->storage_provider);
priv->storage_provider = g_strdup (storage);
}
+
+void
+empathy_account_settings_set_remember_password (EmpathyAccountSettings *self,
+ gboolean remember)
+{
+ EmpathyAccountSettingsPriv *priv = GET_PRIV (self);
+
+ priv->remember_password = remember;
+}
EmpathyAccountSettings *self,
const gchar *storage);
+void empathy_account_settings_set_remember_password (
+ EmpathyAccountSettings *self,
+ gboolean remember);
+
G_END_DECLS
#endif /* #ifndef __EMPATHY_ACCOUNT_SETTINGS_H__*/
void
empathy_keyring_set_account_password_async (TpAccount *account,
const gchar *password,
+ gboolean remember,
GAsyncReadyCallback callback,
gpointer user_data)
{
name = g_strdup_printf (_("IM account password for %s (%s)"),
tp_account_get_display_name (account), account_id);
- secret_password_store (&account_keyring_schema, NULL, name, password,
+ secret_password_store (&account_keyring_schema,
+ remember ? NULL : SECRET_COLLECTION_SESSION,
+ name, password,
NULL, store_password_cb, simple,
"account-id", account_id,
"param-name", "password",
GAsyncResult *result, GError **error);
void empathy_keyring_set_account_password_async (TpAccount *account,
- const gchar *password, GAsyncReadyCallback callback,
+ const gchar *password, gboolean remember, GAsyncReadyCallback callback,
gpointer user_data);
gboolean empathy_keyring_set_account_password_finish (TpAccount *account,
if (status == TP_SASL_STATUS_SERVER_SUCCEEDED)
{
- if (priv->save_password)
- {
- DEBUG ("Saving password in keyring");
-
- empathy_keyring_set_account_password_async (priv->account,
- priv->password, empathy_server_sasl_handler_set_password_cb,
- NULL);
- }
+ empathy_keyring_set_account_password_async (priv->account,
+ priv->password, priv->save_password,
+ empathy_server_sasl_handler_set_password_cb,
+ NULL);
DEBUG ("Calling AcceptSASL");
tp_cli_channel_interface_sasl_authentication_call_accept_sasl (