aboutsummaryrefslogtreecommitdiff
path: root/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c')
-rw-r--r--src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c92
1 files changed, 16 insertions, 76 deletions
diff --git a/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c b/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c
index 4c4eab9..a4b6a64 100644
--- a/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c
+++ b/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c
@@ -36,39 +36,8 @@
36 36
37 37
38/** 38/**
39 * Function called on each selected currency. Appends
40 * the currency to the JSON array.
41 *
42 * @param model the model of the currencies
43 * @param path a path (unused)
44 * @param iter selected currency position
45 * @param data a `json *` with the JSON array to expand
46 */
47static void
48append_currency (GtkTreeModel *model,
49 GtkTreePath *path,
50 GtkTreeIter *iter,
51 gpointer data)
52{
53 json_t *currencies = data;
54 gchar *currency;
55
56 (void) path;
57 gtk_tree_model_get (model,
58 iter,
59 AG_CMC_CURRENCY_NAME,
60 &currency,
61 -1);
62 GNUNET_break (0 ==
63 json_array_append_new (currencies,
64 json_string (currency)));
65 g_free (currency);
66}
67
68
69/**
70 * The user selected the 'forward' button. Move on with the 39 * The user selected the 'forward' button. Move on with the
71 * country and currency selection. 40 * country selection.
72 */ 41 */
73static void 42static void
74forward_country_selecting (void) 43forward_country_selecting (void)
@@ -80,7 +49,6 @@ forward_country_selecting (void)
80 gchar *country_name; 49 gchar *country_name;
81 gchar *country_code; 50 gchar *country_code;
82 json_t *arguments; 51 json_t *arguments;
83 json_t *currencies;
84 52
85 tv = GTK_TREE_VIEW (GCG_get_main_window_object ( 53 tv = GTK_TREE_VIEW (GCG_get_main_window_object (
86 "anastasis_gtk_country_treeview")); 54 "anastasis_gtk_country_treeview"));
@@ -92,13 +60,6 @@ forward_country_selecting (void)
92 GNUNET_break (0); 60 GNUNET_break (0);
93 return; 61 return;
94 } 62 }
95 currencies = json_array ();
96 GNUNET_assert (NULL != currencies);
97 gtk_tree_selection_selected_foreach (
98 GTK_TREE_SELECTION (
99 GCG_get_main_window_object ("anastasis_gtk_currency_selection")),
100 &append_currency,
101 currencies);
102 gtk_tree_model_get (model, 63 gtk_tree_model_get (model,
103 &iter, 64 &iter,
104 AG_CCMC_COUNTRY_NAME, &country_name, 65 AG_CCMC_COUNTRY_NAME, &country_name,
@@ -108,9 +69,7 @@ forward_country_selecting (void)
108 GNUNET_JSON_pack_string ("country", 69 GNUNET_JSON_pack_string ("country",
109 country_name), 70 country_name),
110 GNUNET_JSON_pack_string ("country_code", 71 GNUNET_JSON_pack_string ("country_code",
111 country_code), 72 country_code));
112 GNUNET_JSON_pack_array_steal ("currencies",
113 currencies));
114 g_free (country_name); 73 g_free (country_name);
115 g_free (country_code); 74 g_free (country_code);
116 AG_freeze (); 75 AG_freeze ();
@@ -449,13 +408,9 @@ forward_secret_selecting (void)
449 gchar *secret_name; 408 gchar *secret_name;
450 gint version; 409 gint version;
451 gint mask; 410 gint mask;
411 const json_t *providers;
452 412
453 AG_freeze (); 413 AG_freeze ();
454 if (NULL != AG_pd)
455 {
456 ANASTASIS_policy_discovery_stop (AG_pd);
457 AG_pd = NULL;
458 }
459 AG_stop_long_action (); 414 AG_stop_long_action ();
460 selection = GTK_TREE_SELECTION ( 415 selection = GTK_TREE_SELECTION (
461 GCG_get_main_window_object ( 416 GCG_get_main_window_object (
@@ -475,41 +430,26 @@ forward_secret_selecting (void)
475 AG_SSMC_POLICY_VERSION, &version, 430 AG_SSMC_POLICY_VERSION, &version,
476 AG_SSMC_ATTRIBUTE_MASK, &mask, 431 AG_SSMC_ATTRIBUTE_MASK, &mask,
477 AG_SSMC_SECRET_NAME, &secret_name, 432 AG_SSMC_SECRET_NAME, &secret_name,
433 AG_SSMC_POLICY_PROVIDER_JSON, &providers,
478 -1); 434 -1);
479 { 435 args = GNUNET_JSON_PACK (
480 json_t *providers; 436 GNUNET_JSON_pack_array_incref ("providers",
481 437 (json_t *) providers),
482 providers = json_array (); 438 GNUNET_JSON_pack_uint64 ("attribute_mask",
483 /* FIXME #7221: should build array with _all_ providers 439 mask),
484 that provide the same policy here, instead of 440 GNUNET_JSON_pack_string ("secret_name",
485 just picking one of them... 441 secret_name));
486 => requires change in tree model or different
487 lookup. */
488 GNUNET_assert (NULL != providers);
489 GNUNET_assert (
490 0 ==
491 json_array_append (
492 providers,
493 GNUNET_JSON_PACK (
494 GNUNET_JSON_pack_string ("url",
495 provider_url),
496 GNUNET_JSON_pack_uint64 ("version",
497 version))));
498 args = GNUNET_JSON_PACK (
499 GNUNET_JSON_pack_array_steal ("providers",
500 providers),
501 GNUNET_JSON_pack_uint64 ("attribute_mask",
502 mask),
503 GNUNET_JSON_pack_string ("secret_name",
504 secret_name)
505 );
506 }
507 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 442 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
508 "Proceeding with policy version %u at provider %s\n", 443 "Proceeding with policy version %u at provider %s\n",
509 (unsigned int) version, 444 (unsigned int) version,
510 provider_url); 445 provider_url);
511 g_free (provider_url); 446 g_free (provider_url);
512 g_free (secret_name); 447 g_free (secret_name);
448 if (NULL != AG_pd)
449 {
450 ANASTASIS_policy_discovery_stop (AG_pd);
451 AG_pd = NULL;
452 }
513 AG_ra = ANASTASIS_redux_action (AG_redux_state, 453 AG_ra = ANASTASIS_redux_action (AG_redux_state,
514 "select_version", 454 "select_version",
515 args, 455 args,