anastasis-gtk

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

commit 91246b12fcdbe452920949eef08afb7c8b6c0d28
parent b32a468930eeed1e5c5ff5518ae896eca38c0717
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 15 Dec 2024 12:33:30 +0100

-make code work with gnunet-gtk 0.23.1

Diffstat:
MREADME | 3++-
Msrc/anastasis/anastasis-gtk.c | 4++--
Msrc/anastasis/anastasis-gtk_action.c | 33+++++++++++++++++++++++----------
Msrc/anastasis/anastasis-gtk_handle-add-provider.c | 9++++++---
Msrc/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c | 7+++++--
Msrc/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c | 4++++
Msrc/anastasis/anastasis-gtk_handle-method-email.c | 7+++++--
Msrc/anastasis/anastasis-gtk_handle-method-iban.c | 7+++++--
Msrc/anastasis/anastasis-gtk_handle-method-post.c | 13+++++++++----
Msrc/anastasis/anastasis-gtk_handle-method-question.c | 7+++++--
Msrc/anastasis/anastasis-gtk_handle-method-sms.c | 7+++++--
Msrc/anastasis/anastasis-gtk_handle-method-totp.c | 7+++++--
Msrc/anastasis/anastasis-gtk_handle-secret-buttons.c | 3+++
Msrc/anastasis/anastasis-gtk_helper.c | 3++-
Msrc/anastasis/anastasis-gtk_io.c | 13+++++++++----
Msrc/anastasis/anastasis-gtk_pe-edit-policy.c | 10+++++++---
16 files changed, 97 insertions(+), 40 deletions(-)

