[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis-gtk] branch master updated: moved config request to red
From: |
gnunet |
Subject: |
[taler-anastasis-gtk] branch master updated: moved config request to reducer |
Date: |
Fri, 09 Oct 2020 20:44:06 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis-gtk.
The following commit(s) were added to refs/heads/master by this push:
new 0fe38b6 moved config request to reducer
0fe38b6 is described below
commit 0fe38b6f4fd836694d5d41d01ad6407da46c594e
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Fri Oct 9 19:31:56 2020 +0200
moved config request to reducer
---
src/anastasis/anastasis-gtk.c | 14 +--
src/anastasis/anastasis-gtk_backup.c | 225 +----------------------------------
2 files changed, 13 insertions(+), 226 deletions(-)
diff --git a/src/anastasis/anastasis-gtk.c b/src/anastasis/anastasis-gtk.c
index 8acb749..17a5fe7 100644
--- a/src/anastasis/anastasis-gtk.c
+++ b/src/anastasis/anastasis-gtk.c
@@ -243,6 +243,7 @@ anastasis_gtk_continent_activated (GtkTreeView *tree_view,
"select_continent",
arguments,
&action_cb,
+ NULL,
NULL);
g_free(continent_name);
}
@@ -291,13 +292,7 @@ anastasis_gtk_country_activated (GtkTreeView *tree_view,
"select_country",
arguments,
&action_cb,
- NULL);
-
- if (check_state (redux_state, UserAttributesCollectionState))
- ANASTASIS_redux_action (redux_state,
- "select_country",
- arguments,
- &action_cb,
+ ctx,
NULL);
g_free(country_name);
@@ -323,6 +318,7 @@ anastasis_gtk_continent_unselected (GtkTreeSelection
*selection,
"unselect_continent",
NULL,
&action_cb,
+ NULL,
NULL);
}
@@ -345,6 +341,7 @@ anastasis_gtk_country_unselected (GtkTreeSelection
*selection,
"unselect_country",
NULL,
&action_cb,
+ NULL,
NULL);
}
@@ -363,6 +360,7 @@ anastasis_gtk_main_window_back_clicked (GObject *object,
"back",
NULL,
&action_cb,
+ NULL,
NULL);
//show identity frame, hide authentication frame
if (check_state (redux_state, UserAttributesCollectionState) &&
@@ -462,6 +460,7 @@ anastasis_gtk_main_window_forward_clicked (GObject *object,
"enter_user_attributes",
arguments,
&action_cb,
+ NULL,
NULL);
gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
@@ -482,6 +481,7 @@ anastasis_gtk_main_window_forward_clicked (GObject *object,
"next",
NULL,
&action_cb,
+ NULL,
NULL);
}
}
diff --git a/src/anastasis/anastasis-gtk_backup.c
b/src/anastasis/anastasis-gtk_backup.c
index aebdfd4..485f1b6 100644
--- a/src/anastasis/anastasis-gtk_backup.c
+++ b/src/anastasis/anastasis-gtk_backup.c
@@ -31,83 +31,6 @@
#include <jansson.h>
-/**
- * Server information
- */
-struct ServerInfo
-{
- /**
- * URL of the anastasis backend.
- */
- char *backend_url;
-
- /**
- * id of the anastasis backend.
- */
- char *backend_id;
-
- /**
- * label of the anastasis backend.
- */
- char *backend_name;
-
- /**
- * currrency used by the anastasis backend.
- */
- char *backend_currency;
-
- /**
- * supported methods of the anastasis backend.
- */
- json_t *backend_methods;
-
- /**
- * insurance of the anastasis backend.
- */
- struct TALER_Amount backend_insurance;
-
- /**
- * cost of using the anastasis backend.
- */
- struct TALER_Amount backend_cost;
-};
-
-/**
- * State for a "get config" CMD.
- */
-struct ConfigState
-{
- /**
- * Expected status code.
- */
- unsigned int http_status;
-
- /**
- * The /config GET operation handle.
- */
- struct ANASTASIS_ConfigOperation *co;
-
- /**
- * Reference to a ServerInfo.
- */
- struct ServerInfo *server;
-
- /**
- * Supported methods.
- */
- json_t *methods;
-};
-
-/**
- * Information about the servers.
- */
-static struct ServerInfo *servers;
-
-/**
- * Amount of servers.
- */
-static unsigned int servers_length = 0;
-
guint g_signal_question;
guint g_signal_sms;
guint g_signal_email;
@@ -240,6 +163,7 @@ anastasis_gtk_b_question_dialog_btn_ok_clicked_cb (GObject
*object,
"add_authentication",
arguments,
&action_cb,
+ NULL,
NULL);
}
@@ -389,6 +313,7 @@ anastasis_gtk_b_post_dialog_btn_ok_clicked_cb (GObject
*object,
"add_authentication",
arguments,
&action_cb,
+ NULL,
NULL);
}
@@ -540,6 +465,7 @@ anastasis_gtk_b_video_dialog_btn_ok_clicked_cb (GObject
*object,
"add_authentication",
arguments,
&action_cb,
+ NULL,
NULL);
}
@@ -667,6 +593,7 @@ anastasis_gtk_b_sms_dialog_btn_ok_clicked_cb (GObject
*object,
"add_authentication",
arguments,
&action_cb,
+ NULL,
NULL);
}
@@ -794,6 +721,7 @@ anastasis_gtk_b_email_dialog_btn_ok_clicked_cb (GObject
*object,
"add_authentication",
arguments,
&action_cb,
+ NULL,
NULL);
}
@@ -1094,108 +1022,6 @@ anastasis_gtk_b_auth_method_btn_edit_clicked_cb
(GObject *object,
}
-/**
- * Function called with the results of a #ANASTASIS_get_config().
- *
- * @param cls closure
- * @param http_status HTTP status of the request
- * @param methods supported methods by this provider
- * @param annual_fee Annual fee of this service
- */
-static void
-config_cb (void *cls,
- unsigned int http_status,
- const json_t *methods,
- const char *conf_currency,
- const struct TALER_Amount *annual_fee)
-{
- json_t *method;
- json_t *method_arr;
- size_t index;
- struct ConfigState *cs = cls;
-
- cs->co = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "At %s:%d url is %s\n", __FILE__, __LINE__,
- cs->server->backend_url);
- if (http_status != cs->http_status)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u in %s:%u\n",
- http_status,
- __FILE__,
- __LINE__);
- return;
- }
-
- cs->server->backend_methods = methods;
- cs->server->backend_cost = *annual_fee;
- cs->server->backend_currency = GNUNET_malloc (strlen (conf_currency));
- GNUNET_strlcpy (cs->server->backend_currency,
- conf_currency,
- strlen (conf_currency));
- method_arr = json_object_get (methods, "methods");
- json_array_foreach (method_arr, index, method)
- {
- const char *method_str = json_string_value (
- json_object_get (method, "method"));
- if (method_str)
- {
- char *widget;
- GNUNET_asprintf (&widget,
- "anastasis_gtk_btn_add_auth_%s",
- method_str);
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- widget)));
-
- //fill up provider combo boxes of dialogs
- {
- if (0 == strcmp (method_str, "sms"))
- {
- GtkComboBoxText *cmb_dialog_sms_provider =
(GtkComboBoxText *) GCG_get_main_window_object (
- "anastasis_gtk_b_sms_dialog_provider");
- gtk_combo_box_text_append (cmb_dialog_sms_provider,
- NULL,
- cs->server->backend_id);
- }
- if (0 == strcmp (method_str, "email"))
- {
- GtkComboBoxText *cmb_dialog_email_provider =
(GtkComboBoxText *) GCG_get_main_window_object (
- "anastasis_gtk_b_email_dialog_provider");
- gtk_combo_box_text_append (cmb_dialog_email_provider,
- NULL,
- cs->server->backend_id);
- }
- if (0 == strcmp (method_str, "video"))
- {
- GtkComboBoxText *cmb_dialog_video_provider =
(GtkComboBoxText *) GCG_get_main_window_object (
- "anastasis_gtk_b_video_dialog_provider");
- gtk_combo_box_text_append (cmb_dialog_video_provider,
- NULL,
- cs->server->backend_id);
- }
- if (0 == strcmp (method_str, "post"))
- {
- GtkComboBoxText *cmb_dialog_post_provider =
(GtkComboBoxText *) GCG_get_main_window_object (
- "anastasis_gtk_b_post_dialog_provider");
- gtk_combo_box_text_append (cmb_dialog_post_provider,
- NULL,
- cs->server->backend_id);
- }
- if (0 == strcmp (method_str, "question"))
- {
- GtkComboBoxText *cmb_dialog_question_provider =
(GtkComboBoxText *) GCG_get_main_window_object (
- "anastasis_gtk_b_question_dialog_provider");
- gtk_combo_box_text_append
(cmb_dialog_question_provider,
- NULL,
- cs->server->backend_id);
- }
- }
- }
- }
-}
-
-
/**
* Prepare authentication methods for policy generation.
*
@@ -1321,46 +1147,7 @@ init_b_policy (json_t *state)
void
init_b_auth_methods (json_t *state)
{
- size_t index;
- json_t *provider;
- json_t *provider_list = json_object_get (state, "provider-list");
-
- json_array_foreach (provider_list, index, provider)
- {
- struct ServerInfo *server = GNUNET_new (struct ServerInfo);
- const char *url = json_string_value (json_object_get (provider,
"provider-url"));
- const char *provider_name = json_string_value (json_object_get
(provider, "provider-name"));
- const char *provider_id = json_string_value (json_object_get
(provider, "provider-id"));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Url is: %s\n", url);
- server->backend_url = GNUNET_malloc (strlen (url) + 1);
- GNUNET_strlcpy (server->backend_url,
- url,
- strlen (url) + 1);
- server->backend_name = GNUNET_malloc (strlen (provider_name) + 1);
- GNUNET_strlcpy (server->backend_name,
- provider_name,
- strlen (provider_name) + 1);
- server->backend_id = GNUNET_malloc (strlen (provider_id) + 1);
- GNUNET_strlcpy (server->backend_id,
- provider_id,
- strlen (provider_id) + 1);
- GNUNET_array_append (servers, servers_length, *server);
- }
- for (unsigned int i = 0; i < servers_length; i++)
- {
- struct ConfigState *cs = GNUNET_new (struct ConfigState);
- cs->server = &servers[i];
- cs->http_status = MHD_HTTP_OK;
- cs->co = ANASTASIS_get_config (ctx,
- servers[i].backend_url,
- config_cb,
- cs);
- if (NULL == cs->co)
- {
- /** FIXME: Error handling */
- }
- }
+
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis-gtk] branch master updated: moved config request to reducer,
gnunet <=