[seahorse] PGP: hint user that key name is not long enough.
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] PGP: hint user that key name is not long enough.
- Date: Fri, 3 Aug 2018 00:39:22 +0000 (UTC)
commit 0b857fa086072a070c989984ef1956ea6b7ec957
Author: Niels De Graef <nielsdegraef gmail com>
Date: Fri Aug 3 02:36:30 2018 +0200
PGP: hint user that key name is not long enough.
That way, they know why they can't click the create button.
Fixes [bug 395805](https://bugzilla.gnome.org/show_bug.cgi?id=395805).
pgp/seahorse-gpgme-generate.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/pgp/seahorse-gpgme-generate.c b/pgp/seahorse-gpgme-generate.c
index 71b3421d..3060a11f 100644
--- a/pgp/seahorse-gpgme-generate.c
+++ b/pgp/seahorse-gpgme-generate.c
@@ -347,16 +347,28 @@ on_gpgme_generate_entry_changed (GtkEditable *editable,
SeahorseWidget *swidget = SEAHORSE_WIDGET (user_data);
GtkWidget *widget;
gchar *name;
+ gboolean name_long_enough;
/* A 5 character name is required */
widget = seahorse_widget_get_widget (swidget, "name-entry");
g_return_if_fail (widget != NULL);
name = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
-
+ name_long_enough = name && strlen (g_strstrip (name)) >= 5;
+
+ /* If not, show the user and disable the create button */
+ if (!name_long_enough) {
+ g_object_set (widget,
+ "secondary-icon-name", "dialog-warning-symbolic",
+ "secondary-icon-tooltip-text", _("Name must be at least 5 characters long."),
+ NULL);
+ } else {
+ g_object_set (widget, "secondary-icon-name", NULL, NULL);
+ }
+
widget = seahorse_widget_get_widget (swidget, "ok");
g_return_if_fail (widget != NULL);
- gtk_widget_set_sensitive (widget, name && strlen (g_strstrip (name)) >= 5);
+ gtk_widget_set_sensitive (widget, name_long_enough);
g_free (name);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]