gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] branch master updated: work on dialogs


From: gnunet
Subject: [taler-anastasis-gtk] branch master updated: work on dialogs
Date: Wed, 10 Mar 2021 12:18:04 +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 f81a573  work on dialogs
f81a573 is described below

commit f81a573f7084b8ab7dbbf33987b504b6e1f5baa1
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Mar 10 12:18:02 2021 +0100

    work on dialogs
---
 contrib/anastasis_gtk_auth_add_email.glade         |  17 ++-
 contrib/anastasis_gtk_auth_add_post.glade          |  94 +++++-------
 contrib/anastasis_gtk_auth_add_question.glade      |  20 ++-
 contrib/anastasis_gtk_auth_add_sms.glade           |  17 ++-
 contrib/anastasis_gtk_auth_add_video.glade         |  16 +-
 contrib/anastasis_gtk_main_window.glade            |  54 ++++++-
 src/anastasis/Makefile.am                          |   1 +
 src/anastasis/anastasis-gtk_action.c               | 169 +++++++++++++++++++--
 ...astasis-gtk_handle-auth-delete-button-clicked.c | 131 +++++-----------
 .../anastasis-gtk_handle-method-question.c         | 160 +++++++++++++++++++
 10 files changed, 511 insertions(+), 168 deletions(-)

diff --git a/contrib/anastasis_gtk_auth_add_email.glade 
b/contrib/anastasis_gtk_auth_add_email.glade
index 5eef64f..086df8b 100644
--- a/contrib/anastasis_gtk_auth_add_email.glade
+++ b/contrib/anastasis_gtk_auth_add_email.glade
@@ -16,10 +16,11 @@
             <property name="layout-style">end</property>
             <child>
               <object class="GtkButton" 
id="anastasis_gtk_b_email_dialog_btn_cancel">
-                <property name="label" translatable="yes">Cancel</property>
+                <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
                 <property name="can-focus">True</property>
                 <property name="receives-default">True</property>
+                <property name="use-stock">True</property>
                 <signal name="clicked" 
handler="anastasis_gtk_b_email_dialog_btn_cancel_clicked_cb" swapped="no"/>
               </object>
               <packing>
@@ -30,10 +31,13 @@
             </child>
             <child>
               <object class="GtkButton" 
id="anastasis_gtk_b_email_dialog_btn_ok">
-                <property name="label" translatable="yes">OK</property>
+                <property name="label">gtk-ok</property>
                 <property name="visible">True</property>
+                <property name="sensitive">False</property>
                 <property name="can-focus">True</property>
+                <property name="has-focus">True</property>
                 <property name="receives-default">True</property>
+                <property name="use-stock">True</property>
               </object>
               <packing>
                 <property name="expand">True</property>
@@ -75,6 +79,7 @@
                     <property name="visible">True</property>
                     <property name="can-focus">True</property>
                     <property name="hexpand">True</property>
+                    <property 
name="primary-icon-stock">gtk-dialog-authentication</property>
                     <property name="input-purpose">email</property>
                   </object>
                   <packing>
@@ -102,6 +107,10 @@
         </child>
       </object>
     </child>
+    <action-widgets>
+      <action-widget 
response="-6">anastasis_gtk_b_email_dialog_btn_cancel</action-widget>
+      <action-widget 
response="-5">anastasis_gtk_b_email_dialog_btn_ok</action-widget>
+    </action-widgets>
     <child type="titlebar">
       <object class="GtkLabel">
         <property name="visible">True</property>
@@ -109,5 +118,9 @@
         <property name="label" translatable="yes">Add email 
authentication</property>
       </object>
     </child>
+    <action-widgets>
+      <action-widget 
response="-6">anastasis_gtk_b_email_dialog_btn_cancel</action-widget>
+      <action-widget 
response="-5">anastasis_gtk_b_email_dialog_btn_ok</action-widget>
+    </action-widgets>
   </object>
 </interface>
diff --git a/contrib/anastasis_gtk_auth_add_post.glade 
b/contrib/anastasis_gtk_auth_add_post.glade
index 7ab9e70..ec0b207 100644
--- a/contrib/anastasis_gtk_auth_add_post.glade
+++ b/contrib/anastasis_gtk_auth_add_post.glade
@@ -16,10 +16,11 @@
             <property name="layout-style">end</property>
             <child>
               <object class="GtkButton" 
id="anastasis_gtk_b_post_dialog_btn_cancel">
-                <property name="label" translatable="yes">Cancel</property>
+                <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
                 <property name="can-focus">True</property>
                 <property name="receives-default">True</property>
+                <property name="use-stock">True</property>
                 <signal name="clicked" 
handler="anastasis_gtk_b_post_dialog_btn_cancel_clicked_cb" swapped="no"/>
               </object>
               <packing>
@@ -30,10 +31,12 @@
             </child>
             <child>
               <object class="GtkButton" 
id="anastasis_gtk_b_post_dialog_btn_ok">
-                <property name="label" translatable="yes">OK</property>
+                <property name="label">gtk-ok</property>
                 <property name="visible">True</property>
+                <property name="sensitive">False</property>
                 <property name="can-focus">True</property>
                 <property name="receives-default">True</property>
+                <property name="use-stock">True</property>
               </object>
               <packing>
                 <property name="expand">True</property>
@@ -53,46 +56,7 @@
             <property name="visible">True</property>
             <property name="can-focus">False</property>
             <property name="orientation">vertical</property>