diff --git a/README b/README @@ -32,7 +32,8 @@ Direct dependencies These are the direct dependencies for running Anastasis: -- GNU Anastasis >= 0.5.0 +- GNU Anastasis >= 0.6.0 +- gnunet-gtk >= 0.23.1 - PostgreSQL >= 15.0 - libmagic - libgtk3+ diff --git a/src/anastasis/anastasis-gtk.c b/src/anastasis/anastasis-gtk.c @@ -217,10 +217,10 @@ run (void *cls) AG_ml = cls; AG_entry_attributes = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO); - GNUNET_GTK_set_icon_search_path (); GNUNET_GTK_setup_nls (); if (GNUNET_OK != - GNUNET_GTK_main_loop_build_window (AG_ml, + GNUNET_GTK_main_loop_build_window (ANASTASIS_GTK_project_data (), + AG_ml, NULL)) return; AG_cfg = GNUNET_GTK_main_loop_get_gtk_configuration (AG_ml); diff --git a/src/anastasis/anastasis-gtk_action.c b/src/anastasis/anastasis-gtk_action.c @@ -25,6 +25,7 @@ */ #include <gnunet/gnunet_util_lib.h> #include <strings.h> +#include "anastasis_gtk_util.h" #include "anastasis-gtk_action.h" #include "anastasis-gtk_attributes.h" #include "anastasis-gtk_dispatch.h" @@ -436,8 +437,10 @@ create_attribute_widget (const struct GNUNET_HashCode *uh, GtkBin *bin; builder = - GNUNET_GTK_get_new_builder ("this_stays_private.glade", - NULL); + GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "this_stays_private.glade", + NULL); GNUNET_break (NULL != builder); /* load frame */ bin = GTK_BIN (gtk_builder_get_object (builder, @@ -2404,6 +2407,7 @@ add_challenge (GtkBox *challenge_box, ok = false; builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), "anastasis_gtk_challenge_template.glade", NULL); window = GTK_WINDOW (gtk_builder_get_object (builder, @@ -2508,8 +2512,10 @@ add_policy (GtkBox *policy_box, AG_error ("Policy did not parse correctly"); return false; } - builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_policy_template.glade", - NULL); + builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "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, @@ -3025,6 +3031,7 @@ diag_question (const json_t *details) GtkDialog *ad; builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), "anastasis_gtk_challenge_question.glade", NULL); if (NULL == builder) @@ -3090,8 +3097,10 @@ diag_code (const json_t *details) return NULL; } - builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_challenge_code.glade", - NULL); + builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "anastasis_gtk_challenge_code.glade", + NULL); if (NULL == builder) { GNUNET_break (0); @@ -3154,8 +3163,10 @@ diag_totp (const json_t *details) return NULL; } - builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_challenge_totp.glade", - NULL); + builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "anastasis_gtk_challenge_totp.glade", + NULL); if (NULL == builder) { GNUNET_break (0); @@ -3250,8 +3261,10 @@ diag_iban (const json_t *details) } } - builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_challenge_iban.glade", - NULL); + builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "anastasis_gtk_challenge_iban.glade", + NULL); if (NULL == builder) { GNUNET_break (0); diff --git a/src/anastasis/anastasis-gtk_handle-add-provider.c b/src/anastasis/anastasis-gtk_handle-add-provider.c @@ -24,6 +24,7 @@ * @author Christian Grothoff */ #include <gnunet/gnunet_util_lib.h> +#include "anastasis_gtk_util.h" #include "anastasis-gtk_action.h" #include "anastasis-gtk_helper.h" #include <jansson.h> @@ -61,7 +62,7 @@ config_cb (void *cls, co = NULL; l = GTK_LABEL (gtk_builder_get_object (builder, "error_label")); - if (MHD_HTTP_OK != acfg->http_status) + if (MHD_HTTP_OK != acfg->http_status) { char *msg; @@ -243,8 +244,10 @@ anastasis_gtk_add_provider_button_clicked_cb (GtkButton *object, GNUNET_break (0); return; } - builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_add_provider.glade", - NULL); + builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "anastasis_gtk_add_provider.glade", + NULL); if (NULL == builder) { GNUNET_break (0); diff --git a/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c b/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c @@ -25,6 +25,7 @@ * @author Dennis Neufeld */ #include <gnunet/gnunet_util_lib.h> +#include "anastasis_gtk_util.h" #include "anastasis-gtk_action.h" #include "anastasis-gtk_helper.h" #include "anastasis-gtk_handle-main-window-forward-clicked.h" @@ -440,8 +441,10 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object, GtkListStore *ls; json_t *providers; - builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_edit_providers.glade", - NULL); + builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "anastasis_gtk_edit_providers.glade", + NULL); if (NULL == builder) { GNUNET_break (0); diff --git a/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c b/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c @@ -27,6 +27,7 @@ #define HAVE_USED_CONFIG_H 1 #include <gnunet/gnunet_util_lib.h> +#include "anastasis_gtk_util.h" #include "anastasis-gtk_action.h" #include "anastasis-gtk_attributes.h" #include "anastasis-gtk_dispatch.h" @@ -141,6 +142,7 @@ question_certainty (void) GtkDialog *ad; builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), "anastasis_gtk_user_sure.glade", NULL); if (NULL == builder) @@ -264,6 +266,7 @@ question_sanity (void) GtkDialog *ad; builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), "anastasis_gtk_warn_multifactor.glade", NULL); if (NULL == builder) @@ -304,6 +307,7 @@ refuse_insanity (void) GtkDialog *ad; builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), "anastasis_gtk_deny_singlefactor.glade", NULL); if (NULL == builder) diff --git a/src/anastasis/anastasis-gtk_handle-method-email.c b/src/anastasis/anastasis-gtk_handle-method-email.c @@ -24,6 +24,7 @@ * @author Christian Grothoff */ #include <gnunet/gnunet_util_lib.h> +#include "anastasis_gtk_util.h" #include "anastasis-gtk_action.h" #include "anastasis-gtk_helper.h" #include "anastasis-gtk_handle-identity-changed.h" @@ -251,8 +252,10 @@ anastasis_gtk_btn_add_auth_email_clicked_cb (GObject *object, GtkWidget *ad; GtkBuilder *builder; - builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_auth_add_email.glade", - NULL); + builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "anastasis_gtk_auth_add_email.glade", + NULL); if (NULL == builder) { GNUNET_break (0); diff --git a/src/anastasis/anastasis-gtk_handle-method-iban.c b/src/anastasis/anastasis-gtk_handle-method-iban.c @@ -24,6 +24,7 @@ * @author Christian Grothoff */ #include <gnunet/gnunet_util_lib.h> +#include "anastasis_gtk_util.h" #include "anastasis-gtk_action.h" #include "anastasis-gtk_helper.h" #include "anastasis-gtk_handle-identity-changed.h" @@ -149,8 +150,10 @@ anastasis_gtk_btn_add_auth_iban_clicked_cb (GObject *object, GtkWidget *ad; GtkBuilder *builder; - builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_auth_add_iban.glade", - NULL); + builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "anastasis_gtk_auth_add_iban.glade", + NULL); if (NULL == builder) { GNUNET_break (0); diff --git a/src/anastasis/anastasis-gtk_handle-method-post.c b/src/anastasis/anastasis-gtk_handle-method-post.c @@ -24,6 +24,7 @@ * @author Christian Grothoff */ #include <gnunet/gnunet_util_lib.h> +#include "anastasis_gtk_util.h" #include "anastasis-gtk_action.h" #include "anastasis-gtk_helper.h" #include "anastasis-gtk_handle-identity-changed.h" @@ -97,10 +98,12 @@ anastasis_gtk_b_post_dialog_response_cb (GtkDialog *dialog, "anastasis_gtk_b_post_dialog_city_entry")), GNUNET_JSON_pack_string ("postcode", gt (builder, - "anastasis_gtk_b_post_dialog_postcode_entry")), + "anastasis_gtk_b_post_dialog_postcode_entry") + ), GNUNET_JSON_pack_string ("country", gt (builder, - "anastasis_gtk_b_post_dialog_country_entry"))); + "anastasis_gtk_b_post_dialog_country_entry")) + ); addr_s = json_dumps (addr, JSON_COMPACT | JSON_SORT_KEYS); json_decref (addr); @@ -181,8 +184,10 @@ anastasis_gtk_btn_add_auth_post_clicked_cb (GObject *object, GtkWidget *ad; GtkBuilder *builder; - builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_auth_add_post.glade", - NULL); + builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "anastasis_gtk_auth_add_post.glade", + NULL); if (NULL == builder) { GNUNET_break (0); diff --git a/src/anastasis/anastasis-gtk_handle-method-question.c b/src/anastasis/anastasis-gtk_handle-method-question.c @@ -24,6 +24,7 @@ * @author Christian Grothoff */ #include <gnunet/gnunet_util_lib.h> +#include "anastasis_gtk_util.h" #include "anastasis-gtk_action.h" #include "anastasis-gtk_helper.h" #include "anastasis-gtk_handle-identity-changed.h" @@ -139,8 +140,10 @@ anastasis_gtk_btn_add_auth_question_clicked_cb (GObject *object, GtkWidget *ad; GtkBuilder *builder; - builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_auth_add_question.glade", - NULL); + builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "anastasis_gtk_auth_add_question.glade", + NULL); if (NULL == builder) { GNUNET_break (0); diff --git a/src/anastasis/anastasis-gtk_handle-method-sms.c b/src/anastasis/anastasis-gtk_handle-method-sms.c @@ -24,6 +24,7 @@ * @author Christian Grothoff */ #include <gnunet/gnunet_util_lib.h> +#include "anastasis_gtk_util.h" #include "anastasis-gtk_action.h" #include "anastasis-gtk_helper.h" #include "anastasis-gtk_handle-identity-changed.h" @@ -231,8 +232,10 @@ anastasis_gtk_btn_add_auth_sms_clicked_cb (GObject *object, GtkWidget *ad; GtkBuilder *builder; - builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_auth_add_sms.glade", - NULL); + builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "anastasis_gtk_auth_add_sms.glade", + NULL); if (NULL == builder) { GNUNET_break (0); diff --git a/src/anastasis/anastasis-gtk_handle-method-totp.c b/src/anastasis/anastasis-gtk_handle-method-totp.c @@ -24,6 +24,7 @@ * @author Christian Grothoff */ #include <gnunet/gnunet_util_lib.h> +#include "anastasis_gtk_util.h" #include "anastasis-gtk_action.h" #include "anastasis-gtk_helper.h" #include "anastasis-gtk_handle-identity-changed.h" @@ -339,8 +340,10 @@ anastasis_gtk_btn_add_auth_totp_clicked_cb (GObject *object, GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, totp_key, sizeof (totp_key)); - builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_auth_add_totp.glade", - NULL); + builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "anastasis_gtk_auth_add_totp.glade", + NULL); if (NULL == builder) { GNUNET_break (0); diff --git a/src/anastasis/anastasis-gtk_handle-secret-buttons.c b/src/anastasis/anastasis-gtk_handle-secret-buttons.c @@ -24,6 +24,7 @@ * @author Dennis Neufeld */ #include <gnunet/gnunet_util_lib.h> +#include "anastasis_gtk_util.h" #include "anastasis-gtk_action.h" #include "anastasis-gtk_handle-expiration-change.h" #include "anastasis-gtk_helper.h" @@ -187,6 +188,7 @@ anastasis_gtk_enter_secret_open_button_clicked_cb (GtkButton *button, (void) button; (void) user_data; builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), "anastasis_gtk_open_secret_dialog.glade", NULL); if (NULL == builder) @@ -356,6 +358,7 @@ anastasis_gtk_secret_save_as_button_clicked_cb (GtkButton *button, spec, NULL, NULL)); builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), "anastasis_gtk_save_secret_dialog.glade", NULL); if (NULL == builder) diff --git a/src/anastasis/anastasis-gtk_helper.c b/src/anastasis/anastasis-gtk_helper.c @@ -26,6 +26,7 @@ */ #define _GNU_SOURCE #include <stdio.h> +#include "anastasis_gtk_util.h" #include <gnunet/gnunet_util_lib.h> #include "anastasis-gtk_helper.h" #include <jansson.h> @@ -342,7 +343,7 @@ create_qrcode (unsigned int scale, /* We use a trick to create a pixbuf in a way that works for both Gtk2 and Gtk3 by loading a dummy file from disk; all other methods are not portable to both Gtk2 and Gtk3. */ - dir = GNUNET_GTK_get_data_dir (); + dir = GNUNET_GTK_get_data_dir (ANASTASIS_GTK_project_data ()); GNUNET_asprintf (&fn, "%s%s", dir, diff --git a/src/anastasis/anastasis-gtk_io.c b/src/anastasis/anastasis-gtk_io.c @@ -23,6 +23,7 @@ * @author Christian Grothoff */ #include <gnunet/gnunet_util_lib.h> +#include "anastasis_gtk_util.h" #include "anastasis-gtk_attributes.h" #include "anastasis-gtk_dispatch.h" #include "anastasis-gtk_helper.h" @@ -72,8 +73,10 @@ anastasis_gtk_open_state_clicked_cb (GtkButton *button, GtkWidget *ad; GtkBuilder *builder; - builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_open_file_dialog.glade", - NULL); + builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "anastasis_gtk_open_file_dialog.glade", + NULL); if (NULL == builder) { GNUNET_break (0); @@ -228,8 +231,10 @@ anastasis_gtk_main_window_save_as_button_clicked_cb (GtkButton *button, GtkWidget *toplevel; toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button)); - builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_save_file_dialog.glade", - NULL); + builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "anastasis_gtk_save_file_dialog.glade", + NULL); if (NULL == builder) { GNUNET_break (0); diff --git a/src/anastasis/anastasis-gtk_pe-edit-policy.c b/src/anastasis/anastasis-gtk_pe-edit-policy.c @@ -25,6 +25,7 @@ */ #include <gnunet/gnunet_util_lib.h> #include <strings.h> +#include "anastasis_gtk_util.h" #include "anastasis-gtk_action.h" #include "anastasis-gtk_helper.h" #include "anastasis-gtk_pe.h" @@ -438,8 +439,10 @@ AG_edit_policy (guint pindex) json_t *methods = NULL; edc = GNUNET_new (struct EditDialogContext); - edc->builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_edit_policy.glade", - edc); + edc->builder = GNUNET_GTK_get_new_builder ( + ANASTASIS_GTK_project_data (), + "anastasis_gtk_edit_policy.glade", + edc); edc->pindex = pindex; if (NULL == edc->builder) { @@ -561,7 +564,8 @@ AG_edit_policy (guint pindex) "anastasis_gtk_main_window_quit_button")); toplevel = gtk_widget_get_toplevel (anchor); ad = GTK_WIDGET (gtk_builder_get_object (edc->builder, - "anastasis_gtk_policy_edit_dialog")); + "anastasis_gtk_policy_edit_dialog") + ); gtk_widget_get_preferred_size (ad, NULL, &req);