summaryrefslogtreecommitdiff
path: root/src/anastasis/anastasis-gtk_action.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-11-27 21:17:47 +0100
committerChristian Grothoff <christian@grothoff.org>2021-11-27 21:17:47 +0100
commit9a19858602bc7c1777d76a288499812e216ca154 (patch)
treeb946d7602390ce2a9e3287b7b530a88f98c7c325 /src/anastasis/anastasis-gtk_action.c
parent9f7ef95ca63199c0d9dcadd59544815942d3d570 (diff)
downloadanastasis-gtk-9a19858602bc7c1777d76a288499812e216ca154.tar.gz
anastasis-gtk-9a19858602bc7c1777d76a288499812e216ca154.tar.bz2
anastasis-gtk-9a19858602bc7c1777d76a288499812e216ca154.zip
fix challenge selection dialog details (fixes #7082)
Diffstat (limited to 'src/anastasis/anastasis-gtk_action.c')
-rw-r--r--src/anastasis/anastasis-gtk_action.c81
1 files changed, 52 insertions, 29 deletions
diff --git a/src/anastasis/anastasis-gtk_action.c b/src/anastasis/anastasis-gtk_action.c
index d742a25..be0bf51 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -1327,7 +1327,7 @@ action_secret_editing (void)
}
if (NULL != filename)
{
- AG_insensitive ("anastasis_gtk_enter_secret_textbuffer");
+ AG_insensitive ("anastasis_gtk_enter_secret_textview");
AG_show ("anastasis_gtk_secret_clear_file_button");
AG_show ("anastasis_gtk_secret_file_name_hbox");
AG_hide ("anastasis_gtk_secret_file_chooser_hbox");
@@ -1348,7 +1348,7 @@ action_secret_editing (void)
(0 == strlen (name) ) )
AG_focus ("anastasis_gtk_secret_name_entry");
else if (NULL == filename)
- AG_focus ("anastasis_gtk_enter_secret_textbuffer");
+ AG_focus ("anastasis_gtk_enter_secret_textview");
GNUNET_JSON_parse_free (spec);
}
AG_sensitive ("anastasis_gtk_main_window_prev_button");
@@ -2231,7 +2231,7 @@ challenge_button_clicked_cb (GObject *object,
static void
add_challenge (GtkBox *challenge_box,
json_t *rd,
- json_t *challenge)
+ json_t *uchallenge)
{
GtkBuilder *builder;
GtkWindow *window;
@@ -2245,6 +2245,12 @@ add_challenge (GtkBox *challenge_box,
struct TALER_Amount cost;
bool async = false;
bool solved = false;
+ struct GNUNET_JSON_Specification uspec[] = {
+ GNUNET_JSON_spec_string ("uuid",
+ &uuid),
+ GNUNET_JSON_spec_end ()
+ };
+ const char *iuuid;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("instructions",
&instructions),
@@ -2253,30 +2259,49 @@ add_challenge (GtkBox *challenge_box,
GNUNET_JSON_spec_string ("url",
&provider),
GNUNET_JSON_spec_string ("uuid",
- &uuid),
+ &iuuid),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("async",
&async)),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_bool ("solved",
+ &solved)),
GNUNET_JSON_spec_end ()
};
- {
- const json_t *ks;
-
- ks = json_object_get (challenge,
- "key_share");
- if ( (NULL != ks) &&
- (! json_is_null (ks)) )
- solved = true;
- }
if (GNUNET_OK !=
- GNUNET_JSON_parse (challenge,
- spec,
+ GNUNET_JSON_parse (uchallenge,
+ uspec,
NULL, NULL))
{
GNUNET_break (0);
return;
}
+ {
+ json_t *challenges;
+ size_t index;
+ json_t *challenge;
+
+ challenges = json_object_get (rd,
+ "cs");
+ /* TODO: change data structure to have 'uuid'
+ as the index into the 'challenges' object, instead of this
+ 'challenges' being an array */
+ json_array_foreach (challenges, index, challenge)
+ {
+ if (GNUNET_OK !=
+ GNUNET_JSON_parse (challenge,
+ spec,
+ NULL, NULL))
+ {
+ GNUNET_break (0);
+ continue;
+ }
+ if (0 == strcmp (uuid,
+ iuuid))
+ break;
+ }
+ }
if (GNUNET_OK !=
lookup_recovery_cost (provider,
type,
@@ -2333,13 +2358,12 @@ add_challenge (GtkBox *challenge_box,
g_object_ref (hbox);
gtk_container_remove (GTK_CONTAINER (window),
hbox);
- g_object_unref (window);
g_object_unref (builder);
- gtk_box_pack_end (challenge_box,
- hbox,
- false,
- false,
- 15);
+ gtk_box_pack_start (challenge_box,
+ hbox,
+ false,
+ false,
+ 15);
}
@@ -2397,20 +2421,19 @@ add_policy (GtkBox *policy_box,
}
GNUNET_asprintf (&txt,
_ ("Policy #%u"),
- (unsigned int) pindex);
+ (unsigned int) 1 + pindex);
gtk_label_set_text (label,
txt);
GNUNET_free (txt);
g_object_ref (widget);
gtk_container_remove (GTK_CONTAINER (window),
widget);
- g_object_unref (window);
g_object_unref (builder);
- gtk_box_pack_end (policy_box,
- widget,
- false,
- false,
- 15);
+ gtk_box_pack_start (policy_box,
+ widget,
+ false,
+ false,
+ 15);
}
@@ -3366,7 +3389,7 @@ action_challenge_solving (void)
GtkWidget *box;
box = GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_open_challenge_box"));
+ "anastasis_gtk_policy_vbox"));
toplevel = gtk_widget_get_toplevel (box);
gtk_window_set_transient_for (GTK_WINDOW (diag),
GTK_WINDOW (toplevel));