-            <child>
-              <object class="GtkBox">
-                <property name="can-focus">False</property>
-                <child>
-                  <object class="GtkLabel">
-                    <property name="visible">True</property>
-                    <property name="can-focus">False</property>
-                    <property name="label" translatable="yes">Choose 
provider:</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkComboBoxText" 
id="anastasis_gtk_b_post_dialog_provider">
-                    <property name="visible">True</property>
-                    <property name="can-focus">False</property>
-                    <property name="has-entry">True</property>
-                    <child internal-child="entry">
-                      <object class="GtkEntry">
-                        <property name="visible">True</property>
-                        <property name="can-focus">False</property>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
+            <property name="spacing">5</property>
             <child>
               <object class="GtkSeparator">
                 <property name="visible">True</property>
@@ -112,11 +76,13 @@
                   <object class="GtkLabel">
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
-                    <property name="label" translatable="yes">Full 
name:</property>
+                    <property name="label" translatable="yes">_Full 
name:</property>
+                    <property name="use-underline">True</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">True</property>
+                    <property name="fill">False</property>
+                    <property name="padding">5</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
@@ -124,11 +90,13 @@
                   <object class="GtkEntry" 
id="anastasis_gtk_b_post_dialog_full_name_entry">
                     <property name="visible">True</property>
                     <property name="can-focus">True</property>
+                    <property name="has-focus">True</property>
                     <property name="hexpand">True</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
+                    <property name="expand">True</property>
                     <property name="fill">True</property>
+                    <property name="padding">5</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -147,11 +115,13 @@
                   <object class="GtkLabel">
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
-                    <property name="label" 
translatable="yes">Street:</property>
+                    <property name="label" 
translatable="yes">_Street:</property>
+                    <property name="use-underline">True</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
+                    <property name="padding">5</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
@@ -162,8 +132,9 @@
                     <property name="hexpand">True</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
+                    <property name="expand">True</property>
                     <property name="fill">True</property>
+                    <property name="padding">5</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -182,11 +153,13 @@
                   <object class="GtkLabel">
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
-                    <property name="label" translatable="yes">City:</property>
+                    <property name="label" translatable="yes">_City:</property>
+                    <property name="use-underline">True</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
+                    <property name="padding">5</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
@@ -197,8 +170,9 @@
                     <property name="hexpand">True</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
+                    <property name="expand">True</property>
                     <property name="fill">True</property>
+                    <property name="padding">5</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -217,11 +191,13 @@
                   <object class="GtkLabel">
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
-                    <property name="label" 
translatable="yes">Postcode:</property>
+                    <property name="label" 
translatable="yes">_Postcode:</property>
+                    <property name="use-underline">True</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
+                    <property name="padding">5</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
@@ -232,8 +208,9 @@
                     <property name="hexpand">True</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
+                    <property name="expand">True</property>
                     <property name="fill">True</property>
+                    <property name="padding">5</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -252,11 +229,13 @@
                   <object class="GtkLabel">
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
-                    <property name="label" 
translatable="yes">Country:</property>
+                    <property name="label" 
translatable="yes">Countr_y:</property>
+                    <property name="use-underline">True</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
+                    <property name="padding">5</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
@@ -267,8 +246,9 @@
                     <property name="hexpand">True</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
+                    <property name="expand">True</property>
                     <property name="fill">True</property>
+                    <property name="padding">5</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -288,6 +268,10 @@
         </child>
       </object>
     </child>
+    <action-widgets>
+      <action-widget 
response="-6">anastasis_gtk_b_post_dialog_btn_cancel</action-widget>
+      <action-widget 
response="-5">anastasis_gtk_b_post_dialog_btn_ok</action-widget>
+    </action-widgets>
     <child type="titlebar">
       <object class="GtkLabel">
         <property name="visible">True</property>
@@ -295,5 +279,9 @@
         <property name="label" translatable="yes">Add post 
authentication</property>
       </object>
     </child>
+    <action-widgets>
+      <action-widget 
response="-6">anastasis_gtk_b_post_dialog_btn_cancel</action-widget>
+      <action-widget 
response="-5">anastasis_gtk_b_post_dialog_btn_ok</action-widget>
+    </action-widgets>
   </object>
 </interface>
diff --git a/contrib/anastasis_gtk_auth_add_question.glade 
b/contrib/anastasis_gtk_auth_add_question.glade
index 1aadd5f..2fa786b 100644
--- a/contrib/anastasis_gtk_auth_add_question.glade
+++ b/contrib/anastasis_gtk_auth_add_question.glade
@@ -5,6 +5,7 @@
   <object class="GtkDialog" id="anastasis_gtk_b_question_dialog">
     <property name="can-focus">False</property>
     <property name="type-hint">dialog</property>
+    <signal name="response" 
handler="anastasis_gtk_b_question_dialog_response_cb" swapped="no"/>
     <child internal-child="vbox">
       <object class="GtkBox">
         <property name="can-focus">False</property>
@@ -32,7 +33,8 @@
               <object class="GtkButton" 
id="anastasis_gtk_b_question_dialog_btn_ok">
                 <property name="label" translatable="yes">OK</property>
                 <property name="visible">True</property>
-                <property name="can-focus">True</property>
+                <property name="sensitive">False</property>
+                <property name="can-focus">False</property>
                 <property name="receives-default">True</property>
               </object>
               <packing>
@@ -86,6 +88,9 @@
                     <property name="visible">True</property>
                     <property name="can-focus">True</property>
                     <property name="hexpand">True</property>
