summaryrefslogtreecommitdiff
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
parent9f7ef95ca63199c0d9dcadd59544815942d3d570 (diff)
downloadanastasis-gtk-9a19858602bc7c1777d76a288499812e216ca154.tar.gz
anastasis-gtk-9a19858602bc7c1777d76a288499812e216ca154.tar.bz2
anastasis-gtk-9a19858602bc7c1777d76a288499812e216ca154.zip
fix challenge selection dialog details (fixes #7082)
-rw-r--r--contrib/Makefile.am4
-rw-r--r--contrib/anastasis_gtk_challenge_template.glade40
-rw-r--r--contrib/anastasis_gtk_policy_template.glade1
-rw-r--r--src/anastasis/anastasis-gtk_action.c81
4 files changed, 80 insertions, 46 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 22f0e14..461472d 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -8,6 +8,7 @@ pkgdatadir= $(prefix)/share/anastasis/
IMAGES = \
qr_dummy.png \
logo.png \
+ home_work_black_24dp.svg \
noun_blindfold_3574196.svg \
outline_contact_support_black_24dp.png \
outline_stay_current_portrait_black_24dp.png \
@@ -17,7 +18,8 @@ IMAGES = \
ngi_ledger.png \
freeotp.png \
checkmark.svgz \
- bandiera_stelle.png
+ bandiera_stelle.png \
+ video_camera_front_black_24dp.svg
EXTRA_DIST = \
$(pkgdata_DATA) \
diff --git a/contrib/anastasis_gtk_challenge_template.glade b/contrib/anastasis_gtk_challenge_template.glade
index 45aab11..a58d5a4 100644
--- a/contrib/anastasis_gtk_challenge_template.glade
+++ b/contrib/anastasis_gtk_challenge_template.glade
@@ -2,6 +2,11 @@
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
+ <object class="GtkImage" id="run_image">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="stock">gtk-execute</property>
+ </object>
<object class="GtkWindow" id="challenge_template_window">
<property name="can-focus">False</property>
<child>
@@ -84,32 +89,20 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="challenge_label">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="label">DYNAMICALLY GENERATED</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="padding">15</property>
- <property name="position">6</property>
- </packing>
- </child>
- <child>
<object class="GtkButton" id="solve_challenge_button">
- <property name="label">gtk-execute</property>
+ <property name="label">Solve</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Try to solve this challenge.</property>
- <property name="use-stock">True</property>
+ <property name="image">run_image</property>
+ <property name="always-show-image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">15</property>
- <property name="position">7</property>
+ <property name="position">6</property>
</packing>
</child>
<child>
@@ -124,6 +117,21 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">15</property>
+ <property name="position">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="challenge_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="label">DYNAMICALLY GENERATED</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="padding">15</property>
<property name="position">8</property>
</packing>
</child>
diff --git a/contrib/anastasis_gtk_policy_template.glade b/contrib/anastasis_gtk_policy_template.glade
index 33e22ea..a0feaba 100644
--- a/contrib/anastasis_gtk_policy_template.glade
+++ b/contrib/anastasis_gtk_policy_template.glade
@@ -8,6 +8,7 @@
<object class="GtkFrame" id="policy_frame">
<property name="visible">True</property>
<property name="can-focus">False</property>
+ <property name="valign">start</property>
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
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));