[gnome-boxes/peek-password-while-express-installing] unattended-setup-box: Allow users to peek into the password entry



commit fcb21eb62bd94b8374bb32651d1a4b5bddb3b435
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Dec 18 12:19:30 2019 +0100

    unattended-setup-box: Allow users to peek into the password entry
    
    Sometimes the password_entry will be pre-filled with a password
    that the user has stored in the keyring.
    
    These changes allow for the user to remember their password before
    their pursue a express installation.
    
    An express installation where the user doesn't know the password
    can lead to a system where the user is locked out and needs to
    rescue the password.
    
    Once the icons make into Gtk, we should drop them from the
    data/icons folder.
    
    This is consistent with the mockups available at
    https://gitlab.gnome.org/Teams/Design/os-mockups/blob/master/password-entry/password-entry.png
    
    This doesn't fix #134 yet. We plan to allow for users to peek at
    the password from the VM's Properties dialog too.

 data/gnome-boxes.gresource.xml                   |  2 ++
 data/icons/eye-not-looking-symbolic.svg          |  4 ++++
 data/icons/eye-open-negative-filled-symbolic.svg | 27 ++++++++++++++++++++++++
 data/ui/unattended-setup-box.ui                  |  3 +++
 src/unattended-setup-box.vala                    |  9 ++++++++
 5 files changed, 45 insertions(+)
---
diff --git a/data/gnome-boxes.gresource.xml b/data/gnome-boxes.gresource.xml
index a47e13ca..cc73d70a 100644
--- a/data/gnome-boxes.gresource.xml
+++ b/data/gnome-boxes.gresource.xml
@@ -7,6 +7,8 @@
     <file>icons/boxes-arrow.svg</file>
     <file>icons/boxes-create.png</file>
     <file>icons/empty-boxes.png</file>
+    <file>icons/eye-not-looking-symbolic.svg</file>
+    <file>icons/eye-open-negative-filled-symbolic.svg</file>
     <file preprocess="xml-stripblanks">ui/app-window.ui</file>
     <file preprocess="xml-stripblanks">ui/auth-notification.ui</file>
     <file preprocess="xml-stripblanks">ui/collection-filter-switcher.ui</file>
diff --git a/data/icons/eye-not-looking-symbolic.svg b/data/icons/eye-not-looking-symbolic.svg
new file mode 100644
index 00000000..a168c87d
--- /dev/null
+++ b/data/icons/eye-not-looking-symbolic.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg"; width="16" height="16">
+    <path d="M13.98 1.99a1 1 0 0 0-.687.303l-.984.984A8 8 0 0 0 8 2 8 8 0 0 0 .262 8.01a8 8 0 0 0 2.943 
4.37l-.912.913a1 1 0 1 0 1.414 1.414l11-11a1 1 0 0 0-.727-1.717zM8 4a4 4 0 0 1 2.611.974l-1.42 1.42A2 2 0 0 0 
8 6a2 2 0 0 0-2 2 2 2 0 0 0 .396 1.19l-1.42 1.42A4 4 0 0 1 4 8a4 4 0 0 1 4-4zm7.03 2.209l-3.344 3.343a4 4 0 0 
1-2.127 2.127l-2.28 2.28a8 8 0 0 0 .721.04 8 8 0 0 0 7.738-6.01 8 8 0 0 0-.709-1.78zm-7.53.79a.5.5 0 0 1 
.5.5.5.5 0 0 1-.5.5.5.5 0 0 1-.5-.5.5.5 0 0 1 .5-.5z" fill="#2e3436"/>
+</svg>
+
diff --git a/data/icons/eye-open-negative-filled-symbolic.svg 
b/data/icons/eye-open-negative-filled-symbolic.svg
new file mode 100644
index 00000000..1e5351c9
--- /dev/null
+++ b/data/icons/eye-open-negative-filled-symbolic.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"; xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:cc="http://creativecommons.org/ns#"; xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; 
xmlns:svg="http://www.w3.org/2000/svg"; xmlns="http://www.w3.org/2000/svg"; width="16" viewBox="0 0 16 16" 
version="1.1" id="svg7384" height="16">
+  <metadata id="metadata90">
+    <rdf:RDF>
+      <cc:Work rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+        <dc:title>Gnome Symbolic Icon Theme</dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <title id="title9167">Gnome Symbolic Icon Theme</title>
+  <defs id="defs7386">
+    <linearGradient osb:paint="solid" id="linearGradient7212">
+      <stop style="stop-color:#000000;stop-opacity:1;" offset="0" id="stop7214"/>
+    </linearGradient>
+  </defs>
+  <g transform="translate(-341.0002,-13.000323)" style="display:inline" id="layer9"/>
+  <g transform="translate(-100,-380.00032)" id="layer1"/>
+  <g transform="translate(-100,-380.00032)" style="display:inline" id="layer10">
+    <path d="m 108,382 a 8,8 0 0 0 -7.73828,6.00977 A 8,8 0 0 0 108,394 8,8 0 0 0 115.73828,387.99023 8,8 0 
0 0 108,382 Z m 0,2 a 4,4 0 0 1 4,4 4,4 0 0 1 -4,4 4,4 0 0 1 -4,-4 4,4 0 0 1 4,-4 z" id="path2314" 
style="opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"/>
+    <path id="path2318" d="m 110,388.00003 a 2,2 0 0 1 -2,2 2,2 0 0 1 -2,-2 2,2 0 0 1 2,-2 2,2 0 0 1 2,2 z" 
style="vector-effect:none;fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/>
+  </g>
+  <g transform="translate(-100,-380.00032)" id="g6387"/>
+  <g transform="translate(-100,-380.00032)" id="layer11"/>
+</svg>
+
diff --git a/data/ui/unattended-setup-box.ui b/data/ui/unattended-setup-box.ui
index fab22ebf..c50d1db4 100644
--- a/data/ui/unattended-setup-box.ui
+++ b/data/ui/unattended-setup-box.ui
@@ -189,6 +189,9 @@
                     <property name="text"></property>
                     <property name="visible">True</property>
                     <property name="visibility">False</property>
+                    <property name="secondary-icon-activatable">True</property>
+                    <property name="secondary-icon-name">eye-not-looking-symbolic</property>
+                    <signal name="icon-release" handler="on_secondary_icon_clicked"/>
                     <signal name="changed" handler="on_password_entry_changed"/>
                     <signal name="focus-out-event" handler="on_password_entry_focus_out"/>
                     <signal name="activate" handler="on_password_entry_activated"/>
diff --git a/src/unattended-setup-box.vala b/src/unattended-setup-box.vala
index 3867654b..4a03bef8 100644
--- a/src/unattended-setup-box.vala
+++ b/src/unattended-setup-box.vala
@@ -390,5 +390,14 @@ private void on_key_text_inserted (string text, int text_length, ref int positio
 
         Signal.stop_emission_by_name (product_key_entry, "insert-text");
     }
+
+    [GtkCallback]
+    private void on_secondary_icon_clicked () {
+        password_entry.visibility = !password_entry.visibility;
+
+        password_entry.secondary_icon_name = password_entry.visibility ?
+                                             "eye-open-negative-filled-symbolic" :
+                                             "eye-not-looking-symbolic";
+    }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]