+                    <property name="width-chars">60</property>
+                    <property 
name="primary-icon-stock">gtk-dialog-question</property>
+                    <signal name="changed" 
handler="anastasis_gtk_b_question_dialog_question_entry_changed_cb" 
swapped="no"/>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -98,6 +103,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
+                <property name="padding">5</property>
                 <property name="position">1</property>
               </packing>
             </child>
@@ -141,6 +147,9 @@
                 <property name="visible">True</property>
                 <property name="can-focus">True</property>
                 <property name="hexpand">True</property>
+                <property name="width-chars">60</property>
+                <property 
name="primary-icon-stock">gtk-dialog-authentication</property>
+                <signal name="changed" 
handler="anastasis_gtk_b_question_dialog_answer_entry_changed_cb" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -153,11 +162,16 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
+            <property name="padding">5</property>
             <property name="position">3</property>
           </packing>
         </child>
       </object>
     </child>
+    <action-widgets>
+      <action-widget 
response="-6">anastasis_gtk_b_question_dialog_btn_cancel</action-widget>
+      <action-widget 
response="-5">anastasis_gtk_b_question_dialog_btn_ok</action-widget>
+    </action-widgets>
     <child type="titlebar">
       <object class="GtkLabel">
         <property name="visible">True</property>
@@ -165,5 +179,9 @@
         <property name="label" translatable="yes">Add secure question 
authentication</property>
       </object>
     </child>
+    <action-widgets>
+      <action-widget 
response="-6">anastasis_gtk_b_question_dialog_btn_cancel</action-widget>
+      <action-widget 
response="-5">anastasis_gtk_b_question_dialog_btn_ok</action-widget>
+    </action-widgets>
   </object>
 </interface>
diff --git a/contrib/anastasis_gtk_auth_add_sms.glade 
b/contrib/anastasis_gtk_auth_add_sms.glade
index 91ec23e..cb81d9a 100644
--- a/contrib/anastasis_gtk_auth_add_sms.glade
+++ b/contrib/anastasis_gtk_auth_add_sms.glade
@@ -16,10 +16,12 @@
             <property name="layout-style">end</property>
             <child>
               <object class="GtkButton" 
id="anastasis_gtk_b_sms_dialog_btn_cancel">
-                <property name="label" translatable="yes">Cancel</property>
+                <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
                 <property name="can-focus">True</property>
+                <property name="has-focus">True</property>
                 <property name="receives-default">True</property>
+                <property name="use-stock">True</property>
                 <signal name="clicked" 
handler="anastasis_gtk_b_sms_dialog_btn_cancel_clicked_cb" swapped="no"/>
               </object>
               <packing>
@@ -30,10 +32,11 @@
             </child>
             <child>
               <object class="GtkButton" id="anastasis_gtk_b_sms_dialog_btn_ok">
-                <property name="label" translatable="yes">OK</property>
+                <property name="label">gtk-ok</property>
                 <property name="visible">True</property>
                 <property name="can-focus">True</property>
                 <property name="receives-default">True</property>
+                <property name="use-stock">True</property>
               </object>
               <packing>
                 <property name="expand">True</property>
@@ -75,6 +78,8 @@
                     <property name="visible">True</property>
                     <property name="can-focus">True</property>
                     <property name="hexpand">True</property>
+                    <property 
name="primary-icon-stock">gtk-dialog-authentication</property>
+                    <property name="placeholder-text" 
translatable="yes">+41123456789</property>
                     <property name="input-purpose">phone</property>
                   </object>
                   <packing>
@@ -101,6 +106,10 @@
         </child>
       </object>
     </child>
+    <action-widgets>
+      <action-widget 
response="-6">anastasis_gtk_b_sms_dialog_btn_cancel</action-widget>
+      <action-widget 
response="-5">anastasis_gtk_b_sms_dialog_btn_ok</action-widget>
+    </action-widgets>
     <child type="titlebar">
       <object class="GtkLabel">
         <property name="visible">True</property>
@@ -108,5 +117,9 @@
         <property name="label" translatable="yes">Add sms 
authentication</property>
       </object>
     </child>
+    <action-widgets>
+      <action-widget 
response="-6">anastasis_gtk_b_sms_dialog_btn_cancel</action-widget>
+      <action-widget 
response="-5">anastasis_gtk_b_sms_dialog_btn_ok</action-widget>
+    </action-widgets>
   </object>
 </interface>
diff --git a/contrib/anastasis_gtk_auth_add_video.glade 
b/contrib/anastasis_gtk_auth_add_video.glade
index cf7d39e..a05b35f 100644
--- a/contrib/anastasis_gtk_auth_add_video.glade
+++ b/contrib/anastasis_gtk_auth_add_video.glade
@@ -16,10 +16,11 @@
             <property name="layout-style">end</property>
             <child>
               <object class="GtkButton" 
id="anastasis_gtk_b_video_dialog_btn_cancel">
-                <property name="label" translatable="yes">Cancel</property>
+                <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
                 <property name="can-focus">True</property>
                 <property name="receives-default">True</property>
+                <property name="use-stock">True</property>
                 <signal name="clicked" 
handler="anastasis_gtk_b_video_dialog_btn_cancel_clicked_cb" swapped="no"/>
               </object>
               <packing>
@@ -30,10 +31,12 @@
             </child>
             <child>
               <object class="GtkButton" 
