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 #7082 (incomplete)


From: gnunet
Subject: [taler-anastasis-gtk] branch master updated: work on #7082 (incomplete)
Date: Sun, 21 Nov 2021 23:11:45 +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 9142443  work on #7082 (incomplete)
9142443 is described below

commit 9142443ac99346ad6fe996179a2c53e6a9b6eead
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Nov 21 23:11:37 2021 +0100

    work on #7082 (incomplete)
---
 contrib/Makefile.am                                |   5 +-
 contrib/anastasis_gtk_challenge_template.glade     | 133 +++++++++
 contrib/anastasis_gtk_main_window.glade            | 317 ++-------------------
 contrib/anastasis_gtk_policy_template.glade        |  41 +++
 contrib/checkmark.svgz                             | Bin 0 -> 938 bytes
 src/anastasis/Makefile.am                          |   1 -
 src/anastasis/anastasis-gtk_action.c               | 257 +++++++++++++++++
 .../anastasis-gtk_handle-challenge-row-activated.c | 188 ------------
 8 files changed, 457 insertions(+), 485 deletions(-)

diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index d2a2cdb..22f0e14 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -16,6 +16,7 @@ IMAGES = \
   outline_home_work_black_24dp.png \
   ngi_ledger.png \
   freeotp.png \
+  checkmark.svgz \
   bandiera_stelle.png
 
 EXTRA_DIST = \
@@ -36,13 +37,15 @@ pkgdata_DATA = \
   anastasis_gtk_challenge_code.glade \
   anastasis_gtk_challenge_iban.glade \
   anastasis_gtk_challenge_question.glade \
+  anastasis_gtk_challenge_template.glade \
   anastasis_gtk_challenge_totp.glade \
   anastasis_gtk_deny_singlefactor.glade \
   anastasis_gtk_edit_providers.glade \
   anastasis_gtk_edit_policy.glade \
+  anastasis_gtk_main_window.glade \
   anastasis_gtk_open_file_dialog.glade \
   anastasis_gtk_open_secret_dialog.glade \
-  anastasis_gtk_main_window.glade \
+  anastasis_gtk_policy_template.glade \
   anastasis_gtk_save_file_dialog.glade \
   anastasis_gtk_save_secret_dialog.glade \
   anastasis_gtk_warn_multifactor.glade
diff --git a/contrib/anastasis_gtk_challenge_template.glade 
b/contrib/anastasis_gtk_challenge_template.glade
new file mode 100644
index 0000000..45aab11
--- /dev/null
+++ b/contrib/anastasis_gtk_challenge_template.glade
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.2 -->
+<interface>
+  <requires lib="gtk+" version="3.24"/>
+  <object class="GtkWindow" id="challenge_template_window">
+    <property name="can-focus">False</property>
+    <child>
+      <object class="GtkBox" id="challenge_hbox">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="margin-top">5</property>
+        <property name="margin-bottom">5</property>
+        <property name="spacing">15</property>
+        <child>
+          <object class="GtkImage" id="challenge_category_otp_image">
+            <property name="can-focus">False</property>
+            <property name="pixbuf">freeotp.png</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="padding">15</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkImage" id="challenge_category_email_image">
+            <property name="can-focus">False</property>
+            <property name="pixbuf">outline_email_black_24dp.png</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="padding">15</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkImage" id="challenge_category_post_image">
+            <property name="can-focus">False</property>
+            <property name="pixbuf">home_work_black_24dp.svg</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="padding">15</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkImage" id="challenge_category_sms_image">
+            <property name="can-focus">False</property>
+            <property 
name="pixbuf">outline_stay_current_portrait_black_24dp.png</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="padding">15</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkImage" id="challenge_category_bank_image">
+            <property name="can-focus">False</property>
+            <property 
name="pixbuf">video_camera_front_black_24dp.svg</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="padding">15</property>
+            <property name="position">4</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkImage" id="challenge_category_question_image">
+            <property name="can-focus">False</property>
+            <property 
name="pixbuf">outline_contact_support_black_24dp.png</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="padding">15</property>
+            <property name="position">5</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="challenge_label">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <property name="label">DYNAMICALLY GENERATED</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="padding">15</property>
+            <property name="position">6</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="solve_challenge_button">
+            <property name="label">gtk-execute</property>
+            <property name="visible">True</property>
+            <property name="can-focus">True</property>
+            <property name="receives-default">True</property>
+            <property name="tooltip-text" translatable="yes">Try to solve this 
challenge.</property>
+            <property name="use-stock">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="padding">15</property>
+            <property name="position">7</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkImage" id="challenge_solved_image">
+            <property name="name">challenge_solved_image</property>
+            <property name="can-focus">False</property>
+            <property name="tooltip-text" translatable="yes">This challenge 
was solved.</property>
+            <property name="pixbuf">checkmark.svgz</property>
+            <property name="icon_size">1</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="padding">15</property>
+            <property name="position">8</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/contrib/anastasis_gtk_main_window.glade 
b/contrib/anastasis_gtk_main_window.glade
index 66eca6a..43f5237 100644
--- a/contrib/anastasis_gtk_main_window.glade
+++ b/contrib/anastasis_gtk_main_window.glade
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 
+<!-- Generated with glade 3.38.2
 
 Copyright (C) 2019-2021 Anastasis SARL
 
