anastasis-gtk

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

commit 47b7418ded6f139d22404aeea72aa8f48fdcade8
parent 5a65479bd5edc3b7898e57106c39fd28cf0fd9e9
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue,  5 Apr 2022 17:16:11 +0200

adapt to latest GNUnet API: GNUNET_JSON_spec_mark_optional() changed

Diffstat:
Msrc/anastasis/anastasis-gtk_action.c | 110+++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
Msrc/anastasis/anastasis-gtk_attributes.c | 7++++---
Msrc/anastasis/anastasis-gtk_autocomplete.c | 18++++++++++--------
Msrc/anastasis/anastasis-gtk_handle-add-provider.c | 3++-
Msrc/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c | 19++++++++++++-------
Msrc/anastasis/anastasis-gtk_handle-identity-changed.c | 3++-
Msrc/anastasis/anastasis-gtk_handle-secret-buttons.c | 39+++++++++++++++++++++++----------------
7 files changed, 124 insertions(+), 75 deletions(-)

diff --git a/src/anastasis/anastasis-gtk_action.c b/src/anastasis/anastasis-gtk_action.c @@ -71,11 +71,12 @@ lookup_provider_name (const char *provider_url) { json_t *providers; json_t *provider; - const char *name; + const char *name = NULL; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("business_name", - &name)), + &name), + NULL), GNUNET_JSON_spec_end () }; @@ -519,13 +520,16 @@ action_user_attributes_collecting (void) struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("widget", - &widget_name)), + &widget_name), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_bool ("optional", - &optional)), + &optional), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("tooltip", - &attr_tooltip)), + &attr_tooltip), + NULL), GNUNET_JSON_spec_string ("type", &attr_type), GNUNET_JSON_spec_string ("uuid", @@ -534,7 +538,8 @@ action_user_attributes_collecting (void) &attr_name), GNUNET_JSON_spec_mark_optional ( TALER_JSON_spec_i18n_str ("label", - &attr_label)), + &attr_label), + NULL), GNUNET_JSON_spec_end () }; struct GNUNET_HashCode uh; @@ -720,16 +725,20 @@ action_authentications_editing (void) struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_uint32 ("error_code", - &ec)), + &ec), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_json ("methods", - &methods)), + &methods), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_uint32 ("http_status", - &hc)), + &hc), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_bool ("disabled", - &disabled)), + &disabled), + NULL), GNUNET_JSON_spec_end () }; @@ -1260,10 +1269,12 @@ action_secret_editing (void) struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_json ("core_secret", - &jsecret)), + &jsecret), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("secret_name", - &name)), + &name), + NULL), GNUNET_JSON_spec_end () }; @@ -1289,13 +1300,16 @@ action_secret_editing (void) struct GNUNET_JSON_Specification sspec[] = { GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("text", - &text)), + &text), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("mime", - &mime)), + &mime), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("filename", - &filename)), + &filename), + NULL), GNUNET_JSON_spec_end () }; @@ -1696,19 +1710,22 @@ show_challenge_feedback (const char *uuid, const char *state; const char *hint = NULL; const char *taler_pay_uri = NULL; - uint32_t ec = 0; + uint32_t ec = TALER_EC_NONE; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("state", &state), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("taler_pay_uri", - &taler_pay_uri)), + &taler_pay_uri), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("display_hint", - &hint)), + &hint), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_uint32 ("error_code", - &ec)), + &ec), + NULL), GNUNET_JSON_spec_end () }; @@ -2256,10 +2273,12 @@ add_challenge (GtkBox *challenge_box, &iuuid), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_bool ("async", - &async)), + &async), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_bool ("solved", - &solved)), + &solved), + NULL), GNUNET_JSON_spec_end () }; bool ok = true; @@ -2565,7 +2584,8 @@ action_challenge_selecting (void) struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_bool ("async", - &async)), + &async), + NULL), GNUNET_JSON_spec_end () }; const json_t *ks; @@ -2640,13 +2660,14 @@ action_challenge_paying (void) &state), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("taler_pay_uri", - &payto)), + &payto), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("provider", - &provider)), - GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_string ("payment_secret", - &ps)), + &provider), + NULL), + GNUNET_JSON_spec_string ("payment_secret", + &ps), GNUNET_JSON_spec_end () }; GdkPixbuf *pb; @@ -2752,7 +2773,7 @@ render_feedback (GtkBuilder *builder, const char *hint = NULL; json_t *details = NULL; const char *taler_pay_uri = NULL; - uint32_t ec = 0; + uint32_t ec = TALER_EC_NONE; uint32_t http_status = 0; bool hide = false; struct GNUNET_JSON_Specification spec[] = { @@ -2760,22 +2781,28 @@ render_feedback (GtkBuilder *builder, &state), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("taler_pay_uri", - &taler_pay_uri)), + &taler_pay_uri), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_json ("details", - &details)), + &details), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("redirect_url", - &redirect_url)), + &redirect_url), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("hint", - &hint)), + &hint), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_uint32 ("http_status", - &http_status)), + &http_status), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_uint32 ("error_code", - &ec)), + &ec), + NULL), GNUNET_JSON_spec_end () }; GtkLabel *elabel; @@ -2828,10 +2855,12 @@ render_feedback (GtkBuilder *builder, &code), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("hint", - &hint)), + &hint), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("detail", - &detail)), + &detail), + NULL), GNUNET_JSON_spec_end () }; @@ -3299,14 +3328,17 @@ action_recovery_finished (void) struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("mime", - &mime)), + &mime), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("text", - &text)), + &text), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_varsize ("value", &data, - &data_size)), + &data_size), + NULL), GNUNET_JSON_spec_end () }; GdkPixbuf *pb; diff --git a/src/anastasis/anastasis-gtk_attributes.c b/src/anastasis/anastasis-gtk_attributes.c @@ -100,11 +100,12 @@ AG_collect_attributes (bool partial) const char *attr_name; const char *attr_type; const char *attr_uuid; - int optional = false; + bool optional = false; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_boolean ("optional", - &optional)), + GNUNET_JSON_spec_bool ("optional", + &optional), + NULL), GNUNET_JSON_spec_string ("type", &attr_type), GNUNET_JSON_spec_string ("name", diff --git a/src/anastasis/anastasis-gtk_autocomplete.c b/src/anastasis/anastasis-gtk_autocomplete.c @@ -57,11 +57,13 @@ lookup_autocomplete (GtkEditable *editable) bool match; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_string ("widget", - &widget_name)), + GNUNET_JSON_spec_string ("widget", + &widget_name), + NULL), GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_string ("autocomplete", - &autocomplete)), + GNUNET_JSON_spec_string ("autocomplete", + &autocomplete), + NULL), GNUNET_JSON_spec_string ("type", &type), GNUNET_JSON_spec_end () @@ -154,7 +156,7 @@ anastasis_gtk_autocomplete_insert_text (GtkEditable *editable, pos = gtk_editable_get_position (editable); if (strlen (ac) <= pos + new_text_length) return; - if (ac[pos+new_text_length] != '?') + if (ac[pos + new_text_length] != '?') { g_signal_stop_emission_by_name (editable, "insert-text"); @@ -162,7 +164,7 @@ anastasis_gtk_autocomplete_insert_text (GtkEditable *editable, "%.*s%c", new_text_length, new_text, - ac[pos+new_text_length]); + ac[pos + new_text_length]); gtk_editable_insert_text (editable, replacement, -1, @@ -211,7 +213,7 @@ anastasis_gtk_pin_autocomplete_insert_text (GtkEditable *editable, pos = gtk_editable_get_position (editable); if (strlen (ac) <= pos + new_text_length) return; - if (ac[pos+new_text_length] != '?') + if (ac[pos + new_text_length] != '?') { g_signal_stop_emission_by_name (editable, "insert-text"); @@ -219,7 +221,7 @@ anastasis_gtk_pin_autocomplete_insert_text (GtkEditable *editable, "%.*s%c", new_text_length, new_text, - ac[pos+new_text_length]); + ac[pos + new_text_length]); gtk_editable_insert_text (editable, replacement, -1, diff --git a/src/anastasis/anastasis-gtk_handle-add-provider.c b/src/anastasis/anastasis-gtk_handle-add-provider.c @@ -86,7 +86,8 @@ config_cb (void *cls, GNUNET_assert (NULL != methods_list); for (unsigned int i = 0; i<acfg->methods_length; i++) { - struct ANASTASIS_AuthorizationMethodConfig *method = &acfg->methods[i]; + const struct ANASTASIS_AuthorizationMethodConfig *method + = &acfg->methods[i]; json_t *mj = GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("type", method->type), diff --git a/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c b/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c @@ -445,27 +445,32 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object, const json_t *provider; json_object_foreach (providers, url, provider) { - uint32_t http_code; - uint32_t ec; + uint32_t http_code = 0; + uint32_t ec = TALER_EC_NONE; struct TALER_Amount ll; bool disabled = false; const char *name = NULL; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_uint32 ("http_status", - &http_code)), + &http_code), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("business_name", - &name)), + &name), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_bool ("disabled", - &disabled)), + &disabled), + NULL), GNUNET_JSON_spec_mark_optional ( TALER_JSON_spec_amount_any ("liability_limit", - &ll)), + &ll), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_uint32 ("error_code", - &ec)), + &ec), + NULL), GNUNET_JSON_spec_end () }; char *status; diff --git a/src/anastasis/anastasis-gtk_handle-identity-changed.c b/src/anastasis/anastasis-gtk_handle-identity-changed.c @@ -92,7 +92,8 @@ AG_mark_invalid_input (const char *name) struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("widget", - &widget_name)), + &widget_name), + NULL), GNUNET_JSON_spec_string ("type", &attr_type), GNUNET_JSON_spec_string ("uuid", diff --git a/src/anastasis/anastasis-gtk_handle-secret-buttons.c b/src/anastasis/anastasis-gtk_handle-secret-buttons.c @@ -222,18 +222,20 @@ save_secret_dialog_response_cb (GtkDialog *dialog, { GtkBuilder *builder = GTK_BUILDER (user_data); char *filename; - size_t data_len; - const char *text; - void *data; + size_t data_len = 0; + const char *text = NULL; + void *data = NULL; json_t *cs; struct GNUNET_JSON_Specification cspec[] = { GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("text", - &text)), + &text), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_varsize ("value", &data, - &data_len)), + &data_len), + NULL), GNUNET_JSON_spec_end () }; @@ -330,16 +332,18 @@ anastasis_gtk_secret_save_as_button_clicked_cb (GtkButton *button, GtkWidget *ad; GtkBuilder *builder; - const char *mime; - const char *fn; + const char *mime = NULL; + const char *fn = NULL; json_t *cs; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("filename", - &fn)), + &fn), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("mime", - &mime)), + &mime), + NULL), GNUNET_JSON_spec_end () }; @@ -398,22 +402,25 @@ void anastasis_gtk_secret_copy_button_clicked_cb (GtkButton *button, gpointer user_data) { - size_t data_len; - void *data; - const char *mime; - const char *text; + size_t data_len = 0; + void *data = NULL; + const char *mime = NULL; + const char *text = NULL; json_t *cs; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_varsize ("value", &data, - &data_len)), + &data_len), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("mime", - &mime)), + &mime), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("text", - &text)), + &text), + NULL), GNUNET_JSON_spec_end () }; GtkClipboard *cb;