aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-26 16:26:42 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-26 16:26:42 +0200
commitf353d4d342ed59cad58a6f0d5656c97e4f35f80b (patch)
tree85a5a17b3e0dd19e58c6e289e44c687342ee678b
parent5ff0e793e17d5ca6008f710624a1755227533d77 (diff)
downloadanastasis-gtk-f353d4d342ed59cad58a6f0d5656c97e4f35f80b.tar.gz
anastasis-gtk-f353d4d342ed59cad58a6f0d5656c97e4f35f80b.tar.bz2
anastasis-gtk-f353d4d342ed59cad58a6f0d5656c97e4f35f80b.zip
-work on IBAN dialog
-rw-r--r--configure.ac2
-rw-r--r--contrib/anastasis_gtk_challenge_iban.glade56
-rw-r--r--src/anastasis/Makefile.am1
-rw-r--r--src/anastasis/anastasis-gtk_action.c91
-rw-r--r--src/anastasis/anastasis-gtk_handle-challenge-iban.c53
5 files changed, 167 insertions, 36 deletions
diff --git a/configure.ac b/configure.ac
index 24682ec..c721c5e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -122,7 +122,7 @@ AC_CHECK_LIB(magic, magic_open,
AC_SUBST(ENABLE_ON_UNIX)
-AC_SUBST(ENABLE_ON_W32)libtool
+AC_SUBST(ENABLE_ON_W32)
GN_LIB_LDFLAGS="-export-dynamic -no-undefined"
AC_SUBST(GN_LIB_LDFLAGS)
diff --git a/contrib/anastasis_gtk_challenge_iban.glade b/contrib/anastasis_gtk_challenge_iban.glade
index c853f94..8eaea25 100644
--- a/contrib/anastasis_gtk_challenge_iban.glade
+++ b/contrib/anastasis_gtk_challenge_iban.glade
@@ -42,29 +42,18 @@ Author: Christian Grothoff
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
- <object class="GtkButton" id="anastasis_gtk_b_question_dialog_btn_cancel">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">False</property>
- <property name="use-stock">True</property>
- <property name="always-show-image">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="anastasis_gtk_c_question_dialog_btn_ok">
- <property name="label">gtk-ok</property>
+ <object class="GtkButton" id="anastasis_gtk_c_question_dialog_btn_close">
+ <property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">False</property>
<property name="can-default">True</property>
<property name="has-default">True</property>
<property name="receives-default">False</property>
+ <property name="margin-start">20</property>
+ <property name="margin-end">20</property>
+ <property name="margin-top">20</property>
+ <property name="margin-bottom">20</property>
<property name="use-stock">True</property>
<property name="always-show-image">True</property>
</object>
@@ -134,7 +123,6 @@ 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>
@@ -144,7 +132,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</property>
+ <property name="label">SET DYNAMICALLY BY PROGRAM (NOT IMPLEMENTED)</property>
<attributes>
<attribute name="style" value="italic"/>
<attribute name="weight" value="bold"/>
@@ -182,12 +170,23 @@ to pay the Anastasis provider for its service.</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>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkLabel" id="crebit_account_label">
+ <object class="GtkLabel" id="credit_account_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
@@ -233,17 +232,6 @@ to pay the Anastasis provider for its service.</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>
<property name="can-focus">False</property>
@@ -426,8 +414,7 @@ open the resulting file later to continue.</property>
</object>
</child>
<action-widgets>
- <action-widget response="-6">anastasis_gtk_b_question_dialog_btn_cancel</action-widget>
- <action-widget response="-5">anastasis_gtk_c_question_dialog_btn_ok</action-widget>
+ <action-widget response="-7">anastasis_gtk_c_question_dialog_btn_close</action-widget>
</action-widgets>
<child type="titlebar">
<object class="GtkLabel">
@@ -437,8 +424,7 @@ open the resulting file later to continue.</property>
</object>
</child>
<action-widgets>
- <action-widget response="-6">anastasis_gtk_b_question_dialog_btn_cancel</action-widget>
- <action-widget response="-5">anastasis_gtk_c_question_dialog_btn_ok</action-widget>
+ <action-widget response="-7">anastasis_gtk_c_question_dialog_btn_close</action-widget>
</action-widgets>
</object>
</interface>
diff --git a/src/anastasis/Makefile.am b/src/anastasis/Makefile.am
index 9ca420d..8efa113 100644
--- a/src/anastasis/Makefile.am
+++ b/src/anastasis/Makefile.am
@@ -21,6 +21,7 @@ anastasis_gtk_SOURCES = \
anastasis-gtk_handle-auth-edit-provider-clicked.c \
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-clear-secret-clicked.c \
diff --git a/src/anastasis/anastasis-gtk_action.c b/src/anastasis/anastasis-gtk_action.c
index 786df84..82c00bb 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -2810,6 +2810,95 @@ diag_code (const json_t *details)
/**
+ * Create a dialog for the user to make an IBAN transfer.
+ *
+ * @param details details about the dialog to render
+ * @return dialog object
+ */
+static GtkDialog *
+diag_iban (const json_t *details)
+{
+ GtkBuilder *builder;
+ struct TALER_Amount amount;
+ const char *credit_iban;
+ const char *business;
+ const char *subject;
+ 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_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_iban.glade",
+ NULL);
+ if (NULL == builder)
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+ {
+ 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,
+ credit_iban);
+ label = GTK_LABEL (gtk_builder_get_object (builder,
+ "provider_name_label"));
+ gtk_label_set_text (label,
+ business);
+ label = GTK_LABEL (gtk_builder_get_object (builder,
+ "wire_transfer_subject_label"));
+ gtk_label_set_text (label,
+ subject);
+ label = GTK_LABEL (gtk_builder_get_object (builder,
+ "amount_label"));
+ gtk_label_set_text (label,
+ TALER_amount2s (&amount));
+ }
+
+ {
+ GtkDialog *ad;
+
+ ad = GTK_DIALOG (gtk_builder_get_object (builder,
+ "anastasis_gtk_c_iban_dialog"));
+ return ad;
+ }
+}
+
+
+/**
* The user wants to solve the selected challenge. Launch the
* dialog to allow the user to enter the solution.
*/
@@ -2829,6 +2918,8 @@ action_challenge_solving (void)
.ctor = &diag_code },
{ .type = gettext_noop ("email"),
.ctor = &diag_code },
+ { .type = gettext_noop ("iban"),
+ .ctor = &diag_iban },
{ .type = NULL,
.ctor = NULL }
};
diff --git a/src/anastasis/anastasis-gtk_handle-challenge-iban.c b/src/anastasis/anastasis-gtk_handle-challenge-iban.c
new file mode 100644
index 0000000..64e6d46
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_handle-challenge-iban.c
@@ -0,0 +1,53 @@
+/*
+ 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-iban.c
+ * @brief Handle dialog for IBAN challenge
+ * @author Christian Grothoff
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk.h"
+#include "anastasis-gtk_action.h"
+
+
+/**
+ * Function called from the IBAN 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_c_iban_dialog_response_cb (GtkDialog *dialog,
+ gint response_id,
+ gpointer user_data)
+{
+ GtkBuilder *builder = GTK_BUILDER (user_data);
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ g_object_unref (G_OBJECT (builder));
+ GNUNET_assert (NULL == AG_ra);
+ AG_ra = ANASTASIS_redux_action (AG_redux_state,
+ "back",
+ NULL,
+ &AG_action_cb,
+ NULL);
+}