id="anastasis_gtk_b_video_dialog_btn_ok">
-                <property name="label" translatable="yes">OK</property>
+                <property name="label">gtk-ok</property>
                 <property name="visible">True</property>
+                <property name="sensitive">False</property>
                 <property name="can-focus">True</property>
                 <property name="receives-default">True</property>
+                <property name="use-stock">True</property>
               </object>
               <packing>
                 <property name="expand">True</property>
@@ -99,7 +102,6 @@
             </child>
             <child>
               <object class="GtkImage">
-                <property name="visible">True</property>
                 <property name="can-focus">False</property>
                 <property name="stock">gtk-missing-image</property>
               </object>
@@ -118,6 +120,10 @@
         </child>
       </object>
     </child>
+    <action-widgets>
+      <action-widget 
response="-6">anastasis_gtk_b_video_dialog_btn_cancel</action-widget>
+      <action-widget 
response="-5">anastasis_gtk_b_video_dialog_btn_ok</action-widget>
+    </action-widgets>
     <child type="titlebar">
       <object class="GtkLabel">
         <property name="visible">True</property>
@@ -125,5 +131,9 @@
         <property name="label" translatable="yes">Add video 
authentication</property>
       </object>
     </child>
+    <action-widgets>
+      <action-widget 
response="-6">anastasis_gtk_b_video_dialog_btn_cancel</action-widget>
+      <action-widget 
response="-5">anastasis_gtk_b_video_dialog_btn_ok</action-widget>
+    </action-widgets>
   </object>
 </interface>
diff --git a/contrib/anastasis_gtk_main_window.glade 
b/contrib/anastasis_gtk_main_window.glade
index e8332ac..1c54373 100644
--- a/contrib/anastasis_gtk_main_window.glade
+++ b/contrib/anastasis_gtk_main_window.glade
@@ -39,6 +39,8 @@ Author: Christian Grothoff, Dennis Neufeld
       <column type="gchararray"/>
       <!-- column-name visualization -->
       <column type="gchararray"/>
+      <!-- column-name index -->
+      <column type="guint"/>
     </columns>
   </object>
   <object class="GtkImage" id="backup_image">
@@ -299,7 +301,7 @@ Author: Christian Grothoff, Dennis Neufeld
                               <packing>
                                 <property name="expand">True</property>
                                 <property name="fill">True</property>
-                                <property name="padding">10</property>
+                                <property name="padding">30</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
@@ -786,7 +788,7 @@ Author: Christian Grothoff, Dennis Neufeld
                                           <packing>
                                             <property 
name="expand">False</property>
                                             <property 
name="fill">False</property>
-                                            <property 
name="padding">5</property>
+                                            <property 
name="padding">30</property>
                                             <property 
name="position">0</property>
                                           </packing>
                                         </child>
@@ -818,7 +820,9 @@ Author: Christian Grothoff, Dennis Neufeld
                                                             <property 
name="enable-search">False</property>
                                                             <property 
name="search-column">0</property>
                                                             <child 
internal-child="selection">
-                                                            <object 
class="GtkTreeSelection"/>
+                                                            <object 
class="GtkTreeSelection" id="anastasis_gtk_authentication_methods_selection">
+                                                            <signal 
name="changed" handler="auth_method_selection_changed_cb" swapped="no"/>
+                                                            </object>
                                                             </child>
                                                             <child>
                                                             <object 
class="GtkTreeViewColumn" id="auth_method_type">
@@ -869,6 +873,7 @@ Author: Christian Grothoff, Dennis Neufeld
                                               <packing>
                                                 <property 
name="expand">True</property>
                                                 <property 
name="fill">True</property>
+                                                <property 
name="padding">10</property>
                                                 <property 
name="position">0</property>
                                               </packing>
                                             </child>
@@ -966,6 +971,8 @@ Author: Christian Grothoff, Dennis Neufeld
                                   <object class="GtkAlignment">
                                     <property name="visible">True</property>
                                     <property name="can-focus">False</property>
+                                    <property name="top-padding">10</property>
+                                    <property 
name="bottom-padding">10</property>
                                     <property name="left-padding">12</property>
                                     <child>
                                       <object class="GtkScrolledWindow">
@@ -1039,7 +1046,10 @@ Author: Christian Grothoff, Dennis Neufeld
                                   <object class="GtkLabel">
                                     <property name="visible">True</property>
                                     <property name="can-focus">False</property>
-                                    <property name="label" 
translatable="yes">Review Recovery Policy</property>
+                                    <property name="margin-start">5</property>
+                                    <property name="margin-top">5</property>
+                                    <property name="margin-bottom">5</property>
+                                    <property name="label" 
translatable="yes">Review recovery policies</property>
                                     <attributes>
                                       <attribute name="weight" value="bold"/>
                                     </attributes>
@@ -1152,6 +1162,8 @@ Author: Christian Grothoff, Dennis Neufeld
                                               <object class="GtkEntry" 
id="anastasis_gtk_enter_secret_entry">
                                                 <property 
name="visible">True</property>
                                                 <property 
name="can-focus">True</property>
+                                                <property 
name="primary-icon-stock">gtk-dialog-authentication</property>
+                                                <property 
name="input-purpose">password</property>
                                               </object>
                                               <packing>
                                                 <property 
name="expand">True</property>
@@ -1288,7 +1300,7 @@ Author: Christian Grothoff, Dennis Neufeld
                                           </packing>
                                         </child>
                                         <child>
