diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-08-24 16:14:43 +0800 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-08-27 21:47:21 +0800 |
commit | 4f0673c142e6529b6aaa0022b8463fa67b2ff060 (patch) | |
tree | d255f4248eda4e03238f904cc548640c62f146df | |
parent | 4ef8dd58943034270f935f081e290e7540a792f9 (diff) | |
download | gsoc2013-empathy-4f0673c142e6529b6aaa0022b8463fa67b2ff060.tar gsoc2013-empathy-4f0673c142e6529b6aaa0022b8463fa67b2ff060.tar.gz gsoc2013-empathy-4f0673c142e6529b6aaa0022b8463fa67b2ff060.tar.bz2 gsoc2013-empathy-4f0673c142e6529b6aaa0022b8463fa67b2ff060.tar.lz gsoc2013-empathy-4f0673c142e6529b6aaa0022b8463fa67b2ff060.tar.xz gsoc2013-empathy-4f0673c142e6529b6aaa0022b8463fa67b2ff060.tar.zst gsoc2013-empathy-4f0673c142e6529b6aaa0022b8463fa67b2ff060.zip |
Remember password at least until session restart
https://bugzilla.gnome.org/show_bug.cgi?id=680776
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 14 | ||||
-rw-r--r-- | libempathy/empathy-account-settings.c | 16 | ||||
-rw-r--r-- | libempathy/empathy-account-settings.h | 4 | ||||
-rw-r--r-- | libempathy/empathy-keyring.c | 5 | ||||
-rw-r--r-- | libempathy/empathy-keyring.h | 2 | ||||
-rw-r--r-- | libempathy/empathy-server-sasl-handler.c | 12 |
6 files changed, 31 insertions, 22 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index c71b24f7b..aea76cf9f 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -1864,16 +1864,8 @@ static void 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 @@ -2015,6 +2007,8 @@ do_constructed (GObject *obj) && !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 */ diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c index 12154eb79..ee0cb3460 100644 --- a/libempathy/empathy-account-settings.c +++ b/libempathy/empathy-account-settings.c @@ -82,6 +82,7 @@ struct _EmpathyAccountSettingsPriv gboolean supports_sasl; gboolean password_changed; + gboolean remember_password; gchar *password; gchar *password_original; @@ -1344,7 +1345,8 @@ empathy_account_settings_account_updated (GObject *source, /* 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 @@ -1399,7 +1401,8 @@ empathy_account_settings_created_cb (GObject *source, * 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; } @@ -1726,3 +1729,12 @@ empathy_account_settings_set_storage_provider (EmpathyAccountSettings *self, 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; +} diff --git a/libempathy/empathy-account-settings.h b/libempathy/empathy-account-settings.h index 7f17e33c8..c54065258 100644 --- a/libempathy/empathy-account-settings.h +++ b/libempathy/empathy-account-settings.h @@ -197,6 +197,10 @@ void empathy_account_settings_set_storage_provider ( 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__*/ diff --git a/libempathy/empathy-keyring.c b/libempathy/empathy-keyring.c index 5b69cc25c..f9ca47606 100644 --- a/libempathy/empathy-keyring.c +++ b/libempathy/empathy-keyring.c @@ -181,6 +181,7 @@ store_password_cb (GObject *source, void empathy_keyring_set_account_password_async (TpAccount *account, const gchar *password, + gboolean remember, GAsyncReadyCallback callback, gpointer user_data) { @@ -202,7 +203,9 @@ empathy_keyring_set_account_password_async (TpAccount *account, 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", diff --git a/libempathy/empathy-keyring.h b/libempathy/empathy-keyring.h index 92c8a6e9f..05c460e5d 100644 --- a/libempathy/empathy-keyring.h +++ b/libempathy/empathy-keyring.h @@ -41,7 +41,7 @@ const gchar * empathy_keyring_get_room_password_finish (TpAccount *account, 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, diff --git a/libempathy/empathy-server-sasl-handler.c b/libempathy/empathy-server-sasl-handler.c index 1518f3374..db7ba1be8 100644 --- a/libempathy/empathy-server-sasl-handler.c +++ b/libempathy/empathy-server-sasl-handler.c @@ -115,14 +115,10 @@ sasl_status_changed_cb (TpChannel *channel, 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 ( |