gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] branch master updated: use GtkTextView instead of


From: gnunet
Subject: [taler-anastasis-gtk] branch master updated: use GtkTextView instead of GtkEntry for the secret value (#7094), also add text to avoid user confusion between secret name/value (#7085)
Date: Tue, 16 Nov 2021 16:29:12 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository anastasis-gtk.

The following commit(s) were added to refs/heads/master by this push:
     new ea94fab  use GtkTextView instead of GtkEntry for the secret value 
(#7094), also add text to avoid user confusion between secret name/value (#7085)
ea94fab is described below

commit ea94fab6e38856cf459c3571e2f9ea036babc003
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Nov 16 16:29:09 2021 +0100

    use GtkTextView instead of GtkEntry for the secret value (#7094), also add 
text to avoid user confusion between secret name/value (#7085)
---
 contrib/anastasis_gtk_main_window.glade            | 48 +++++++++++++++++-----
 src/anastasis/anastasis-gtk_action.c               | 27 ++++++++----
 .../anastasis-gtk_handle-core-secret-changed.c     | 11 +++--
 3 files changed, 63 insertions(+), 23 deletions(-)

diff --git a/contrib/anastasis_gtk_main_window.glade 
b/contrib/anastasis_gtk_main_window.glade
index 30ce66e..4c2b747 100644
--- a/contrib/anastasis_gtk_main_window.glade
+++ b/contrib/anastasis_gtk_main_window.glade
@@ -75,6 +75,19 @@ Author: Christian Grothoff, Dennis Neufeld
       </row>
     </data>
   </object>
+  <object class="GtkAdjustment" id="anastasis_gtk_enter_secret_hadjustment">
+    <property name="upper">100</property>
+    <property name="step-increment">1</property>
+    <property name="page-increment">10</property>
+  </object>
+  <object class="GtkTextBuffer" id="anastasis_gtk_enter_secret_textbuffer">
+    <signal name="changed" 
handler="anastasis_gtk_enter_secret_textbuffer_changed_cb" swapped="no"/>
+  </object>
+  <object class="GtkAdjustment" id="anastasis_gtk_enter_secret_vadjustment">
+    <property name="upper">100</property>
+    <property name="step-increment">1</property>
+    <property name="page-increment">10</property>
+  </object>
   <object class="GtkListStore" id="anastasis_gtk_recovery_progress_liststore">
     <columns>
       <!-- column-name description -->
@@ -2582,6 +2595,7 @@ You can also use "back" to add additional authentication 
methods.</property>
                             </child>
                             <child>
                               <object class="GtkFrame" 
id="anastasis_gtk_enter_secret_frame">
+                                <property name="height-request">1500</property>
                                 <property name="can-focus">False</property>
                                 <property name="label-xalign">0</property>
                                 <property name="shadow-type">none</property>
@@ -2640,6 +2654,9 @@ You can also use "back" to add additional authentication 
methods.</property>
                                                     <property 
name="visible">True</property>
                                                     <property 
name="can-focus">True</property>
                                                     <property 
name="has-focus">True</property>
+                                                    <property 
name="tooltip-text" translatable="yes">This allows you to uniquely identify a 
secret if you have made multiple back ups. The value entered here will NOT be 
protected by the authentication checks!</property>
+                                                    <property 
name="primary-icon-tooltip-text" translatable="yes">If you make multiple 
backups using Anastasis, the secret's name will allow you to distinguish the 
different backups.</property>
+                                                    <property 
name="placeholder-text" translatable="yes">Do NOT enter the actual secret 
here!</property>
                                                     <signal name="changed" 
handler="anastasis_gtk_enter_secret_name_entry_changed_cb" swapped="no"/>
                                                   </object>
                                                   <packing>
@@ -2707,19 +2724,30 @@ identify your secret later.</property>
                                                     <property 
name="visible">True</property>
                                                     <property 
name="can-focus">False</property>
                                                     <child>
-                                                      <object class="GtkEntry" 
id="anastasis_gtk_enter_secret_entry">
+                                                      <object 
class="GtkScrolledWindow" id="enter_secret_scrolled_window">
                                                         <property 
name="visible">True</property>
                                                         <property 
name="can-focus">True</property>
-                                                        <property 
name="valign">start</property>
-                                                        <property 
name="margin-left">5</property>
-                                                        <property 
name="margin-right">5</property>
-                                                        <property 
name="margin-start">5</property>
-                                                        <property 
name="margin-end">5</property>
+                                                        <property 
name="tooltip-text" translatable="yes">Enter the secret you want to back up 
here.</property>
+                                                        <property 
name="margin-start">10</property>
+                                                        <property 
name="margin-end">10</property>
                                                         <property 
name="hexpand">True</property>
-                                                        <property 
name="primary-icon-stock">gtk-dialog-authentication</property>
-                                                        <property 
name="placeholder-text" translatable="yes">Type or paste your secret 
here</property>
-                                                        <property 
name="input-purpose">password</property>
-                                                        <signal name="changed" 
handler="anastasis_gtk_enter_secret_entry_changed_cb" swapped="no"/>
+                                                        <property 
name="vexpand">True</property>
+                                                        <property 
name="hadjustment">anastasis_gtk_enter_secret_hadjustment</property>
+                                                        <property 
name="vadjustment">anastasis_gtk_enter_secret_vadjustment</property>
+                                                        <property 
name="shadow-type">in</property>
+                                                        <child>
+                                                          <object 
class="GtkTextView" id="anastasis_gtk_enter_secret_textview">
+                                                            <property 
name="visible">True</property>
+                                                            <property 
name="can-focus">True</property>
+                                                            <property 
name="hexpand">True</property>
+                                                            <property 
name="vexpand">True</property>
+                                                            <property 
name="hadjustment">anastasis_gtk_enter_secret_hadjustment</property>
+                                                            <property 
name="hscroll-policy">natural</property>
+                                                            <property 
name="vadjustment">anastasis_gtk_enter_secret_vadjustment</property>
+                                                            <property 
name="vscroll-policy">natural</property>
+                                                            <property 
name="buffer">anastasis_gtk_enter_secret_textbuffer</property>
+                                                          </object>
+                                                        </child>
                                                       </object>
                                                       <packing>
                                                         <property 
name="expand">True</property>
diff --git a/src/anastasis/anastasis-gtk_action.c 
b/src/anastasis/anastasis-gtk_action.c
index ca3406a..8581808 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -1225,7 +1225,7 @@ action_secret_editing (void)
 
   AG_insensitive ("anastasis_gtk_main_window_forward_button");
   AG_sensitive ("anastasis_gtk_enter_secret_open_button");
-  AG_sensitive ("anastasis_gtk_enter_secret_entry");
+  AG_sensitive ("anastasis_gtk_enter_secret_textview");
   AG_hide ("anastasis_gtk_secret_clear_file_button");
   AG_hide ("anastasis_gtk_secret_clear_text_button");
   AG_hide ("anastasis_gtk_secret_file_name_hbox");
@@ -1292,8 +1292,18 @@ action_secret_editing (void)
            (0 == strlen (text)) )
         text = NULL;
       if (! AG_in_secret_editing)
-        update_entry ("anastasis_gtk_enter_secret_entry",
-                      text);
+      {
+        GtkTextBuffer *tb = GCG_get_main_window_object (
+          "anastasis_gtk_enter_secret_textbuffer");
+        const char *old;
+
+        old = gtk_entry_get_text (tb);
+        if (0 != strcmp (old,
+                         text))
+          gtk_text_buffer_set_text (tb,
+                                    text,
+                                    -1);
+      }
       update_label ("anastasis_gtk_secret_file_name_label",
                     filename);
       if ( (NULL != text) ||
@@ -1308,7 +1318,7 @@ action_secret_editing (void)
       }
       if (NULL != filename)
       {
-        AG_insensitive ("anastasis_gtk_enter_secret_entry");
+        AG_insensitive ("anastasis_gtk_enter_secret_textbuffer");
         AG_show ("anastasis_gtk_secret_clear_file_button");
         AG_show ("anastasis_gtk_secret_file_name_hbox");
         AG_hide ("anastasis_gtk_secret_file_chooser_hbox");
@@ -1318,15 +1328,18 @@ action_secret_editing (void)
     else
     {
       /* secret is NULL */
-      update_entry ("anastasis_gtk_enter_secret_entry",
-                    NULL);
+      GtkTextBuffer *tb = GCG_get_main_window_object (
+        "anastasis_gtk_enter_secret_textbuffer");
 
+      gtk_text_buffer_set_text (tb,
+                                "",
+                                -1);
     }
     if ( (NULL == name) ||
          (0 == strlen (name) ) )
       AG_focus ("anastasis_gtk_secret_name_entry");
     else if (NULL == filename)
-      AG_focus ("anastasis_gtk_enter_secret_entry");
+      AG_focus ("anastasis_gtk_enter_secret_textbuffer");
     GNUNET_JSON_parse_free (spec);
   }
   AG_sensitive ("anastasis_gtk_main_window_prev_button");
diff --git a/src/anastasis/anastasis-gtk_handle-core-secret-changed.c 
b/src/anastasis/anastasis-gtk_handle-core-secret-changed.c
index b086fe5..c0ca4c1 100644
--- a/src/anastasis/anastasis-gtk_handle-core-secret-changed.c
+++ b/src/anastasis/anastasis-gtk_handle-core-secret-changed.c
@@ -33,11 +33,10 @@
 
 
 void
-anastasis_gtk_enter_secret_entry_changed_cb (GtkEditable *entry,
-                                             gpointer user_data)
+anastasis_gtk_enter_secret_textbuffer_changed_cb (GtkTextBuffer *tb,
+                                                  gpointer user_data)
 {
-  GtkEntry *e = GTK_ENTRY (entry);
-  const char *text = gtk_entry_get_text (e);
+  const char *text = gtk_text_buffer_get_text (tb);
   json_t *arguments;
   struct GNUNET_TIME_Absolute expiration;
 
@@ -56,7 +55,7 @@ anastasis_gtk_enter_secret_entry_changed_cb (GtkEditable 
*entry,
                                     NULL,
                                     &AG_action_cb,
                                     NULL);
-    AG_focus ("anastasis_gtk_enter_secret_entry");
+    AG_focus ("anastasis_gtk_enter_secret_textview");
     return;
   }
   arguments = json_pack ("{s:{s:s,s:s},s:o}",
@@ -75,6 +74,6 @@ anastasis_gtk_enter_secret_entry_changed_cb (GtkEditable 
*entry,
                                   &AG_action_cb,
                                   NULL);
   json_decref (arguments);
-  AG_focus ("anastasis_gtk_enter_secret_entry");
+  AG_focus ("anastasis_gtk_enter_secret_textview");
   AG_in_secret_editing = false;
 }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]