[file-roller] added possibility to view the password entry content
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] added possibility to view the password entry content
- Date: Sat, 17 Aug 2013 18:37:01 +0000 (UTC)
commit bcaf181fba2f0265cb109c53968694d00b5cc74d
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Aug 17 20:36:04 2013 +0200
added possibility to view the password entry content
this way the user can check if he entered the right password
when creating an encrypted archive.
[bug #604923]
src/dlg-ask-password.c | 1 +
src/dlg-password.c | 1 +
src/fr-new-archive-dialog.c | 2 ++
src/gtk-utils.c | 25 +++++++++++++++++++++++++
src/gtk-utils.h | 1 +
5 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/dlg-ask-password.c b/src/dlg-ask-password.c
index a0a4e49..a27d9f1 100644
--- a/src/dlg-ask-password.c
+++ b/src/dlg-ask-password.c
@@ -131,6 +131,7 @@ dlg_ask_password__common (FrWindow *window,
message = g_strdup_printf (_("Password required for \"%s\""), filename);
gtk_label_set_label (GTK_LABEL (GET_WIDGET ("title_label")), message);
+ _gtk_entry_use_as_password_entry (GTK_ENTRY (data->password_entry));
if (old_password != NULL) {
GtkWidget *info_bar;
GtkWidget *label;
diff --git a/src/dlg-password.c b/src/dlg-password.c
index ee39fb4..5d274f2 100644
--- a/src/dlg-password.c
+++ b/src/dlg-password.c
@@ -94,6 +94,7 @@ dlg_password (GtkWidget *widget,
g_free (title);
g_free (basename);
+ _gtk_entry_use_as_password_entry (GTK_ENTRY (GET_WIDGET ("password_entry")));
_gtk_entry_set_locale_text (GTK_ENTRY (GET_WIDGET ("password_entry")),
fr_window_get_password (window));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("encrypt_header_checkbutton")),
diff --git a/src/fr-new-archive-dialog.c b/src/fr-new-archive-dialog.c
index 76f5a51..68590e6 100644
--- a/src/fr-new-archive-dialog.c
+++ b/src/fr-new-archive-dialog.c
@@ -282,6 +282,8 @@ _fr_new_archive_dialog_construct (FrNewArchiveDialog *self,
_fr_new_archive_dialog_update_sensitivity (self);
extension_comboboxtext_changed_cb (GTK_COMBO_BOX (GET_WIDGET ("extension_comboboxtext")), self);
+ _gtk_entry_use_as_password_entry (GTK_ENTRY (GET_WIDGET ("password_entry")));
+
/* Set the signals handlers. */
g_signal_connect (GET_WIDGET ("password_entry"),
diff --git a/src/gtk-utils.c b/src/gtk-utils.c
index 9df2b5b..9e39019 100644
--- a/src/gtk-utils.c
+++ b/src/gtk-utils.c
@@ -630,3 +630,28 @@ _gtk_widget_lookup_for_size (GtkWidget *widget,
&w, &h);
return MAX (w, h);
}
+
+
+static void
+password_entry_icon_press_cb (GtkEntry *entry,
+ GtkEntryIconPosition icon_pos,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ gtk_entry_set_visibility (entry, ! gtk_entry_get_visibility (entry));
+}
+
+
+void
+_gtk_entry_use_as_password_entry (GtkEntry *entry)
+{
+ gtk_entry_set_visibility (entry, FALSE);
+ gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY, "security-medium-symbolic");
+ gtk_entry_set_icon_activatable (entry, GTK_ENTRY_ICON_SECONDARY, TRUE);
+ gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY, _("Change password visibility"));
+
+ g_signal_connect (entry,
+ "icon-press",
+ G_CALLBACK (password_entry_icon_press_cb),
+ NULL);
+}
diff --git a/src/gtk-utils.h b/src/gtk-utils.h
index 0448633..87e0077 100644
--- a/src/gtk-utils.h
+++ b/src/gtk-utils.h
@@ -79,5 +79,6 @@ GtkWidget * _gtk_builder_get_widget (GtkBuilder *builder,
const char *name);
int _gtk_widget_lookup_for_size (GtkWidget *widget,
GtkIconSize icon_size);
+void _gtk_entry_use_as_password_entry (GtkEntry *entry);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]