@@ -88,6 +88,16 @@ Author: Christian Grothoff, Dennis Neufeld
     <property name="step-increment">1</property>
     <property name="page-increment">10</property>
   </object>
+  <object class="GtkAdjustment" id="anastasis_gtk_policy_box_adjustment_h">
+    <property name="upper">100</property>
+    <property name="step-increment">1</property>
+    <property name="page-increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="anastasis_gtk_policy_box_adjustment_v">
+    <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 -->
@@ -378,13 +388,6 @@ Author: Christian Grothoff, Dennis Neufeld
       <column type="gchararray"/>
     </columns>
   </object>
-  <object class="GtkImage" id="video_image">
-    <property name="visible">True</property>
-    <property name="can-focus">False</property>
-    <property name="margin-right">5</property>
-    <property name="margin-end">5</property>
-    <property 
name="pixbuf">outline_video_camera_front_black_24dp.png</property>
-  </object>
   <object class="GtkWindow" id="anastasis_gtk_main_window">
     <property name="can-focus">False</property>
     <property name="events">GDK_BUTTON_PRESS_MASK | 
GDK_STRUCTURE_MASK</property>
@@ -1878,20 +1881,6 @@ with &lt;a 
href="https://www.ngi.eu/ngi-projects/ledger/"&gt;funding&lt;/a&gt; f
                                                     <property 
name="top-attach">0</property>
                                                   </packing>
                                                 </child>
-                                                <child>
-                                                  <object class="GtkButton" 
id="anastasis_gtk_btn_add_auth_video">
-                                                    <property name="label" 
translatable="yes">_Video</property>
-                                                    <property 
name="can-focus">True</property>
-                                                    <property 
name="receives-default">True</property>
-                                                    <property 
name="image">video_image</property>
-                                                    <property 
name="use-underline">True</property>
-                                                    <signal name="clicked" 
handler="anastasis_gtk_btn_add_auth_video_clicked_cb" swapped="no"/>
-                                                  </object>
-                                                  <packing>
-                                                    <property 
name="left-attach">3</property>
-                                                    <property 
name="top-attach">0</property>
-                                                  </packing>
-                                                </child>
                                                 <child>
                                                   <object class="GtkButton" 
id="anastasis_gtk_btn_add_auth_post">
                                                     <property name="label" 
translatable="yes">Post</property>
@@ -2305,291 +2294,29 @@ You can also use "back" to add additional 
authentication methods.</property>
                                     <property name="can-focus">False</property>
                                     <property name="left-padding">12</property>
                                     <child>
-                                      <object class="GtkBox">
+                                      <object class="GtkScrolledWindow">
                                         <property 
