gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] branch master updated: show IBAN dialog


From: gnunet
Subject: [taler-anastasis-gtk] branch master updated: show IBAN dialog
Date: Thu, 26 Aug 2021 17:00:59 +0200

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 25e3c3d  show IBAN dialog
25e3c3d is described below

commit 25e3c3d4cbca8ecaf1625b1add41d6b030e1091a
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Aug 26 17:00:57 2021 +0200

    show IBAN dialog
---
 contrib/anastasis_gtk_challenge_iban.glade | 40 ++++++-------
 src/anastasis/anastasis-gtk_action.c       | 96 ++++++++++++++++++++----------
 2 files changed, 85 insertions(+), 51 deletions(-)

diff --git a/contrib/anastasis_gtk_challenge_iban.glade 
b/contrib/anastasis_gtk_challenge_iban.glade
index 8eaea25..b666146 100644
--- a/contrib/anastasis_gtk_challenge_iban.glade
+++ b/contrib/anastasis_gtk_challenge_iban.glade
@@ -28,10 +28,10 @@ Author: Christian Grothoff
   <!-- interface-description key backup and recovery -->
   <!-- interface-copyright 2019-2021 Anastasis SARL -->
   <!-- interface-authors Christian Grothoff -->
-  <object class="GtkDialog" id="anastasis_gtk_c_question_dialog">
+  <object class="GtkDialog" id="anastasis_gtk_c_iban_dialog">
     <property name="can-focus">False</property>
     <property name="type-hint">dialog</property>
-    <signal name="response" 
handler="anastasis_gtk_c_question_dialog_response_cb" swapped="no"/>
+    <signal name="response" handler="anastasis_gtk_c_iban_dialog_response_cb" 
swapped="no"/>
     <child internal-child="vbox">
       <object class="GtkBox">
         <property name="can-focus">False</property>
@@ -42,10 +42,10 @@ Author: Christian Grothoff
             <property name="can-focus">False</property>
             <property name="layout-style">end</property>
             <child>
-              <object class="GtkButton" 
id="anastasis_gtk_c_question_dialog_btn_close">
+              <object class="GtkButton" 
id="anastasis_gtk_c_iban_dialog_btn_close">
                 <property name="label">gtk-close</property>
                 <property name="visible">True</property>
-                <property name="sensitive">False</property>
+                <property name="sensitive">True</property>
                 <property name="can-focus">False</property>
                 <property name="can-default">True</property>
                 <property name="has-default">True</property>
@@ -71,7 +71,7 @@ Author: Christian Grothoff
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="anastasis_gtk_c_question_error_label">
+          <object class="GtkLabel" id="anastasis_gtk_c_iban_error_label">
             <property name="can-focus">False</property>
             <property name="label">ERROR MESSAGE (SET DYNAMICALLY BY 
PROGRAM)</property>
             <attributes>
@@ -123,6 +123,7 @@ to pay the Anastasis provider for its service.</property>
             </child>
             <child>
               <object class="GtkBox">
+                <property name="visible">True</property>
                 <property name="can-focus">False</property>
                 <property name="orientation">vertical</property>
                 <child>
@@ -132,7 +133,7 @@ to pay the Anastasis provider for its service.</property>
                     <property name="halign">start</property>
                     <property name="margin-start">30</property>
                     <property name="margin-end">30</property>
-                    <property name="label">SET DYNAMICALLY BY PROGRAM (NOT 
IMPLEMENTED)</property>
+                    <property name="label">SET DYNAMICALLY BY 
PROGRAM</property>
                     <attributes>
                       <attribute name="style" value="italic"/>
                       <attribute name="weight" value="bold"/>
@@ -169,17 +170,6 @@ to pay the Anastasis provider for its service.</property>
                 <property name="position">2</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkSeparator">
-                <property name="visible">True</property>
-                <property name="can-focus">False</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
             <child>
               <object class="GtkBox">
                 <property name="visible">True</property>
@@ -231,6 +221,17 @@ to pay the Anastasis provider for its service.</property>
                 <property name="position">3</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkSeparator">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkBox">
                 <property name="visible">True</property>
@@ -413,9 +414,6 @@ open the resulting file later to continue.</property>
         </child>
       </object>
     </child>
-    <action-widgets>
-      <action-widget 
response="-7">anastasis_gtk_c_question_dialog_btn_close</action-widget>
-    </action-widgets>
     <child type="titlebar">
       <object class="GtkLabel">
         <property name="visible">True</property>
@@ -424,7 +422,7 @@ open the resulting file later to continue.</property>
       </object>
     </child>
     <action-widgets>
-      <action-widget 
response="-7">anastasis_gtk_c_question_dialog_btn_close</action-widget>
+      <action-widget 
response="-7">anastasis_gtk_c_iban_dialog_btn_close</action-widget>
     </action-widgets>
   </object>
 </interface>
diff --git a/src/anastasis/anastasis-gtk_action.c 
b/src/anastasis/anastasis-gtk_action.c
index 82c00bb..6d2bdb9 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -1840,6 +1840,8 @@ translate_state (const char *state)
       .out = _ ("wait, tries exceeded") },
     { .in = "authentication-timeout",
       .out = _ ("awaiting completion of authentication process") },