-                                          <object class="GtkBox">
+                                          <object class="GtkBox" 
id="anastasis_gtk_success_recovery_box">
                                             <property 
name="name">anastasis_gtk_success_recovery_box</property>
                                             <property 
name="can-focus">False</property>
                                             <property 
name="orientation">vertical</property>
@@ -1312,7 +1324,11 @@ Author: Christian Grothoff, Dennis Neufeld
                                                   <object class="GtkLabel" 
id="anastasis_gtk_secret_value_label">
                                                     <property 
name="visible">True</property>
                                                     <property 
name="can-focus">False</property>
+                                                    <property 
name="tooltip-text" translatable="yes">The secret is shown here in Crockford 
Base32 encoding. When copying to the clipboard or saving to file, it will be 
decoded first.</property>
                                                     <property name="label" 
translatable="yes">THE SECRET TEXT</property>
+                                                    <property 
name="wrap">True</property>
+                                                    <property 
name="wrap-mode">word-char</property>
+                                                    <property 
name="ellipsize">end</property>
                                                   </object>
                                                   <packing>
                                                     <property 
name="expand">False</property>
@@ -1477,7 +1493,7 @@ Author: Christian Grothoff, Dennis Neufeld
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkImage" id="anastasis_gtk_logo3">
+                  <object class="GtkImage" id="anastasis_gtk_b_policies_image">
                     <property name="can-focus">False</property>
                     <property name="vexpand">True</property>
                     <property name="stock">gtk-missing-image</property>
@@ -1489,7 +1505,7 @@ Author: Christian Grothoff, Dennis Neufeld
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkImage" id="anastasis_gtk_b_policies_image">
+                  <object class="GtkImage" 
id="anastasis_gtk_enter_secret_image">
                     <property name="can-focus">False</property>
                     <property name="vexpand">True</property>
                     <property name="stock">gtk-missing-image</property>
@@ -1500,6 +1516,30 @@ Author: Christian Grothoff, Dennis Neufeld
                     <property name="position">5</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkImage" id="anastasis_gtk_pay_image">
+                    <property name="can-focus">False</property>
+                    <property name="vexpand">True</property>
+                    <property name="stock">gtk-missing-image</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">6</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkImage" id="anastasis_gtk_completed_image">
+                    <property name="can-focus">False</property>
+                    <property name="vexpand">True</property>
+                    <property name="stock">gtk-missing-image</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">7</property>
+                  </packing>
+                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
diff --git a/src/anastasis/Makefile.am b/src/anastasis/Makefile.am
index b5a4956..e61076c 100644
--- a/src/anastasis/Makefile.am
+++ b/src/anastasis/Makefile.am
@@ -30,6 +30,7 @@ anastasis_gtk_SOURCES = \
   anastasis-gtk_handle-main-window-forward-clicked.c \
   anastasis-gtk_handle-main-window-forward-clicked.h \
   anastasis-gtk_handle-main-window-back-clicked.c \
+  anastasis-gtk_handle-method-question.c \
   anastasis-gtk_helper.c  anastasis-gtk_helper.h \
   os_installation.c
 
diff --git a/src/anastasis/anastasis-gtk_action.c 
b/src/anastasis/anastasis-gtk_action.c
index 1729ca7..16e1a16 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -447,6 +447,7 @@ action_user_attributes_collecting (void)
                                id_attr);
     }
   }
+  // FIXME: add KNOWN attributes from state to widgets!
 
   AG_sensitive ("anastasis_gtk_main_window_prev_button");
   AG_show ("anastasis_gtk_main_control_vbox");
@@ -504,6 +505,7 @@ static void
 action_authentications_editing (void)
 {
   json_t *aps;
+  bool have_auth;
 
   AG_hide_all_frames ();
   AG_insensitive_children ("anastasis_gtk_add_auth_button_box");
@@ -532,9 +534,6 @@ action_authentications_editing (void)
         GNUNET_JSON_spec_end ()
       };
 
-      json_dumpf (ap,
-                  stderr,
-                  JSON_INDENT (2));
       if (GNUNET_OK !=
           GNUNET_JSON_parse (ap,
                              spec,
@@ -566,10 +565,54 @@ action_authentications_editing (void)
       GNUNET_JSON_parse_free (spec);
     }
   }
-  // FIXME: add logic to check if auth methods WERE added,
-  // and if so, make button sensitive!
+
+  have_auth = false;
+  {
+    GtkListStore *ls;
+    json_t *ams;
+    size_t index;
+    json_t *am;
+
+    ls = GTK_LIST_STORE (GCG_get_main_window_object (
+                           "authentication_methods_liststore"));
+    gtk_list_store_clear (ls);
+    ams = json_object_get (redux_state,
+                           "authentication_methods");
+    json_array_foreach (ams,
+                        index,
+                        am)
+    {
+      const char *type;
+      const char *instructions;
+      struct GNUNET_JSON_Specification spec[] = {
+        GNUNET_JSON_spec_string ("type",
+                                 &type),
+        GNUNET_JSON_spec_string ("instructions",
+                                 &instructions),
+        GNUNET_JSON_spec_end ()
+      };
+
+      GNUNET_assert (GNUNET_OK ==
+                     GNUNET_JSON_parse (am,
+                                        spec,
+                                        NULL, NULL));
+      // FIXME: use proper enum
+      gtk_list_store_insert_with_values (ls,
+                                         NULL,
+                                         -1,
+                                         0, type,
+                                         1, instructions,
+                                         2, (guint) index,
+                                         -1);
+      have_auth = true;
+    }
+  }
+
   AG_sensitive ("anastasis_gtk_main_window_prev_button");