name="visible">True</property>
-                                        <property 
name="can-focus">False</property>
-                                        <property 
name="orientation">vertical</property>
-                                        <child>
-                                          <object class="GtkFrame">
-                                            <property 
name="visible">True</property>
-                                            <property 
name="can-focus">False</property>
-                                            <property 
name="label-xalign">0</property>
-                                            <property 
name="shadow-type">none</property>
-                                            <child>
-                                              <object class="GtkAlignment">
-                                                <property 
name="visible">True</property>
-                                                <property 
name="can-focus">False</property>
-                                                <property 
name="left-padding">12</property>
-                                                <child>
-                                                  <object 
class="GtkScrolledWindow">
-                                                    <property 
name="visible">True</property>
-                                                    <property 
name="can-focus">True</property>
-                                                    <property 
name="shadow-type">in</property>
-                                                    <child>
-                                                      <object 
class="GtkTreeView" id="anastasis_gtk_challenge_status_treeview">
-                                                        <property 
name="visible">True</property>
-                                                        <property 
name="can-focus">True</property>
-                                                        <property 
name="tooltip-text" translatable="yes">Here you can see your progress in 
satisfying authorization challenges and can select the next challenge to 
solve.</property>
-                                                        <property 
name="model">challenge_status_liststore</property>
-                                                        <signal 
name="row-activated" 
handler="anastasis_gtk_challenge_status_treeview_row_activated_cb" 
swapped="no"/>
-                                                        <child 
internal-child="selection">
-                                                          <object 
class="GtkTreeSelection" id="anastasis_gtk_challenge_status_treeselection">
-                                                            <signal 
name="changed" 
handler="anastasis_gtk_challenge_status_treeselection_changed_cb" swapped="no"/>
-                                                          </object>
-                                                        </child>
-                                                        <child>
-                                                          <object 
class="GtkTreeViewColumn">
-                                                            <property 
name="title" translatable="yes">#</property>
-                                                            <property 
name="sort-column-id">0</property>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererToggle" id="solved">
-                                                            <signal 
name="toggled" handler="anastasis_gtk_challenge_status_solved_toggled_cb" 
swapped="no"/>
-                                                            </object>
-                                                            <attributes>
-                                                            <attribute 
name="sensitive">12</attribute>
-                                                            <attribute 
name="activatable">12</attribute>
-                                                            <attribute 
name="active">2</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererText" id="challenge_number"/>
-                                                            <attributes>
-                                                            <attribute 
name="text">0</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                          </object>
-                                                        </child>
-                                                        <child>
-                                                          <object 
class="GtkTreeViewColumn">
-                                                            <property 
name="title" translatable="yes">Status</property>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererText" id="status_text"/>
-                                                            <attributes>
-                                                            <attribute 
name="text">3</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                          </object>
-                                                        </child>
-                                                        <child>
-                                                          <object 
class="GtkTreeViewColumn" id="type1">
-                                                            <property 
name="title" translatable="yes">Type</property>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererText" id="type_column"/>
-                                                            <attributes>
-                                                            <attribute 
name="text">13</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                          </object>
-                                                        </child>
-                                                        <child>
-                                                          <object 
class="GtkTreeViewColumn">
-                                                            <property 
name="title" translatable="yes">Cost</property>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererText" id="cost"/>
-                                                            <attributes>
-                                                            <attribute 
name="text">9</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                          </object>
-                                                        </child>
-                                                        <child>
-                                                          <object 
class="GtkTreeViewColumn" id="hint">
-                                                            <property 
name="title" translatable="yes">Instructions</property>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererText" id="instructions_text">
-                                                            <property 
name="ellipsize">end</property>
-                                                            <property 
name="max-width-chars">20</property>
-                                                            </object>
-                                                            <attributes>
-                                                            <attribute 
name="text">14</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                          </object>
-                                                        </child>
-                                                        <child>
-                                                          <object 
class="GtkTreeViewColumn">
-                                                            <property 
name="sizing">autosize</property>
-                                                            <property 
name="title" translatable="yes">Provider</property>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererText" id="provider_url_text_column"/>
-                                                            <attributes>
-                                                            <attribute 
name="text">15</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                          </object>
-                                                        </child>
-                                                        <child>
-                                                          <object 
class="GtkTreeViewColumn">
-                                                            <property 
name="title" translatable="yes">Details</property>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererText" id="emsg">
-                                                            <property 
name="foreground">red</property>
-                                                            </object>
-                                                            <attributes>
-                                                            <attribute 
name="visible">8</attribute>
-                                                            <attribute 
name="text">5</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererPixbuf" id="qrcode"/>
-                                                            <attributes>
-                                                            <attribute 
name="visible">7</attribute>
-                                                            <attribute 
name="pixbuf">4</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererText" id="redirect_url"/>
-                                                            <attributes>
-                                                            <attribute 
name="visible">11</attribute>
-                                                            <attribute 
name="text">10</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                          </object>
-                                                        </child>
-                                                      </object>
-                                                    </child>
-                                                  </object>
-                                                </child>
-                                              </object>
-                                            </child>
-                                            <child type="label">
-                                              <object class="GtkLabel">
-                                                <property 
name="visible">True</property>
-                                                <property 
name="can-focus">False</property>
-                                                <property name="tooltip-text" 
translatable="yes">Here you can see your progress in satisfying authorization 
challenges and possible next steps.</property>
-                                                <property 
name="margin-start">5</property>
-                                                <property 
name="margin-end">5</property>
-                                                <property 
name="margin-top">5</property>
-                                                <property 
name="margin-bottom">5</property>
-                                                <property name="label" 
translatable="yes">Select open challenge to solve:</property>
-                                              </object>
-                                            </child>
-                                          </object>
-                                          <packing>
-                                            <property 
name="expand">True</property>
-                                            <property 
name="fill">True</property>
-                                            <property 
name="position">1</property>
-                                          </packing>
-                                        </child>
+                                        <property 
name="can-focus">True</property>
+                                        <property 
name="hadjustment">anastasis_gtk_policy_box_adjustment_h</property>
+                                        <property 
name="vadjustment">anastasis_gtk_policy_box_adjustment_v</property>
+                                        <property 
name="shadow-type">in</property>
                                         <child>
