Mercurial > pidgin.yaz
changeset 11042:a5c31b83063f
[gaim-migrate @ 12954]
Patch #1228093 from Sadrul Habib Chowdhury
"This patch adds a checkbox `Save password' in the request-password dialog." -- sadrul
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Thu, 30 Jun 2005 05:13:41 +0000 |
parents | 84dd837a4445 |
children | 629cbfd1ed6d |
files | src/account.c |
diffstat | 1 files changed, 34 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/account.c Thu Jun 30 04:55:19 2005 +0000 +++ b/src/account.c Thu Jun 30 05:13:41 2005 +0000 @@ -756,29 +756,37 @@ } static void -request_password_ok_cb(GaimAccount *account, const char *entry) +request_password_ok_cb(GaimAccount *account, GaimRequestFields *fields) { + const char *entry; + gboolean remember; + + entry = gaim_request_fields_get_string(fields, "password"); + remember = gaim_request_fields_get_bool(fields, "remember"); + if (!entry || !*entry) { gaim_notify_error(account, NULL, _("Password is required to sign on."), NULL); return; } + if(remember) + gaim_account_set_remember_password(account, TRUE); + if (gaim_account_get_remember_password(account)) gaim_account_set_password(account, entry); gaim_connection_new(account, FALSE, entry); } -/* - * TODO: Make the entry box a required field, and add a - * "save password" checkbox. - */ static void request_password(GaimAccount *account) { gchar *primary; const gchar *username; + GaimRequestFieldGroup *group; + GaimRequestField *field; + GaimRequestFields *fields; /* Close any previous password request windows */ gaim_request_close_with_handle(account); @@ -786,10 +794,27 @@ username = gaim_account_get_username(account); primary = g_strdup_printf(_("Enter password for %s (%s)"), username, gaim_account_get_protocol_name(account)); - gaim_request_input(account, _("Enter Password"), primary, NULL, NULL, - FALSE, TRUE, NULL, - _("OK"), G_CALLBACK(request_password_ok_cb), - _("Cancel"), NULL, account); + + fields = gaim_request_fields_new(); + group = gaim_request_field_group_new(NULL); + gaim_request_fields_add_group(fields, group); + + field = gaim_request_field_string_new("password", _("Enter Password"), NULL, FALSE); + gaim_request_field_string_set_masked(field, TRUE); + gaim_request_field_set_required(field, TRUE); + gaim_request_field_group_add_field(group, field); + + field = gaim_request_field_bool_new("remember", _("Save password"), FALSE); + gaim_request_field_group_add_field(group, field); + + gaim_request_fields(account, + NULL, + primary, + NULL, + fields, + _("OK"), G_CALLBACK(request_password_ok_cb), + _("Cancel"), NULL, + account); g_free(primary); }