-  AG_insensitive ("anastasis_gtk_main_window_forward_button");
+  if (have_auth)
+    AG_sensitive ("anastasis_gtk_main_window_forward_button");
+  else
+    AG_insensitive ("anastasis_gtk_main_window_forward_button");
   AG_show ("anastasis_gtk_main_control_vbox");
   AG_show ("anastasis_gtk_main_window_prev_button");
   AG_show ("anastasis_gtk_main_window_forward_button");
@@ -587,9 +630,109 @@ action_policies_reviewing (void)
   json_dumpf (redux_state,
               stderr,
               JSON_INDENT (2));
+  // FIXME: import into tree model!
+  AG_sensitive ("anastasis_gtk_main_window_prev_button");
+  AG_sensitive ("anastasis_gtk_main_window_forward_button");
   AG_show ("anastasis_gtk_b_policy_frame");
   AG_show ("anastasis_gtk_b_policies_image");
-  // set_policy_check_buttons (redux_state);
+  AG_show ("anastasis_gtk_main_control_vbox");
+  AG_show ("anastasis_gtk_main_window_prev_button");
+  AG_show ("anastasis_gtk_main_window_forward_button");
+}
+
+
+static void
+action_secret_editing (void)
+{
+  GtkEntry *entry;
+
+  AG_hide_all_frames ();
+  GNUNET_break (0);
+  entry = GTK_ENTRY (GCG_get_main_window_object (
+                       "anastasis_gtk_enter_secret_entry"));
+  AG_sensitive ("anastasis_gtk_main_window_prev_button");
+
+  // FIXME: if secret is already present, set to sensitive!
+  AG_insensitive ("anastasis_gtk_main_window_forward_button");
+
+  AG_show ("anastasis_gtk_enter_secret_frame");
+  AG_show ("anastasis_gtk_enter_secret_image");
+  AG_show ("anastasis_gtk_main_control_vbox");
+  AG_show ("anastasis_gtk_main_window_prev_button");
+  AG_show ("anastasis_gtk_main_window_forward_button");
+}
+
+
+static void
+action_truths_paying (void)
+{
+  AG_hide_all_frames ();
+  GNUNET_break (0);
+  // FIXME: show payment QR codes!
+  AG_sensitive ("anastasis_gtk_main_window_prev_button");
+
+  AG_show ("anastasis_gtk_pay_frame");
+  AG_show ("anastasis_gtk_pay_image");
+  AG_show ("anastasis_gtk_main_control_vbox");
+  AG_show ("anastasis_gtk_main_window_prev_button");
+  AG_hide ("anastasis_gtk_main_window_forward_button");
+}
+
+
+static void
+action_policies_paying (void)
+{
+  AG_hide_all_frames ();
+  GNUNET_break (0);
+  // FIXME: show payment QR codes!
+  AG_sensitive ("anastasis_gtk_main_window_prev_button");
+
+  AG_show ("anastasis_gtk_pay_frame");
+  AG_show ("anastasis_gtk_pay_image");
+  AG_show ("anastasis_gtk_main_control_vbox");
+  AG_show ("anastasis_gtk_main_window_prev_button");
+  AG_hide ("anastasis_gtk_main_window_forward_button");
+}
+
+
+static void
+action_backup_finished (void)
+{
+  AG_hide_all_frames ();
+  AG_show ("anastasis_gtk_completed_frame");
+  AG_show ("anastasis_gtk_success_backup_label");
+  AG_hide ("anastasis_gtk_success_recovery_box");
+  AG_show ("anastasis_gtk_completed_image");
+  AG_show ("anastasis_gtk_main_control_vbox");
+  AG_hide ("anastasis_gtk_main_window_save_as_button");
+  AG_show ("anastasis_gtk_main_window_quit_button");
+  AG_hide ("anastasis_gtk_main_window_prev_button");
+  AG_hide ("anastasis_gtk_main_window_forward_button");
+}
+
+
+static void
+action_recovery_finished (void)
+{
+  GtkLabel *l;
+  const char *secret;
+
+  AG_hide_all_frames ();
+  l = GTK_LABEL (GCG_get_main_window_object (
+                   "anastasis_gtk_secret_value_label"));
+  secret = json_string_value (gtk_object_get (redux_state,
+                                              "core_secret"));
+  gtk_label_set_text (l,
+                      secret);
+  AG_show ("anastasis_gtk_completed_frame");
+  AG_hide ("anastasis_gtk_success_backup_label");
+  AG_show ("anastasis_gtk_success_recovery_box");
+  AG_show ("anastasis_gtk_completed_image");
+  AG_show ("anastasis_gtk_main_control_vbox");
+  AG_hide ("anastasis_gtk_main_window_save_as_button");
+  AG_show ("anastasis_gtk_main_window_quit_button");
+  AG_hide ("anastasis_gtk_main_window_prev_button");
+  AG_hide ("anastasis_gtk_main_window_forward_button");
 }
 
 
@@ -616,8 +759,16 @@ AG_action_cb (void *cls,
       .action = &action_authentications_editing },
     { .state = "POLICIES_REVIEWING",
       .action = &action_policies_reviewing },