-                                          <object class="GtkFrame">
+                                          <object class="GtkViewport">
                                             <property 
name="visible">True</property>
                                             <property 
name="can-focus">False</property>
-                                            <property 
name="label-xalign">0</property>
-                                            <property 
name="shadow-type">none</property>
+                                            <property 
name="hadjustment">anastasis_gtk_policy_box_adjustment_h</property>
+                                            <property 
name="vadjustment">anastasis_gtk_policy_box_adjustment_v</property>
                                             <child>
-                                              <object class="GtkAlignment">
+                                              <object class="GtkBox" 
id="anastasis_gtk_policy_vbox">
                                                 <property 
name="visible">True</property>
                                                 <property 
name="can-focus">False</property>
-                                                <property 
name="left-padding">12</property>
+                                                <property 
name="orientation">vertical</property>
                                                 <child>
-                                                  <object 
class="GtkScrolledWindow">
-                                                    <property 
name="visible">True</property>
-                                                    <property 
name="can-focus">True</property>
-                                                    <property 
name="shadow-type">in</property>
-                                                    <child>
-                                                      <object 
class="GtkTreeView" id="anastasis_gtk_choose_policy_treeview">
-                                                        <property 
name="visible">True</property>
-                                                        <property 
name="can-focus">True</property>
-                                                        <property 
name="tooltip-text" translatable="yes">This table shows possible ways to 
recover the secret. For each policy, the challenges that must still be 
satisfied are listed.</property>
-                                                        <property 
name="model">policy_review_treestore</property>
-                                                        <property 
name="enable-search">False</property>
-                                                        <property 
name="search-column">0</property>
-                                                        <child 
internal-child="selection">
-                                                          <object 
class="GtkTreeSelection"/>
-                                                        </child>
-                                                        <child>
-                                                          <object 
class="GtkTreeViewColumn" id="solved_column">
-                                                            <property 
name="sizing">autosize</property>
-                                                            <property 
name="title" translatable="yes">Solved</property>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererToggle" id="solved_column2">
-                                                            <property 
name="activatable">False</property>
-                                                            </object>
-                                                            <attributes>
-                                                            <attribute 
name="active">8</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                          </object>
-                                                        </child>
-                                                        <child>
-                                                          <object 
class="GtkTreeViewColumn" id="policy_name_column1">
-                                                            <property 
name="resizable">True</property>
-                                                            <property 
name="spacing">5</property>
-                                                            <property 
name="sizing">autosize</property>
-                                                            <property 
name="title" translatable="yes">Policy</property>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererText" id="policy_name_column2"/>
-                                                            <attributes>
-                                                            <attribute 
name="text">0</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                          </object>
-                                                        </child>
-                                                        <child>
-                                                          <object 
class="GtkTreeViewColumn" id="challenge_type_column2">
-                                                            <property 
name="spacing">5</property>
-                                                            <property 
name="sizing">autosize</property>
-                                                            <property 
name="title" translatable="yes">Type</property>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererText" id="challenge_type_column3"/>
-                                                            <attributes>
-                                                            <attribute 
name="text">1</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                          </object>
-                                                        </child>
-                                                        <child>
-                                                          <object 
class="GtkTreeViewColumn" id="policy_cost1">
-                                                            <property 
name="spacing">5</property>
-                                                            <property 
name="sizing">autosize</property>
-                                                            <property 
name="title" translatable="yes">Cost</property>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererText" id="cost_column1"/>
-                                                            <attributes>
-                                                            <attribute 
name="text">2</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                          </object>
-                                                        </child>
-                                                        <child>
-                                                          <object 
class="GtkTreeViewColumn" id="provider_column1">
-                                                            <property 
name="resizable">True</property>
-                                                            <property 
name="spacing">5</property>
-                                                            <property 
name="sizing">autosize</property>
-                                                            <property 
name="title" translatable="yes">Provider</property>
-                                                            <child>
-                                                            <object 
class="GtkCellRendererText" id="provider_url_column1"/>
-                                                            <attributes>
-                                                            <attribute 
name="text">3</attribute>
-                                                            </attributes>
-                                                            </child>
-                                                          </object>
-                                                        </child>
-                                                      </object>
-                                                    </child>
-                                                  </object>
+                                                  <placeholder/>
                                                 </child>
                                               </object>
                                             </child>
