[gcr] gcr-viewer: Clear and focus password entry when password invalid
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcr] gcr-viewer: Clear and focus password entry when password invalid
- Date: Tue, 25 Sep 2012 13:54:43 +0000 (UTC)
commit 6ea2c2740fd8f62e59189e823a93c4c9b2d5bfde
Author: Stef Walter <stefw gnome org>
Date: Wed Sep 19 09:49:19 2012 +0200
gcr-viewer: Clear and focus password entry when password invalid
* When user tries to unlock something in the gcr-viewer, and
types an invalid password, focus the password entry, and
clear it.
https://bugzilla.gnome.org/show_bug.cgi?id=684356
gcr/gcr-unlock-renderer.c | 16 ++++++++++++++++
gcr/gcr-unlock-renderer.h | 5 +++++
gcr/gcr-viewer-widget.c | 2 ++
3 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gcr/gcr-unlock-renderer.c b/gcr/gcr-unlock-renderer.c
index 69d163d..0038e82 100644
--- a/gcr/gcr-unlock-renderer.c
+++ b/gcr/gcr-unlock-renderer.c
@@ -333,6 +333,22 @@ _gcr_unlock_renderer_get_password (GcrUnlockRenderer *self)
return gtk_entry_get_text (self->pv->entry);
}
+void
+_gcr_unlock_renderer_set_password (GcrUnlockRenderer *self,
+ const gchar *text)
+{
+ g_return_if_fail (GCR_IS_UNLOCK_RENDERER (self));
+ g_return_if_fail (text != NULL);
+ gtk_entry_set_text (self->pv->entry, text);
+}
+
+void
+_gcr_unlock_renderer_focus_password (GcrUnlockRenderer *self)
+{
+ g_return_if_fail (GCR_IS_UNLOCK_RENDERER (self));
+ gtk_widget_grab_focus (GTK_WIDGET (self->pv->entry));
+}
+
gconstpointer
_gcr_unlock_renderer_get_locked_data (GcrUnlockRenderer *self,
gsize *n_data)
diff --git a/gcr/gcr-unlock-renderer.h b/gcr/gcr-unlock-renderer.h
index bc695b1..d8beb74 100644
--- a/gcr/gcr-unlock-renderer.h
+++ b/gcr/gcr-unlock-renderer.h
@@ -68,6 +68,11 @@ GcrUnlockRenderer * _gcr_unlock_renderer_new_for_parsed (GcrParser *parser
const gchar * _gcr_unlock_renderer_get_password (GcrUnlockRenderer *self);
+void _gcr_unlock_renderer_set_password (GcrUnlockRenderer *self,
+ const gchar *text);
+
+void _gcr_unlock_renderer_focus_password (GcrUnlockRenderer *self);
+
void _gcr_unlock_renderer_show_warning (GcrUnlockRenderer *self,
const gchar *message);
diff --git a/gcr/gcr-viewer-widget.c b/gcr/gcr-viewer-widget.c
index b5512a8..e624ae2 100644
--- a/gcr/gcr-viewer-widget.c
+++ b/gcr/gcr-viewer-widget.c
@@ -201,6 +201,8 @@ on_unlock_renderer_clicked (GcrUnlockRenderer *unlock,
} else if (g_error_matches (error, GCR_DATA_ERROR, GCR_ERROR_LOCKED)){
_gcr_unlock_renderer_show_warning (unlock, _("The password was incorrect"));
+ _gcr_unlock_renderer_focus_password (unlock);
+ _gcr_unlock_renderer_set_password (unlock, "");
g_error_free (error);
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]