diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-04-14 18:59:54 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-04-14 18:59:54 +0200 |
commit | 279947b91c082111940468689f6218cebfdd31e6 (patch) | |
tree | 510a653ca45ba413e8b9df3e6b96f26e838bf226 /src/anastasis | |
parent | 6febff295d9ac37c79a7613242b0811dde763519 (diff) | |
download | anastasis-gtk-279947b91c082111940468689f6218cebfdd31e6.tar.gz anastasis-gtk-279947b91c082111940468689f6218cebfdd31e6.tar.bz2 anastasis-gtk-279947b91c082111940468689f6218cebfdd31e6.zip |
-remove currency-based provider selection
Diffstat (limited to 'src/anastasis')
-rw-r--r-- | src/anastasis/Makefile.am | 1 | ||||
-rw-r--r-- | src/anastasis/anastasis-gtk_handle-add-provider.c | 2 | ||||
-rw-r--r-- | src/anastasis/anastasis-gtk_handle-country-activated.c | 60 | ||||
-rw-r--r-- | src/anastasis/anastasis-gtk_handle-currency-changed.c | 78 | ||||
-rw-r--r-- | src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c | 45 |
5 files changed, 2 insertions, 184 deletions
diff --git a/src/anastasis/Makefile.am b/src/anastasis/Makefile.am index 0d658f4..5497721 100644 --- a/src/anastasis/Makefile.am +++ b/src/anastasis/Makefile.am @@ -29,7 +29,6 @@ anastasis_gtk_SOURCES = \ anastasis-gtk_handle-continent-selected.c \ anastasis-gtk_handle-country-activated.c \ anastasis-gtk_handle-country-unselected.c \ - anastasis-gtk_handle-currency-changed.c \ anastasis-gtk_handle-core-secret-changed.c \ anastasis-gtk_handle-core-secret-name-changed.c \ anastasis-gtk_handle-expiration-change.c \ diff --git a/src/anastasis/anastasis-gtk_handle-add-provider.c b/src/anastasis/anastasis-gtk_handle-add-provider.c index 37413d9..d75e77b 100644 --- a/src/anastasis/anastasis-gtk_handle-add-provider.c +++ b/src/anastasis/anastasis-gtk_handle-add-provider.c @@ -107,8 +107,6 @@ config_cb (void *cls, &acfg->truth_upload_fee), TALER_JSON_pack_amount ("liability_limit", &acfg->liability_limit), - GNUNET_JSON_pack_string ("currency", - acfg->currency), GNUNET_JSON_pack_string ("business_name", acfg->business_name), GNUNET_JSON_pack_uint64 ("storage_limit_in_megabytes", diff --git a/src/anastasis/anastasis-gtk_handle-country-activated.c b/src/anastasis/anastasis-gtk_handle-country-activated.c index 2c80b61..afb65f3 100644 --- a/src/anastasis/anastasis-gtk_handle-country-activated.c +++ b/src/anastasis/anastasis-gtk_handle-country-activated.c @@ -41,11 +41,8 @@ void anastasis_gtk_country_selection_changed_cb (GtkTreeSelection *treeselection, gpointer user_data) { - GtkTreeSelection *currency_selection; - GtkTreeModel *currency_model; GtkTreeModel *model; GtkTreeIter iter; - char *scode; (void) user_data; if (! gtk_tree_selection_get_selected (treeselection, @@ -56,61 +53,4 @@ anastasis_gtk_country_selection_changed_cb (GtkTreeSelection *treeselection, return; } AG_enable_next (); - gtk_tree_model_get (model, - &iter, - AG_CCMC_COUNTRY_CODE, - &scode, - -1); - /* select all currencies matching current country */ - currency_selection = GTK_TREE_SELECTION ( - GCG_get_main_window_object ("anastasis_gtk_currency_selection")); - gtk_tree_selection_unselect_all (currency_selection); - currency_model = GTK_TREE_MODEL ( - GCG_get_main_window_object ("currency_liststore")); - { - json_t *countries; - json_t *country; - size_t index; - - countries = json_object_get (AG_redux_state, - "countries"); - json_array_foreach (countries, index, country) - { - const char *code; - const char *currency; - - code = json_string_value (json_object_get (country, - "code")); - GNUNET_assert (NULL != code); - if (0 != strcmp (code, - scode)) - continue; - currency = json_string_value (json_object_get (country, - "currency")); - GNUNET_assert (NULL != currency); - { - GtkTreeIter citer; - char *pcur; - - if (gtk_tree_model_get_iter_first (currency_model, - &citer)) - do { - gtk_tree_model_get (currency_model, - &citer, - AG_CMC_CURRENCY_NAME, - &pcur, - -1); - if (0 == strcasecmp (pcur, - currency)) - { - gtk_tree_selection_select_iter (currency_selection, - &citer); - } - g_free (pcur); - } while (gtk_tree_model_iter_next (currency_model, - &citer)); - } - } - } - g_free (scode); } diff --git a/src/anastasis/anastasis-gtk_handle-currency-changed.c b/src/anastasis/anastasis-gtk_handle-currency-changed.c deleted file mode 100644 index ba38b6f..0000000 --- a/src/anastasis/anastasis-gtk_handle-currency-changed.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - This file is part of anastasis-gtk. - Copyright (C) 2021 Anastasis SARL - - Anastasis is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. - - Anastasis is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Anastasis; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -/** - * @file src/anastasis/anastasis-gtk_handle-country-activated.c - * @brief - * @author Christian Grothoff - * @author Dennis Neufeld - */ -#include <gnunet/platform.h> -#include <gnunet/gnunet_util_lib.h> -#include "anastasis-gtk_helper.h" -#include "anastasis-gtk_action.h" -#include "anastasis-gtk_handle-main-window-forward-clicked.h" -#include <jansson.h> - - -/** - * Function called on each selected item. - * Sets @a data to true if called. - * - * @param model unused - * @param path unused - * @param iter unused - * @param[out] data pointer to a `bool` to set to true - */ -static void -select_cb (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer data) -{ - bool *ptr = data; - - (void) model; - (void) path; - (void) iter; - *ptr = true; -} - - -/** - * Callback invoked if the currency selection changed. - * - * @param treeselection selection object - * @param user_data NULL - */ -void -anastasis_gtk_currency_selection_changed_cb (GtkTreeSelection *treeselection, - gpointer user_data) -{ - bool have_sel = false; - - (void) user_data; - gtk_tree_selection_selected_foreach (treeselection, - &select_cb, - &have_sel); - if (have_sel) - AG_enable_next (); - else - AG_insensitive ("anastasis_gtk_main_window_forward_button"); -} 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 de25cff..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 @@ /** - * Function called on each selected currency. Appends - * the currency to the JSON array. - * - * @param model the model of the currencies - * @param path a path (unused) - * @param iter selected currency position - * @param data a `json *` with the JSON array to expand - */ -static void -append_currency (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer data) -{ - json_t *currencies = data; - gchar *currency; - - (void) path; - gtk_tree_model_get (model, - iter, - AG_CMC_CURRENCY_NAME, - ¤cy, - -1); - GNUNET_break (0 == - json_array_append_new (currencies, - json_string (currency))); - g_free (currency); -} - - -/** * The user selected the 'forward' button. Move on with the - * country and currency selection. + * country selection. */ static void forward_country_selecting (void) @@ -80,7 +49,6 @@ forward_country_selecting (void) gchar *country_name; gchar *country_code; json_t *arguments; - json_t *currencies; tv = GTK_TREE_VIEW (GCG_get_main_window_object ( "anastasis_gtk_country_treeview")); @@ -92,13 +60,6 @@ forward_country_selecting (void) GNUNET_break (0); return; } - currencies = json_array (); - GNUNET_assert (NULL != currencies); - gtk_tree_selection_selected_foreach ( - GTK_TREE_SELECTION ( - GCG_get_main_window_object ("anastasis_gtk_currency_selection")), - &append_currency, - currencies); gtk_tree_model_get (model, &iter, AG_CCMC_COUNTRY_NAME, &country_name, @@ -108,9 +69,7 @@ forward_country_selecting (void) GNUNET_JSON_pack_string ("country", country_name), GNUNET_JSON_pack_string ("country_code", - country_code), - GNUNET_JSON_pack_array_steal ("currencies", - currencies)); + country_code)); g_free (country_name); g_free (country_code); AG_freeze (); |