-                                            <child type="label">
-                                              <object class="GtkLabel">
-                                                <property 
name="visible">True</property>
-                                                <property 
name="can-focus">False</property>
-                                                <property name="tooltip-text" 
translatable="yes">This table shows possible ways to recover the secret. For 
each policy, the challenges that must still be satisfied are listed.</property>
-                                                <property 
name="margin-start">5</property>
-                                                <property 
name="margin-end">5</property>
-                                                <property 
name="margin-top">5</property>
-                                                <property 
name="margin-bottom">5</property>
-                                                <property name="label" 
translatable="yes">Recovery policies:</property>
-                                              </object>
-                                            </child>
                                           </object>
-                                          <packing>
-                                            <property 
name="expand">True</property>
-                                            <property 
name="fill">True</property>
-                                            <property 
name="position">2</property>
-                                          </packing>
                                         </child>
                                       </object>
                                     </child>
diff --git a/contrib/anastasis_gtk_policy_template.glade 
b/contrib/anastasis_gtk_policy_template.glade
new file mode 100644
index 0000000..33e22ea
--- /dev/null
+++ b/contrib/anastasis_gtk_policy_template.glade
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.2 -->
+<interface>
+  <requires lib="gtk+" version="3.24"/>
+  <object class="GtkWindow" id="policy_template_window">
+    <property name="can-focus">False</property>
+    <child>
+      <object class="GtkFrame" id="policy_frame">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="label-xalign">0</property>
+        <property name="shadow-type">none</property>
+        <child>
+          <object class="GtkAlignment">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <property name="left-padding">12</property>
+            <child>
+              <object class="GtkBox" id="policy_vbox">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="orientation">vertical</property>
+                <property name="homogeneous">True</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="policy_label">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <property name="label">DYNAMICALLY GENERATED</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/contrib/checkmark.svgz b/contrib/checkmark.svgz
new file mode 100644
index 0000000..1b8910f
Binary files /dev/null and b/contrib/checkmark.svgz differ
diff --git a/src/anastasis/Makefile.am b/src/anastasis/Makefile.am
index ade98dc..fe908df 100644
--- a/src/anastasis/Makefile.am
+++ b/src/anastasis/Makefile.am
@@ -21,7 +21,6 @@ anastasis_gtk_SOURCES = \
   anastasis-gtk_handle-backup-button-clicked.c \
   anastasis-gtk_handle-challenge-code.c \
   anastasis-gtk_handle-challenge-iban.c \
-  anastasis-gtk_handle-challenge-row-activated.c \
   anastasis-gtk_handle-challenge-question.c \
   anastasis-gtk_handle-challenge-totp.c \
   anastasis-gtk_handle-clear-secret-clicked.c \
diff --git a/src/anastasis/anastasis-gtk_action.c 
b/src/anastasis/anastasis-gtk_action.c
index 07b387e..d742a25 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -2193,6 +2193,227 @@ long_action_cb (void *cls,
 }
 
 