-    { .state = "TBD",
-      .action = NULL },
+    { .state = "SECRET_EDITING",
+      .action = &action_secret_editing },
+    { .state = "TRUTHS_PAYING",
+      .action = &action_truths_paying },
+    { .state = "POLICIES_PAYING",
+      .action = &action_policies_paying },
+    { .state = "BACKUP_FINISHED",
+      .action = &action_backup_finished },
+    { .state = "RECOVERY_FINISHED",
+      .action = &action_recovery_finished },
     { .state = NULL,
       .action = NULL }
   };
diff --git a/src/anastasis/anastasis-gtk_handle-auth-delete-button-clicked.c 
b/src/anastasis/anastasis-gtk_handle-auth-delete-button-clicked.c
index 38feb3f..cd871a4 100644
--- a/src/anastasis/anastasis-gtk_handle-auth-delete-button-clicked.c
+++ b/src/anastasis/anastasis-gtk_handle-auth-delete-button-clicked.c
@@ -18,8 +18,8 @@
      Boston, MA 02110-1301, USA.
 */
 /**
- * @file src/anastasis/anastasis-gtk_backup.c
- * @brief Main function of anastasis-gtk
+ * @file src/anastasis/anastasis-gtk_handle-auth-delete-button-clicked.c
+ * @brief Support for deletion of authentication methods
  * @author Christian Grothoff
  * @author Dennis Neufeld
  */
@@ -30,80 +30,6 @@
 #include <jansson.h>
 
 