+    { .in = "external-instructions",
+      .out = _ ("challenge-specific action required") },
     { .in = NULL,
       .out = NULL }
   };
@@ -2748,6 +2750,7 @@ diag_question (const json_t *details)
 
     uuid_str = json_string_value (json_object_get (details,
                                                    "uuid"));
+    /* Why do we do this? */
     render_feedback (builder,
                      "anastasis_gtk_c_question_error_label",
                      uuid_str);
@@ -2766,6 +2769,27 @@ static GtkDialog *
 diag_code (const json_t *details)
 {
   GtkBuilder *builder;
+  const char *instructions;
+  const char *uuid_str;
+  struct GNUNET_JSON_Specification spec[] = {
+    GNUNET_JSON_spec_string ("instructions",
+                             &instructions),
+    GNUNET_JSON_spec_string ("uuid",
+                             &uuid_str),
+    GNUNET_JSON_spec_end ()
+  };
+
+  if (GNUNET_OK !=
+      GNUNET_JSON_parse (details,
+                         spec,
+                         NULL, NULL))
+  {
+    GNUNET_break (0);
+    json_dumpf (details,
+                stderr,
+                JSON_INDENT (2));
+    return NULL;
+  }
 
   builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_challenge_code.glade",
                                         NULL);
@@ -2776,25 +2800,16 @@ diag_code (const json_t *details)
   }
   {
     GtkLabel *label;
-    const char *instructions;
 
     label = GTK_LABEL (gtk_builder_get_object (builder,
                                                
"challenge_instructions_label"));
-    instructions = json_string_value (json_object_get (details,
-                                                       "instructions"));
     gtk_label_set_text (label,
                         instructions);
-  }
-  {
-    GtkLabel *clabel;
-    const char *uuid_str;
-
-    clabel = GTK_LABEL (gtk_builder_get_object (builder,
-                                                
"anastasis_gtk_c_challenge_label"));
-    uuid_str = json_string_value (json_object_get (details,
-                                                   "uuid"));
-    gtk_label_set_text (clabel,
+    label = GTK_LABEL (gtk_builder_get_object (builder,
+                                               
"anastasis_gtk_c_challenge_label"));
+    gtk_label_set_text (label,
                         uuid_str);
+    /* Why do we do this? */
     render_feedback (builder,
                      "anastasis_gtk_c_code_error_label",
                      uuid_str);
@@ -2823,15 +2838,13 @@ diag_iban (const json_t *details)
   const char *credit_iban;
   const char *business;
   const char *subject;
+  const char *uuid_str;
+  const char *debit_iban_hint;
   struct GNUNET_JSON_Specification spec[] = {
-    TALER_JSON_spec_amount_any ("challenge_amount",
-                                &amount),
-    GNUNET_JSON_spec_string ("credit_iban",
-                             &credit_iban),
-    GNUNET_JSON_spec_string ("business_name",
-                             &business),
-    GNUNET_JSON_spec_string ("wire_transfer_subject",
-                             &subject),
+    GNUNET_JSON_spec_string ("uuid",
+                             &uuid_str),
+    GNUNET_JSON_spec_string ("instructions",
+                             &debit_iban_hint),
     GNUNET_JSON_spec_end ()
   };
 
@@ -2846,6 +2859,38 @@ diag_iban (const json_t *details)
                 JSON_INDENT (2));
     return NULL;
   }
+  {
+    json_t *cf = json_object_get (AG_redux_state,
+                                  "challenge_feedback");
+    json_t *ci = json_object_get (cf,
+                                  uuid_str);
+    json_t *cd = json_object_get (ci,
+                                  "details");
+    struct GNUNET_JSON_Specification ispec[] = {
+      TALER_JSON_spec_amount_any ("challenge_amount",
+                                  &amount),
+      GNUNET_JSON_spec_string ("credit_iban",
+                               &credit_iban),
+      GNUNET_JSON_spec_string ("business_name",
+                               &business),
+      GNUNET_JSON_spec_string ("wire_transfer_subject",
+                               &subject),
+      GNUNET_JSON_spec_end ()
+    };
+
+    if ( (NULL == cd) ||
+         (GNUNET_OK !=
+          GNUNET_JSON_parse (cd,
+                             ispec,
+                             NULL, NULL)) )
+    {
+      GNUNET_break (0);
+      json_dumpf (AG_redux_state,
+                  stderr,
+                  JSON_INDENT (2));
+      return NULL;
+    }
+  }
 
   builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_challenge_iban.glade",
                                         NULL);
@@ -2857,19 +2902,10 @@ diag_iban (const json_t *details)
   {
     GtkLabel *label;
 
-#if 0
-    /* Note: need to extract the hint from the global
-       state, but not sure if the JSON argument gives
-       us the required data... */
     label = GTK_LABEL (gtk_builder_get_object (builder,
                                                "debit_account_label"));
     gtk_label_set_text (label,
                         debit_iban_hint);
-#else
-    json_dumpf (details,
-                stderr,
-                JSON_INDENT (2));
-#endif
     label = GTK_LABEL (gtk_builder_get_object (builder,
                                                "credit_account_label"));
     gtk_label_set_text (label,

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