summaryrefslogtreecommitdiff
path: root/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c')
-rw-r--r--src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c b/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
index 02da9d5..9b83813 100644
--- a/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
+++ b/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
@@ -314,7 +314,7 @@ url_add_button_clicked_cb (GtkButton *button,
-1,
AG_PMC_PROVIDER_URL, url,
AG_PMC_PROVIDER_STATUS, _ ("new"),
- AG_PMC_PROVIDER_STATUS_COLOR, "yellow",
+ AG_PMC_PROVIDER_STATUS_COLOR, "blue",
AG_PMC_PROVIDER_ENABLED, true,
AG_PMC_PROVIDER_SENSITIVE, false,
AG_PMC_PROVIDER_NOT_SENSITIVE, true,
@@ -363,8 +363,7 @@ edit_provider_dialog_response_cb (GtkDialog *dialog,
GtkBuilder *builder = GTK_BUILDER (user_data);
GtkTreeModel *tm;
GtkTreeIter iter;
- const json_t *providers;
- json_t *urls;
+ json_t *args;
if (GTK_RESPONSE_APPLY != response_id)
{
@@ -379,9 +378,7 @@ edit_provider_dialog_response_cb (GtkDialog *dialog,
GNUNET_break (0);
return;
}
- providers = json_object_get (AG_redux_state,
- "authentication_providers");
- urls = json_array ();
+ args = json_object ();
if (gtk_tree_model_get_iter_first (tm,
&iter))
do {
@@ -393,34 +390,26 @@ edit_provider_dialog_response_cb (GtkDialog *dialog,
AG_PMC_PROVIDER_URL, &url,
AG_PMC_PROVIDER_ENABLED, &enabled,
-1);
- if (NULL == json_object_get (providers,
- url))
- {
- // FIXME: store enabled status in JSON state!
- GNUNET_assert (0 ==
- json_array_append_new (urls,
- json_string (url)));
- }
+ GNUNET_assert (0 ==
+ json_object_set_new (
+ args,
+ url,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_bool ("disabled",
+ ! enabled))));
g_free (url);
}
while (gtk_tree_model_iter_next (tm,
&iter));
gtk_widget_destroy (GTK_WIDGET (dialog));
g_object_unref (G_OBJECT (builder));
- {
- json_t *args;
-
- args = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_array_steal ("urls",
- urls));
- AG_freeze ();
- AG_ra = ANASTASIS_redux_action (AG_redux_state,
- "add_provider",
- args,
- &AG_action_cb,
- NULL);
- json_decref (args);
- }
+ AG_freeze ();
+ AG_ra = ANASTASIS_redux_action (AG_redux_state,
+ "add_provider",
+ args,
+ &AG_action_cb,
+ NULL);
+ json_decref (args);
}
@@ -458,11 +447,14 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object,
uint32_t http_code;
uint32_t ec;
struct TALER_Amount ll;
+ bool disabled = false;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
&http_code)),
- // FIXME: check: right fieldname?
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_bool ("disabled",
+ &disabled)),
GNUNET_JSON_spec_mark_optional (
TALER_JSON_spec_amount_any ("liability_limit",
&ll)),
@@ -490,7 +482,8 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object,
JSON_INDENT (2));
continue;
}
- if (MHD_HTTP_OK == http_code)
+ if ( (MHD_HTTP_OK == http_code) &&
+ (! disabled) )
{
status = GNUNET_strdup (_ ("available"));
color = "green";
@@ -501,7 +494,8 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object,
else
GNUNET_break (0);
}
- else if (0 == http_code)
+ else if ( (0 == http_code) &&
+ (! disabled) )
{
GNUNET_asprintf (&status,
_ ("Network failure: %s (#%u)"),
@@ -509,6 +503,13 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object,
(unsigned int) ec);
color = "red";
}
+ else if (disabled)
+ {
+ GNUNET_asprintf (&status,
+ _ ("disabled"));
+ color = "blue";
+ sensitive = true;
+ }
else
{
GNUNET_asprintf (&status,
@@ -527,7 +528,7 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object,
AG_PMC_PROVIDER_STATUS, status,
AG_PMC_PROVIDER_STATUS_COLOR, color,
AG_PMC_PROVIDER_LIABILITY_LIMIT, ll_s,
- AG_PMC_PROVIDER_ENABLED, sensitive, // FIXME: store active/inactive status in JSON state!
+ AG_PMC_PROVIDER_ENABLED, ! disabled,
AG_PMC_PROVIDER_SENSITIVE, sensitive,
AG_PMC_PROVIDER_NOT_SENSITIVE, ! sensitive,
-1);