+/**
+ * Callback invoked if the a "challenge"-button is clicked.
+ *
+ * @param object
+ * @param user_data points to the UUID of the challenge
+ */
+static void
+challenge_button_clicked_cb (GObject *object,
+                             gpointer user_data)
+{
+  const char *uuid = user_data;
+  json_t *args;
+
+  (void) object;
+  args = GNUNET_JSON_PACK (
+    GNUNET_JSON_pack_string ("uuid",
+                             uuid));
+  AG_freeze ();
+  AG_ra = ANASTASIS_redux_action (AG_redux_state,
+                                  "select_challenge",
+                                  args,
+                                  &AG_action_cb,
+                                  NULL);
+  json_decref (args);
+}
+
+
+/**
+ * Generate widget about a @a challenge and add it to the
+ * @a challenge_box.
+ *
+ * @param challenge_box box to expand
+ * @param rd our recovery document (to use)
+ * @param challenge the challenge to add
+ */
+static void
+add_challenge (GtkBox *challenge_box,
+               json_t *rd,
+               json_t *challenge)
+{
+  GtkBuilder *builder;
+  GtkWindow *window;
+  GtkWidget *hbox;
+  GtkLabel *label;
+  GtkButton *button;
+  const char *instructions;
+  const char *provider;
+  const char *type;
+  const char *uuid;
+  struct TALER_Amount cost;
+  bool async = false;
+  bool solved = false;
+  struct GNUNET_JSON_Specification spec[] = {
+    GNUNET_JSON_spec_string ("instructions",
+                             &instructions),
+    GNUNET_JSON_spec_string ("type",
+                             &type),
+    GNUNET_JSON_spec_string ("url",
+                             &provider),
+    GNUNET_JSON_spec_string ("uuid",
+                             &uuid),
+    GNUNET_JSON_spec_mark_optional (
+      GNUNET_JSON_spec_bool ("async",
+                             &async)),
+    GNUNET_JSON_spec_end ()
+  };
+
+  {
+    const json_t *ks;
+
+    ks = json_object_get (challenge,
+                          "key_share");
+    if ( (NULL != ks) &&
+         (! json_is_null (ks)) )
+      solved = true;
+  }
+  if (GNUNET_OK !=
+      GNUNET_JSON_parse (challenge,
+                         spec,
+                         NULL, NULL))
+  {
+    GNUNET_break (0);
+    return;
+  }
+  if (GNUNET_OK !=
+      lookup_recovery_cost (provider,
+                            type,
+                            &cost))
+  {
+    GNUNET_break (0);
+    return;
+  }
+
+  builder = GNUNET_GTK_get_new_builder (
+    "anastasis_gtk_challenge_template.glade",
+    NULL);
+  window = GTK_WINDOW (gtk_builder_get_object (builder,
+                                               "challenge_template_window"));
+  hbox = GTK_WIDGET (gtk_builder_get_object (builder,
+                                             "challenge_hbox"));
+  label = GTK_LABEL (gtk_builder_get_object (builder,
+                                             "challenge_label"));
+  button = GTK_BUTTON (gtk_builder_get_object (builder,
+                                               "solve_challenge_button"));
+  if (solved)
+  {
+    GtkImage *solved_img;
+
+    solved_img = GTK_IMAGE (gtk_builder_get_object (builder,
+                                                    "challenge_solved_image"));
+    gtk_widget_show (GTK_WIDGET (solved_img));
+    gtk_widget_hide (GTK_WIDGET (button));
+  }
+  else
+  {
+    g_signal_connect (button,
+                      "clicked",
+                      G_CALLBACK (challenge_button_clicked_cb),
+                      (void *) uuid);
+    gtk_widget_set_tooltip_text (GTK_WIDGET (button),
+                                 TALER_amount2s (&cost));
+  }
+  {
+    GtkImage *icon;
+    char *lab;
+
+    GNUNET_asprintf (&lab,
+                     "challenge_category_%s_image",
+                     type);
+    icon = GTK_IMAGE (gtk_builder_get_object (builder,
+                                              lab));
+    GNUNET_free (lab);
+    if (NULL != icon)
+      gtk_widget_show (GTK_WIDGET (icon));
+  }
+  gtk_label_set_text (label,
+                      instructions);
+  g_object_ref (hbox);
+  gtk_container_remove (GTK_CONTAINER (window),
+                        hbox);
+  g_object_unref (window);
+  g_object_unref (builder);
+  gtk_box_pack_end (challenge_box,
+                    hbox,
+                    false,
+                    false,
+                    15);
+}
+
+
+/**
+ * Generate widget about a @a policy and add it to the
+ * @a policy_box.
+ *
+ * @param policy_box box to expand
+ * @param rd our recovery document (to use)
+ * @param pindex policy index (for the label)
+ * @param policy policy to add
+ */
+static void
+add_policy (GtkBox *policy_box,
+            json_t *rd,
+            size_t pindex,
+            json_t *policy)
+{
+  GtkBuilder *builder;
+  GtkWindow *window;
+  GtkWidget *widget;
+  GtkLabel *label;
+  GtkBox *vbox;
+  char *txt;
+  json_t *challenges;
+
+  challenges = json_object_get (policy,
+                                "challenges");
+  if (NULL == challenges)
+  {
+    GNUNET_break_op (0);
+    AG_error ("Policy did not parse correctly");
+    return;
+  }
+  builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_policy_template.glade",
+                                        NULL);
+  window = GTK_WINDOW (gtk_builder_get_object (builder,
+                                               "policy_template_window"));
+  widget = GTK_WIDGET (gtk_builder_get_object (builder,
+                                               "policy_frame"));
+  label = GTK_LABEL (gtk_builder_get_object (builder,
+                                             "policy_label"));
+  vbox = GTK_BOX (gtk_builder_get_object (builder,
+                                          "policy_vbox"));
+  {
+    size_t index;
+    json_t *challenge;
+
+    json_array_foreach (challenges, index, challenge)
+    {
+      add_challenge (vbox,
+                     rd,
+                     challenge);
+    }
+  }
+  GNUNET_asprintf (&txt,
+                   _ ("Policy #%u"),
+                   (unsigned int) pindex);
+  gtk_label_set_text (label,
+                      txt);
+  GNUNET_free (txt);
+  g_object_ref (widget);
+  gtk_container_remove (GTK_CONTAINER (window),
+                        widget);
+  g_object_unref (window);
+  g_object_unref (builder);
+  gtk_box_pack_end (policy_box,
+                    widget,
+                    false,
+                    false,
+                    15);
+}
+
+
 /**
  * The user must select the next challenge to solve
  * during the recovery process.
@@ -2201,10 +2422,44 @@ static void
 action_challenge_selecting (void)
 {
   json_t *rd;
+  json_t *policies;
+  GtkBox *policy_box;
 
   AG_hide_all_frames ();
   rd = json_object_get (AG_redux_state,
                         "recovery_document");
+  policies = json_object_get (rd,
+                              "dps");
+  GNUNET_assert (NULL != policies);
+  policy_box = GTK_BOX (GCG_get_main_window_object (
+                          "anastasis_gtk_policy_vbox"));
+  /* remove all existing entries from the box */
+  {
+    GtkContainer *pb;
+    GList *children;
+
+    pb = GTK_CONTAINER (policy_box);
+    children = gtk_container_get_children (pb);
+    for (GList *iter = children; iter != NULL; iter = g_list_next (iter))
+      gtk_container_remove (pb,
+                            GTK_WIDGET (iter->data));
+    g_list_free (children);
+  }
+  {
+    size_t pindex;
+    json_t *policy;
+
+    json_array_foreach (policies, pindex, policy)
+    {
+      add_policy (policy_box,
+                  rd,
+                  pindex,
+                  policy);
+    }
+  }
+
+#if OLD
+
   {
     json_t *challenges;
     size_t index;
@@ -2431,6 +2686,8 @@ action_challenge_selecting (void)
                           "anastasis_gtk_choose_policy_treeview"));
     gtk_tree_view_expand_all (tv);
   }
