[virt-tools-list] [virt-viewer: PATCH v2] Add support to view the password entry content
Christophe Fergeau
cfergeau at redhat.com
Wed Sep 17 11:14:51 UTC 2014
On Mon, Sep 15, 2014 at 04:13:52PM +0200, Fabiano Fidêncio wrote:
> Allow users to check if the entered password is right and/org modify
> the password easily in case it's wrong.
> ---
> src/virt-viewer-auth.c | 11 +++++++++++
> src/virt-viewer-auth.xml | 13 +++++++++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/src/virt-viewer-auth.c b/src/virt-viewer-auth.c
> index 230d720..fb8fafe 100644
> --- a/src/virt-viewer-auth.c
> +++ b/src/virt-viewer-auth.c
> @@ -32,6 +32,13 @@
>
> #include "virt-viewer-auth.h"
>
> +static void
> +show_password(GtkCheckButton *check_button G_GNUC_UNUSED,
> + GtkEntry *entry)
> +{
> + gtk_entry_set_visibility(entry, !gtk_entry_get_visibility(entry));
> +}
> +
>
> /* NOTE: if username is provided, and *username is non-NULL, the user input
> * field will be pre-filled with this value. The existing string will be freed
> @@ -51,6 +58,7 @@ virt_viewer_auth_collect_credentials(GtkWindow *window,
> GtkWidget *promptUsername;
> GtkWidget *promptPassword;
> GtkWidget *labelMessage;
> + GtkWidget *checkPassword;
> int response;
> char *message;
>
> @@ -63,6 +71,7 @@ virt_viewer_auth_collect_credentials(GtkWindow *window,
> promptUsername = GTK_WIDGET(gtk_builder_get_object(creds, "prompt-username"));
> credPassword = GTK_WIDGET(gtk_builder_get_object(creds, "cred-password"));
> promptPassword = GTK_WIDGET(gtk_builder_get_object(creds, "prompt-password"));
> + checkPassword = GTK_WIDGET(gtk_builder_get_object(creds, "show-password"));
>
> gtk_widget_set_sensitive(credUsername, username != NULL);
> if (username && *username) {
> @@ -74,6 +83,8 @@ virt_viewer_auth_collect_credentials(GtkWindow *window,
> gtk_widget_set_sensitive(credPassword, password != NULL);
> gtk_widget_set_sensitive(promptPassword, password != NULL);
>
> + g_signal_connect(checkPassword, "clicked", G_CALLBACK(show_password), credPassword);
> +
> if (address) {
> message = g_strdup_printf(_("Authentication is required for the %s connection to:\n\n<b>%s</b>\n\n"),
> type,
> diff --git a/src/virt-viewer-auth.xml b/src/virt-viewer-auth.xml
> index 0da1181..2da315c 100644
> --- a/src/virt-viewer-auth.xml
> +++ b/src/virt-viewer-auth.xml
> @@ -129,6 +129,19 @@
> <property name="bottom_attach">2</property>
> </packing>
> </child>
> + <child>
> + <object class="GtkCheckButton" id="show-password">
> + <property name="visible">True</property>
> + <property name="can_focus">True</property>
> + <property name="label" translatable="yes">Show my password</property>
I'd use "Show password", looks good otherwise, though the checkbox might
be a bit invasive :-/
Let's try this and see peoples' reactions :)
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20140917/6fa6485d/attachment.sig>
More information about the virt-tools-list
mailing list