anastasis-gtk

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

commit 468bb980da439f243822dbe438bdf061f3890cc1
parent a29a8e6e2ee0294842de1715c2e458655418980f
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 13 Apr 2022 09:25:10 +0200

implement changes for #7222

Diffstat:
Msrc/anastasis/anastasis-gtk_action.c | 12+++++-------
Msrc/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c | 40++++++++++++++++++++++------------------
2 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/src/anastasis/anastasis-gtk_action.c b/src/anastasis/anastasis-gtk_action.c @@ -720,9 +720,11 @@ action_authentications_editing (void) { uint32_t ec = 0; uint32_t hc = 0; - bool disabled = false; + const char *status; json_t *methods = NULL; struct GNUNET_JSON_Specification spec[] = { + GNUNET_JSON_spec_string ("status", + &status), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_uint32 ("error_code", &ec), @@ -735,11 +737,6 @@ action_authentications_editing (void) GNUNET_JSON_spec_uint32 ("http_status", &hc), NULL), - GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_bool ("disabled", - &disabled), - NULL), - GNUNET_JSON_spec_end () }; @@ -751,7 +748,8 @@ action_authentications_editing (void) GNUNET_break (0); continue; } - if (disabled) + if (0 == strcmp (status, + "disabled")) continue; switch (hc) { diff --git a/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c b/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c @@ -396,8 +396,10 @@ edit_provider_dialog_response_cb (GtkDialog *dialog, args, url, GNUNET_JSON_PACK ( - GNUNET_JSON_pack_bool ("disabled", - ! enabled)))); + GNUNET_JSON_pack_string ("status", + enabled + ? "not-contacted" + : "disabled")))); g_free (url); } while (gtk_tree_model_iter_next (tm, @@ -448,9 +450,11 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object, uint32_t http_code = 0; uint32_t ec = TALER_EC_NONE; struct TALER_Amount ll; - bool disabled = false; + const char *status; const char *name = NULL; struct GNUNET_JSON_Specification spec[] = { + GNUNET_JSON_spec_string ("status", + &status), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_uint32 ("http_status", &http_code), @@ -460,10 +464,6 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object, &name), NULL), GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_bool ("disabled", - &disabled), - NULL), - GNUNET_JSON_spec_mark_optional ( TALER_JSON_spec_amount_any ("liability_limit", &ll), NULL), @@ -473,7 +473,7 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object, NULL), GNUNET_JSON_spec_end () }; - char *status; + char *status_str; const char *color; bool sensitive = false; const char *ll_s = NULL; @@ -493,9 +493,10 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object, continue; } if ( (MHD_HTTP_OK == http_code) && - (! disabled) ) + (0 != strcmp (status, + "disabled")) ) { - status = GNUNET_strdup (_ ("available")); + status_str = GNUNET_strdup (_ ("available")); color = "green"; sensitive = true; if (GNUNET_OK == @@ -505,24 +506,26 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object, GNUNET_break (0); } else if ( (0 == http_code) && - (! disabled) ) + (0 != strcmp (status, + "disabled")) ) { - GNUNET_asprintf (&status, + GNUNET_asprintf (&status_str, _ ("Network failure: %s (#%u)"), TALER_ErrorCode_get_hint (ec), (unsigned int) ec); color = "red"; } - else if (disabled) + else if (0 == strcmp (status, + "disabled")) { - GNUNET_asprintf (&status, + GNUNET_asprintf (&status_str, _ ("disabled")); color = "blue"; sensitive = true; } else { - GNUNET_asprintf (&status, + GNUNET_asprintf (&status_str, _ ("HTTP %s (%u): %s (#%u)"), MHD_get_reason_phrase_for (http_code), (unsigned int) http_code, @@ -537,15 +540,16 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object, NULL, -1, AG_PMC_PROVIDER_URL, url, - AG_PMC_PROVIDER_STATUS, status, + AG_PMC_PROVIDER_STATUS, status_str, AG_PMC_PROVIDER_STATUS_COLOR, color, AG_PMC_PROVIDER_LIABILITY_LIMIT, ll_s, - AG_PMC_PROVIDER_ENABLED, ! disabled, + AG_PMC_PROVIDER_ENABLED, (0 != strcmp (status, + "disabled")), AG_PMC_PROVIDER_SENSITIVE, sensitive, AG_PMC_PROVIDER_NOT_SENSITIVE, ! sensitive, AG_PMC_PROVIDER_NAME, name, -1); - GNUNET_free (status); + GNUNET_free (status_str); } } ad = GTK_WIDGET (gtk_builder_get_object (builder,