+#endif
+
   AG_sensitive ("anastasis_gtk_review_policy_treeview");
   AG_show ("anastasis_gtk_progress_vbox");
   AG_progress_update ();
diff --git a/src/anastasis/anastasis-gtk_handle-challenge-row-activated.c 
b/src/anastasis/anastasis-gtk_handle-challenge-row-activated.c
deleted file mode 100644
index 4f2c9cb..0000000
--- a/src/anastasis/anastasis-gtk_handle-challenge-row-activated.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
-     This file is part of anastasis-gtk.
-     Copyright (C) 2021 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-challenge-row-activated.c
- * @brief
- * @author Christian Grothoff
- */
-#include <gnunet/platform.h>
-#include <gnunet/gnunet_util_lib.h>
-#include "anastasis-gtk_helper.h"
-#include "anastasis-gtk_action.h"
-#include "anastasis-gtk_handle-identity-changed.h"
-#include <jansson.h>
-
-
-static void
-start_solve (GtkTreeModel *model,
-             GtkTreeIter *iter)
-{
-  char *uuid;
-  gboolean solved;
-  json_t *args;
-
-  gtk_tree_model_get (model,
-                      iter,
-                      AG_CSM_CHALLENGE_UUID, &uuid,
-                      AG_CSM_SOLVED, &solved,
-                      -1);
-  if (solved)
-  {
-    g_free (uuid);
-    return;
-  }
-  args = GNUNET_JSON_PACK (
-    GNUNET_JSON_pack_string ("uuid",
-                             uuid));
-  g_free (uuid);
-  AG_freeze ();
-  AG_ra = ANASTASIS_redux_action (AG_redux_state,
-                                  "select_challenge",
-                                  args,
-                                  &AG_action_cb,
-                                  NULL);
-  json_decref (args);
-}
-
-
-/**
- * The user activated a row in the challenge list.
- * If the row contains an unsolved challenge, start
- * the process to solve the challenge.
- *
- * @param selection the selected data
- * @param user_data unused
- */
-void
-anastasis_gtk_challenge_status_treeview_row_activated_cb (
-  GtkTreeView       *tree_view,
-  GtkTreePath       *path,
-  GtkTreeViewColumn *column,
-  gpointer user_data)
-{
-  GtkTreeModel *model;
-  GtkTreeIter iter;
-  GtkTreeSelection *selection;
-
-  (void) path;
-  (void) column;
-  (void) user_data;
-  selection = gtk_tree_view_get_selection (tree_view);
-  if (gtk_tree_selection_get_selected (selection,
-                                       &model,
-                                       &iter))
-  {
-    start_solve (model,
-                 &iter);
-  }
-  else
-  {
-    /* How can this be? */
-    GNUNET_break (0);
-  }
-}
-
-
-/**
- * The user clicked one of the challenge buttons, select the
- * challenge.
- *
- * @param button the button that was clicked
- * @param user_data a `json *` with the challenge
- */
-void
-anastasis_gtk_challenge_status_solved_toggled_cb (
-  GtkCellRendererToggle *cell_renderer,
-  gchar                 *path,
-  gpointer user_data)
-{
-  GtkTreePath *p;
-  GtkTreeIter iter;
-  GtkTreeModel *model;
-
-  model = GTK_TREE_MODEL (GCG_get_main_window_object (
-                            "challenge_status_liststore"));
-  p = gtk_tree_path_new_from_string (path);
-  gtk_tree_model_get_iter (model,
-                           &iter,
-                           p);
-  gtk_tree_path_free (p);
-  start_solve (model,
-               &iter);
-}
-
-
-/**
- * The user selected another row in the challenge list.
- * If the row has data that might be interesting for the
- * clipboard, copy it there.
- *
- * @param selection the selected data
- * @param user_data unused
- */
-void
-anastasis_gtk_challenge_status_treeselection_changed_cb (
-  GtkTreeSelection *selection,
-  gpointer user_data)
-{
-  GtkTreeModel *model;
-  GtkTreeIter iter;
-  GtkClipboard *cb;
-
-  (void) user_data;
-  cb = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
-  GNUNET_assert (NULL != cb);
-  if (gtk_tree_selection_get_selected (selection,
-                                       &model,
-                                       &iter))
-  {
-    char *uri;
-    char *url;
-    gboolean paying;
-    gboolean have_redir;
-
-    gtk_tree_model_get (model,
-                        &iter,
-                        AG_CSM_PAYTO_URI, &uri,
-                        AG_CSM_PAYING, &paying,
-                        AG_CSM_REDIRECT_URL, &url,
-                        AG_CSM_HAVE_REDIRECT, &have_redir,
-                        -1);
-    if (paying && (NULL != uri))
-      gtk_clipboard_set_text (cb,
-                              uri,
-                              strlen (uri));
-    else if (have_redir && (NULL != url))
-      gtk_clipboard_set_text (cb,
-                              url,
-                              strlen (url));
-    else
-      gtk_clipboard_set_text (cb,
-                              "",
-                              0);
-    g_free (url);
-  }
-  else
-  {
-    gtk_clipboard_set_text (cb,
-                            "",
-                            0);
-  }
-}

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