anastasis-gtk

Demonstrator GUI for Anastasis
Log | Files | Refs | README | LICENSE

commit 8604c1924043d31d34ff6445e8cd318e723f1632
parent eb20d9677148594c6e6f94525a15a455bc15482d
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 30 Jul 2026 10:03:11 +0200

fix progress update and PDF export

Diffstat:
Mcontrib/anastasis_gtk_main_window.ui | 2++
Mmeson.build | 10++++++++++
Msrc/anastasis/anastasis-gtk_action.c | 3+++
Msrc/anastasis/anastasis-gtk_handle-print.c | 5++++-
Msrc/anastasis/anastasis-gtk_progress.c | 23+++++++++--------------
Msrc/anastasis/meson.build | 4++--
6 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/contrib/anastasis_gtk_main_window.ui b/contrib/anastasis_gtk_main_window.ui @@ -215,6 +215,7 @@ Author: Christian Grothoff, Dennis Neufeld--> <property name="child"> <object class="GtkColumnView" id="anastasis_gtk_backup_progress_treeview"> <property name="model">anastasis_gtk_backup_progress_tree_selection</property> + <property name="can-focus">0</property> <child> <object class="GtkColumnViewColumn" id="anastasis_gtk_backup_progress_description_column"> <property name="expand">1</property> @@ -251,6 +252,7 @@ Author: Christian Grothoff, Dennis Neufeld--> <property name="child"> <object class="GtkColumnView" id="anastasis_gtk_recovery_progress_treeview"> <property name="model">anastasis_gtk_recovery_progress_tree_selection</property> + <property name="can-focus">0</property> <child> <object class="GtkColumnViewColumn" id="anastasis_gtk_recovery_progress_description_colum"> <property name="expand">1</property> diff --git a/meson.build b/meson.build @@ -89,6 +89,16 @@ if not get_option('only-doc') if not haru_dep.found() haru_dep = cc.find_library('hpdf', required: false) endif + # The autotools build tested for the header (AC_CHECK_HEADERS(hpdf.h)) and + # the UI still asks for HAVE_HPDF_H to decide whether to offer the "Save as + # PDF" button, so the define and the source set have to be decided together: + # without the define the button stays hidden even though the code is built. + have_hpdf = haru_dep.found() and cc.has_header('hpdf.h') + if have_hpdf + private_config.set('HAVE_HPDF_H', 1) + else + message('libharu not found, PDF support disabled') + endif qrencode_dep = dependency('qrencode', required: false) if not qrencode_dep.found() diff --git a/src/anastasis/anastasis-gtk_action.c b/src/anastasis/anastasis-gtk_action.c @@ -3296,6 +3296,9 @@ action_challenge_solving (void) const char *uuid; const json_t *challenge; + /* This state only puts a dialog on top of the frame the previous state + rendered, so the progress list is the one thing that must be updated. */ + AG_progress_update (); uuid = json_string_value (json_object_get (AG_redux_state, "selected_challenge_uuid")); if (NULL == uuid) diff --git a/src/anastasis/anastasis-gtk_handle-print.c b/src/anastasis/anastasis-gtk_handle-print.c @@ -72,6 +72,9 @@ print_to_file (GtkWindow *parent_window, size_t off; bool found = false; + if (0 == strcmp (key, + "application_id")) + continue; /* not an attribute the user entered */ json_array_foreach (ra, off, pos) { const char *name = json_string_value (json_object_get (pos, @@ -117,7 +120,7 @@ print_to_file (GtkWindow *parent_window, av)); } } - json_decref (attrs); + json_decref (attr); /* 'attrs' is borrowed from 'attr' */ /* now convert to PDF */ ret = AG_print (uattrs, diff --git a/src/anastasis/anastasis-gtk_progress.c b/src/anastasis/anastasis-gtk_progress.c @@ -103,7 +103,8 @@ static const struct Step recovery_steps[] = { .tooltip = N_ ( "Please select which secret to recover. You may switch to a different version or provider.") }, { .description = N_ ("4. Solve challenges"), - .regex = "^CHALLENGE_SELECTING$", + /* paying for a challenge and answering it are both part of this step */ + .regex = "^CHALLENGE_(SELECTING|PAYING|SOLVING)$", .tooltip = N_ ( "Please select an authentication challenge to pass to recover the secret.") }, { .description = N_ ("5. Secret recovered"), @@ -219,7 +220,6 @@ void AG_progress_update (void) { const char *sel_name; - GtkSingleSelection *sel; GListModel *steps; const char *state; guint n; @@ -247,18 +247,6 @@ AG_progress_update (void) } if (NULL == steps) return; - sel = GTK_SINGLE_SELECTION (GCG_get_main_window_object (sel_name)); - if (NULL == sel) - { - GNUNET_break (0); - return; - } - /* We only ever move an existing selection; as nothing selects a step to - begin with, the lists show no step as the current one. This is how the - GTK3 version behaved as well. */ - if (GTK_INVALID_LIST_POSITION == - gtk_single_selection_get_selected (sel)) - return; n = g_list_model_get_n_items (steps); for (guint i = 0; i < n; i++) { @@ -272,10 +260,17 @@ AG_progress_update (void) g_object_unref (row); if (match) { + /* The selection is what highlights the step the user is at. Nothing + else ever moves it: the lists are not focusable and they swallow + clicks. */ AG_select_row (sel_name, i); return; } } + /* the reducer is in a state none of the steps above cover */ GNUNET_break (0); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "No progress step matches state `%s'\n", + state); } diff --git a/src/anastasis/meson.build b/src/anastasis/meson.build @@ -46,7 +46,7 @@ anastasis_gtk_SOURCES = [ 'anastasis-gtk_rows.c', ] -if haru_dep.found() +if have_hpdf anastasis_gtk_SOURCES += 'anastasis-gtk_handle-print.c' anastasis_gtk_SOURCES += 'print.c' else @@ -84,7 +84,7 @@ executable( # Developer helper for the PDF rendering code; not installed # (was noinst_PROGRAMS under HPDF_ENABLED in the autotools build). -if haru_dep.found() +if have_hpdf executable( 'test-print', ['test-print.c', 'print.c'],