summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-30 18:31:08 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-30 18:31:08 +0100
commitfc680042afc66dba5b1334f2bdb00ac33630c082 (patch)
tree40ef4a759401ae0d1659deef5006896957310b90
parentd6cbc5f0ef9c455b7cea24e1765a3a696ef82468 (diff)
downloadanastasis-gtk-fc680042afc66dba5b1334f2bdb00ac33630c082.tar.gz
anastasis-gtk-fc680042afc66dba5b1334f2bdb00ac33630c082.tar.bz2
anastasis-gtk-fc680042afc66dba5b1334f2bdb00ac33630c082.zip
preparatory changes for #7090 with printing
-rw-r--r--README5
-rw-r--r--configure.ac35
-rw-r--r--contrib/Makefile.am1
-rw-r--r--po/POTFILES.in8
-rw-r--r--src/anastasis/Makefile.am19
-rw-r--r--src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c107
-rw-r--r--src/anastasis/anastasis-gtk_handle-noprint.c47
-rw-r--r--src/anastasis/anastasis-gtk_handle-print.c47
8 files changed, 261 insertions, 8 deletions
diff --git a/README b/README
index ba33176..116af05 100644
--- a/README
+++ b/README
@@ -16,12 +16,13 @@ libjansson : MIT License
libgcrypt : LGPL
postgresql : PostgreSQL License
libmicrohttpd: LGPLv3+
-libgnunet* : GPLv3+,
-libgnunetgtk : GPLv3+,
+libgnunet* : GPLv3+
+libgnunetgtk : GPLv3+
libtaler* : GPLv3+
libanastasis*: GPLv3+
libgtk3 : LGPLv2+
libgladeui : GPLv2+
+libhpdf : ZLIB/LIBPNG license (optional)
Installation
diff --git a/configure.ac b/configure.ac
index faa8f4c..dc37019 100644
--- a/configure.ac
+++ b/configure.ac
@@ -255,6 +255,41 @@ AC_SUBST(QR_CFLAGS)
AC_SUBST(QR_LIBS)
+
+
+# test for libhpdf / libharu
+haru=0
+HPDF_LIBS="-lhpdf"
+AC_MSG_CHECKING(for libharu)
+AC_ARG_WITH(haru,
+ [ --with-haru=PFX Base of libhpdf installation],
+ [AC_MSG_RESULT([$with_haru])
+ AS_CASE([$with_haru],
+ [no],[],
+ [yes],[
+ AC_CHECK_HEADERS(hpdf.h,[haru=1])
+ ],
+ [
+ CPPFLAGS="-I$with_haru/include $CPPFLAGS"
+ HPDF_CFLAGS="-I$with_haru/include"
+ HPDF_LIBS="-L$with_haru/lib -lhpdf"
+ AC_CHECK_HEADERS(hpdf.h,[haru=1])
+ ])
+ ],
+ [AC_MSG_RESULT([--with-haru not specified])
+ AC_CHECK_HEADERS(hpdf.h,[haru=1])])
+
+AS_IF([test "$haru" != 1],
+ [AC_MSG_RESULT([libharu not found, PDF support disabled])])
+
+AC_DEFINE_UNQUOTED([HAVE_LIBHPDF],[$haru],[1 if libhpdf is enabled, 0 otherwise])
+AM_CONDITIONAL([HPDF_ENABLED], [test "$haru" = "1"])
+
+AC_SUBST(HPDF_CFLAGS)
+AC_SUBST(HPDF_LIBS)
+
+
+
# test for libanastasis
anastasis=0
AC_MSG_CHECKING(for libanastasis)
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 461472d..a676b77 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -50,4 +50,5 @@ pkgdata_DATA = \
anastasis_gtk_policy_template.glade \
anastasis_gtk_save_file_dialog.glade \
anastasis_gtk_save_secret_dialog.glade \
+ anastasis_gtk_user_sure.glade \
anastasis_gtk_warn_multifactor.glade
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 15bc9b4..6dc3f25 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,5 +1,6 @@
src/anastasis/anastasis-gtk_action.c
src/anastasis/anastasis-gtk_attributes.c
+src/anastasis/anastasis-gtk_autocomplete.c
src/anastasis/anastasis-gtk_backup.c
src/anastasis/anastasis-gtk.c
src/anastasis/anastasis-gtk_dispatch.c
@@ -9,7 +10,6 @@ src/anastasis/anastasis-gtk_handle-backup-button-clicked.c
src/anastasis/anastasis-gtk_handle-challenge-code.c
src/anastasis/anastasis-gtk_handle-challenge-iban.c
src/anastasis/anastasis-gtk_handle-challenge-question.c
-src/anastasis/anastasis-gtk_handle-challenge-row-activated.c
src/anastasis/anastasis-gtk_handle-challenge-totp.c
src/anastasis/anastasis-gtk_handle-clear-secret-clicked.c
src/anastasis/anastasis-gtk_handle-continent-selected.c
@@ -29,11 +29,13 @@ src/anastasis/anastasis-gtk_handle-method-question.c
src/anastasis/anastasis-gtk_handle-method-sms.c
src/anastasis/anastasis-gtk_handle-method-totp.c
src/anastasis/anastasis-gtk_handle-method-video.c
+src/anastasis/anastasis-gtk_handle-noprint.c
src/anastasis/anastasis-gtk_handle-payqr-selection-changed.c
src/anastasis/anastasis-gtk_handle-policy-activate.c
src/anastasis/anastasis-gtk_handle-policy-button.c
src/anastasis/anastasis-gtk_handle-policy-meta.c
src/anastasis/anastasis-gtk_handle-policy-version-changed.c
+src/anastasis/anastasis-gtk_handle-print.c
src/anastasis/anastasis-gtk_handle-recovery-button-clicked.c
src/anastasis/anastasis-gtk_handle-secret-buttons.c
src/anastasis/anastasis-gtk_helper.c
@@ -55,13 +57,17 @@ contrib/anastasis_gtk_auth_add_video.glade
contrib/anastasis_gtk_challenge_code.glade
contrib/anastasis_gtk_challenge_iban.glade
contrib/anastasis_gtk_challenge_question.glade
+contrib/anastasis_gtk_challenge_template.glade
contrib/anastasis_gtk_challenge_totp.glade
+contrib/anastasis_gtk_deny_singlefactor.glade
contrib/anastasis_gtk_edit_policy.glade
contrib/anastasis_gtk_edit_providers.glade
contrib/anastasis_gtk_main_window.glade
contrib/anastasis_gtk_open_file_dialog.glade
contrib/anastasis_gtk_open_secret_dialog.glade
+contrib/anastasis_gtk_policy_template.glade
contrib/anastasis_gtk_save_file_dialog.glade
contrib/anastasis_gtk_save_secret_dialog.glade
+contrib/anastasis_gtk_user_sure.glade
contrib/anastasis_gtk_warn_multifactor.glade
contrib/this_stays_private.glade
diff --git a/src/anastasis/Makefile.am b/src/anastasis/Makefile.am
index 1e80236..110682c 100644
--- a/src/anastasis/Makefile.am
+++ b/src/anastasis/Makefile.am
@@ -35,8 +35,6 @@ anastasis_gtk_SOURCES = \
anastasis-gtk_handle-expiration-change.h \
anastasis-gtk_handle-identity-changed.c \
anastasis-gtk_handle-identity-changed.h \
- anastasis-gtk_handle-recovery-button-clicked.c \
- anastasis-gtk_handle-secret-buttons.c \
anastasis-gtk_handle-main-window-forward-clicked.c \
anastasis-gtk_handle-main-window-forward-clicked.h \
anastasis-gtk_handle-main-window-back-clicked.c \
@@ -51,6 +49,8 @@ anastasis_gtk_SOURCES = \
anastasis-gtk_handle-policy-button.c \
anastasis-gtk_handle-policy-meta.c \
anastasis-gtk_handle-policy-version-changed.c \
+ anastasis-gtk_handle-recovery-button-clicked.c \
+ anastasis-gtk_handle-secret-buttons.c \
anastasis-gtk_helper.c anastasis-gtk_helper.h \
anastasis-gtk_pe.h \
anastasis-gtk_pe-add-policy.c \
@@ -60,6 +60,14 @@ anastasis_gtk_SOURCES = \
anastasis-gtk_progress.c anastasis-gtk_progress.h \
os_installation.c
+if HPDF_ENABLED
+anastasis_gtk_SOURCES += \
+ anastasis-gtk_handle-print.c
+else
+anastasis_gtk_SOURCES += \
+ anastasis-gtk_handle-noprint.c
+endif
+
anastasis_gtk_LDADD = \
@GTK_LIBS@ \
@GLADE_LIBS@ @GNUNET_LIBS@ \
@@ -82,3 +90,10 @@ anastasis_gtk_CFLAGS = \
@QR_CFLAGS@
anastasis_gtk_LDFLAGS = \
-export-dynamic
+
+if HPDF_ENABLED
+anastasis_gtk_LDADD += \
+ $(HPDF_LIBS)
+anastasis_gtk_CFLAGS += \
+ $(HPDF_CFLAGS)
+endif
diff --git a/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c b/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c
index ee1be10..0e3c238 100644
--- a/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c
+++ b/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c
@@ -120,12 +120,16 @@ forward_country_selecting (void)
}
-void
-AG_forward_user_attributes_collecting (void)
+/**
+ * The user has entered their personal attributes and
+ * confirmed they are correct. Move to the next state.
+ * Note that #AG_freeze() was already called.
+ */
+static void
+confirm_attributes (void)
{
json_t *args;
- AG_freeze ();
args = AG_collect_attributes (false);
GNUNET_assert (NULL != args);
AG_ra = ANASTASIS_redux_action (AG_redux_state,
@@ -138,6 +142,103 @@ AG_forward_user_attributes_collecting (void)
/**
+ * Function called with the result of asking the user
+ * if they are sure about the personal details they
+ * entered.
+ *
+ * @param the dialog
+ * @param response_id must be GTK_RESPONSE_OK to proceed
+ * @param user_data the builder
+ */
+void
+anastasis_gtk_user_sure_dialog_response_cb (
+ GtkDialog *dialog,
+ gint response_id,
+ gpointer user_data)
+{
+ GtkBuilder *builder = user_data;
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ g_object_unref (G_OBJECT (builder));
+ if (GTK_RESPONSE_OK != response_id)
+ {
+ AG_thaw ();
+ return;
+ }
+ confirm_attributes ();
+}
+
+
+/**
+ * Launch dialog to question certainty of user providing
+ * personal details during backup.
+ */
+static void
+question_certainty (void)
+{
+ GtkBuilder *builder;
+ GtkDialog *ad;
+
+ builder = GNUNET_GTK_get_new_builder (
+ "anastasis_gtk_user_sure.glade",
+ NULL);
+ if (NULL == builder)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ ad = GTK_DIALOG (gtk_builder_get_object (builder,
+ "anastasis_gtk_user_sure_dialog"));
+ if (NULL == ad)
+ {
+ GNUNET_break (0);
+ g_object_unref (G_OBJECT (builder));
+ return;
+ }
+ /* show dialog */
+ {
+ GtkWidget *toplevel;
+ GtkWidget *widget;
+
+#if ! HPDF_ENABLED
+ gtk_widget_hide (
+ GTK_WIDGET (
+ gtk_builder_get_object (
+ builder,
+ "anastasis_gtk_print_details_button")));
+#endif
+ widget = GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_auth_button_grid"));
+ toplevel = gtk_widget_get_toplevel (widget);
+ gtk_window_set_transient_for (GTK_WINDOW (ad),
+ GTK_WINDOW (toplevel));
+ gtk_window_present (GTK_WINDOW (ad));
+ }
+}
+
+
+/**
+ * The user clicked the 'next' button in the dialog where they enter
+ * their personal attributes. If we are in the backup process, make
+ * them first confirm that the attributes are correct and well-known
+ * to them. Otherwise, simply directly proceed.
+ */
+void
+AG_forward_user_attributes_collecting (void)
+{
+ bool in_backup;
+
+ AG_freeze ();
+ in_backup = (NULL != json_object_get (AG_redux_state,
+ "backup_state"));
+ if (in_backup)
+ question_certainty ();
+ else
+ confirm_attributes ();
+}
+
+
+/**
* Function called with the result of questioning the user
* if they really want to proceed with less than three
* authentication factors.
diff --git a/src/anastasis/anastasis-gtk_handle-noprint.c b/src/anastasis/anastasis-gtk_handle-noprint.c
new file mode 100644
index 0000000..ef9e081
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_handle-noprint.c
@@ -0,0 +1,47 @@
+/*
+ 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_noprint.c
+ * @brief Implementation of the "print" button, if we cannot use it
+ * @author Christian Grothoff
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_helper.h"
+#include <jansson.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+
+/**
+ * The user clicked the 'print' button to print their personal
+ * details. Try to print them.
+ *
+ * @param button the print button
+ * @param user_data the builder for the dialog
+ */
+void
+anastasis_gtk_print_details_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ (void) button;
+ (void) user_data;
+ GNUNET_break (0); /* button should have been disabled */
+}
diff --git a/src/anastasis/anastasis-gtk_handle-print.c b/src/anastasis/anastasis-gtk_handle-print.c
new file mode 100644
index 0000000..5b72c39
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_handle-print.c
@@ -0,0 +1,47 @@
+/*
+ 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_print.c
+ * @brief Implementation of the "print" button
+ * @author Christian Grothoff
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_helper.h"
+#include <jansson.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+
+/**
+ * The user clicked the 'print' button to print their personal
+ * details. Try to print them.
+ *
+ * @param button the print button
+ * @param user_data the builder for the dialog
+ */
+void
+anastasis_gtk_print_details_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ (void) button;
+ (void) user_data;
+ GNUNET_break (0);
+}