-/**
- * Delete method from hbox.
- *
- * @param user_data pointer to hbox containing method
- */
-static void
-delete_auth_method (gpointer user_data)
-{
-  if (GTK_IS_BOX (user_data))
-  {
-    GList *user_data_children, *iter;
-    user_data_children = gtk_container_get_children (GTK_CONTAINER 
(user_data));
-
-    // parse state to delete method
-    if (NULL != user_data_children)
-    {
-      const gchar *label;
-      json_t *arguments = json_object ();
-      GNUNET_assert (NULL != arguments);
-      json_t *method = json_object ();
-      GNUNET_assert (NULL != method);
-      json_t *value = json_object ();
-      GNUNET_assert (NULL != value);
-      unsigned int index = 0;
-
-      for (iter = user_data_children; iter != NULL; iter = g_list_next (iter))
-      {
-        if (GTK_IS_LABEL (iter->data))
-        {
-          label = gtk_label_get_text (GTK_LABEL (iter->data));
-
-          if (index == 0)
-          {
-            char *method_type = NULL;
-            if (0 == strcmp ("Q: ", label))
-              method_type = "question";
-            if (0 == strcmp ("SMS: ", label))
-              method_type = "sms";
-            if (0 == strcmp ("VIDEO: ", label))
-              method_type = "video";
-            if (0 == strcmp ("POST: ", label))
-              method_type = "post";
-            if (0 == strcmp ("EMAIL: ", label))
-              method_type = "email";
-
-            GNUNET_assert (0 == json_object_set_new (method,
-                                                     "method",
-                                                     json_string (
-                                                       method_type)));
-          }
-          if (index == 1)
-          {
-            GNUNET_assert (0 == json_object_set_new (method,
-                                                     "value",
-                                                     json_string (label)));
-            GNUNET_assert (0 == json_object_set_new (arguments,
-                                                     "authentication_method",
-                                                     method));
-            ra = ANASTASIS_redux_action (redux_state,
-                                         "delete_authentication",
-                                         arguments,
-                                         &AG_action_cb,
-                                         NULL);
-          }
-          index++;
-        }
-        gtk_widget_destroy (iter->data);
-      }
-    }
-    g_list_free (user_data_children);
-  }
-}
-
-
 /**
  * Callback invoked if the the "authentication methods delete"-button is 
clicked.
  *
@@ -114,27 +40,50 @@ void
 anastasis_gtk_authentication_method_delete_button_clicked_cb (GObject *object,
                                                               gpointer 
user_data)
 {
-#if 0
-  delete_auth_method (user_data);
+  json_t *args;
+  guint index;
+  GtkTreeSelection *ts;
+  GtkTreeModel *model;
+  GtkTreeIter iter;
 
-  // if no methods, set sensitivity of forward button to false
-  GList *vbox_children = gtk_container_get_children (GTK_CONTAINER (
-                                                       
GCG_get_main_window_object (
-                                                         
"anastasis_gtk_b_authentication_vbox")));
-  if (NULL == vbox_children)
-    gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-                                            
"anastasis_gtk_main_window_forward_button")),
-                              false);
-  g_list_free (vbox_children);
-#endif
+  ts = GTK_TREE_SELECTION (GCG_get_main_window_object (
+                             
"anastasis_gtk_authentication_methods_selection"));
+  if (! gtk_tree_selection_get_selected (ts,
+                                         &model,
+                                         &iter))
+  {
+    GNUNET_break (0);
+    return;
+  }
+  gtk_tree_model_get (model,
+                      &iter,
+                      2, &index,
+                      -1);
+  AG_freeze ();
+  args = json_pack ("{s:I}",
+                    "auth_method_index",
+                    index);
+  ra = ANASTASIS_redux_action (redux_state,
+                               "delete_authentication",
+                               args,
+                               &AG_action_cb,
+                               NULL);
+  json_decref (args);
 }
 
 
 void
-anastasis_gtk_authentication_method_selection_changed (
+auth_method_selection_changed_cb (
   GtkTreeSelection *treeselection,
   gpointer user_data)
 {
-  // Check if selection is non-empty, toggle sensitivity of delete button!
-  GNUNET_break (0);
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+
+  if (gtk_tree_selection_get_selected (treeselection,
+                                       &model,
+                                       &iter))
+    AG_sensitive ("anastasis_gtk_authentication_method_delete_button");
+  else
+    AG_insensitive ("anastasis_gtk_authentication_method_delete_button");
 }
diff --git a/src/anastasis/anastasis-gtk_handle-method-question.c 
b/src/anastasis/anastasis-gtk_handle-method-question.c
new file mode 100644
index 0000000..18d716b
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_handle-method-question.c
@@ -0,0 +1,160 @@
+/*
+     This file is part of anastasis-gtk.
+     Copyright (C) 2020 Anastasis SARL
+
+     Anastasis is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 3, or (at your
+     option) any later version.
+
+     Anastasis is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with Anastasis; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
+*/
+
+/**
+ * @file src/anastasis/anastasis-gtk_handle-method-question.c
+ * @brief Handle dialogs for security question
+ * @author Christian Grothoff
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_action.h"
+#include "anastasis-gtk_helper.h"
+#include "anastasis-gtk_handle-identity-changed.h"
+#include <jansson.h>
+
+
+/**
+ * Function called from the security-question dialog upon completion.
+ *
+ * @param dialog the pseudonym selection dialog
+ * @param response_id response code from the dialog
+ * @param user_data the builder of the dialog
+ */
+void
+anastasis_gtk_b_question_dialog_response_cb (GtkDialog *dialog,
+                                             gint response_id,
+                                             gpointer user_data)
+{
+  GtkBuilder *builder = GTK_BUILDER (user_data);
+  GtkEntry *q;
+  GtkEntry *a;
+  const char *qs;
+  const char *as;
+  json_t *args;
+
+  if (GTK_RESPONSE_OK != response_id)
+  {
+    gtk_widget_destroy (GTK_WIDGET (dialog));
+    g_object_unref (G_OBJECT (builder));
+    return;
+  }
+  q = GTK_ENTRY (gtk_builder_get_object (builder,
+                                         
"anastasis_gtk_b_question_dialog_question_entry"));
+  qs = gtk_entry_get_text (q);
+  a = GTK_ENTRY (gtk_builder_get_object (builder,
+                                         
"anastasis_gtk_b_question_dialog_answer_entry"));
+  as = gtk_entry_get_text (a);
+  args = json_pack ("{ s:{s:s, s:o, s:s}}",
+                    "authentication_method",
+                    "type",
+                    "question",
+                    "challenge",
+                    GNUNET_JSON_from_data (as,
+                                           strlen (as)),
+                    "instructions",
+                    qs);
+  gtk_widget_destroy (GTK_WIDGET (dialog));
+  g_object_unref (G_OBJECT (builder));
+  AG_freeze ();
+  ra = ANASTASIS_redux_action (redux_state,
+                               "add_authentication",
+                               args,
+                               &AG_action_cb,
+                               NULL);
+  json_decref (args);
+}
+
+
+static void
+update_sensitivity (GtkBuilder *builder)
+{
+  GtkEntry *q;
+  GtkEntry *a;
+  const char *qs;
+  const char *as;
+
+  q = GTK_ENTRY (gtk_builder_get_object (builder,
+                                         
"anastasis_gtk_b_question_dialog_question_entry"));
+  qs = gtk_entry_get_text (q);
+  a = GTK_ENTRY (gtk_builder_get_object (builder,
+                                         
"anastasis_gtk_b_question_dialog_answer_entry"));
+  as = gtk_entry_get_text (a);
+  gtk_widget_set_sensitive (
+    GTK_WIDGET (gtk_builder_get_object (builder,
+                                        
"anastasis_gtk_b_question_dialog_btn_ok")),
+    ( (NULL != qs) &&
+      (0 < strlen (qs)) &&
+      (NULL != as) &&
+      (0 < strlen (as)) ));
+}
+
+
+void
+anastasis_gtk_b_question_dialog_question_entry_changed_cb (GtkEntry *entry,
+                                                           gpointer user_data)
+{
+  GtkBuilder *builder = GTK_BUILDER (user_data);
+
+  update_sensitivity (builder);
+}
+
+
+void
+anastasis_gtk_b_question_dialog_answer_entry_changed_cb (GtkEntry *entry,
+                                                         gpointer user_data)
+{
+  GtkBuilder *builder = GTK_BUILDER (user_data);
+
+  update_sensitivity (builder);
+}
+
+
+/**
+ * Callback invoked if the the "secure question"-button is clicked.
+ *
+ * @param object
+ * @param user_data unused
+ */
+void
+anastasis_gtk_btn_add_auth_question_clicked_cb (GObject *object,
+                                                gpointer user_data)
+{
+  GtkWidget *ad;
+  GtkBuilder *builder;
+
+  builder = GNUNET_GTK_get_new_builder 
("anastasis_gtk_auth_add_question.glade",
+                                        NULL);
+  if (NULL == builder)
+  {
+    GNUNET_break (0);
+    return;
+  }
+  ad = GTK_WIDGET (gtk_builder_get_object (builder,
+                                           "anastasis_gtk_b_question_dialog"));
+  {
+    GtkWidget *toplevel;
+
+    toplevel = gtk_widget_get_toplevel (GTK_WIDGET (object));
+    gtk_window_set_transient_for (GTK_WINDOW (ad),
+                                  GTK_WINDOW (toplevel));
+    gtk_window_present (GTK_WINDOW (ad));
+  }
+}

-- 
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]