gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis-gtk] branch master updated: finish policy editing logic


From: gnunet
Subject: [taler-anastasis-gtk] branch master updated: finish policy editing logic (untested)
Date: Sun, 04 Jul 2021 21:37:01 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository anastasis-gtk.

The following commit(s) were added to refs/heads/master by this push:
     new 850f06c  finish policy editing logic (untested)
850f06c is described below

commit 850f06c32a4c80a7a5cc0a76727f3d50b621792a
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Sun Jul 4 21:36:59 2021 +0200

    finish policy editing logic (untested)
---
 src/anastasis/anastasis-gtk_pe-edit-policy.c | 66 ++++++++++++++++++++++++++--
 1 file changed, 63 insertions(+), 3 deletions(-)

diff --git a/src/anastasis/anastasis-gtk_pe-edit-policy.c 
b/src/anastasis/anastasis-gtk_pe-edit-policy.c
index b24f194..f45c07e 100644
--- a/src/anastasis/anastasis-gtk_pe-edit-policy.c
+++ b/src/anastasis/anastasis-gtk_pe-edit-policy.c
@@ -123,10 +123,70 @@ anastasis_gtk_policy_edit_dialog_response_cb (
 
   if (GTK_RESPONSE_OK == response_id)
   {
-    // FIXME: extract selected challenges and update/create policy!
-    GNUNET_break (0);
+    json_t *policy;
+   
+    policy = json_array ();
+    GNUNET_assert (NULL != policy);
+    for (struct LineContext *lctx = edc->lc_head;
+        NULL != lctx;
+        lctx = lctx->next)
+    {
+      GtkTreeIter iter;
+      gchar *url;
+      
+      if (! lctx->on)
+       continue;
+      if (! gtk_combo_box_get_active_iter (lctx->cb,
+                                          &iter))
+      {
+       GNUNET_break (0);
+       continue;
+      }
+      gtk_tree_model_get (lctx->model,
+                         &iter,
+                         0, &url,
+                         -1);
+      GNUNET_break (0 ==
+                   json_array_append_new (policy,
+                                          json_pack ("{s:I, s:s}",
+                                                     "authentication_method",
+                                                     (json_int_t) lctx->cindex,
+                                                     "provider",
+                                                     url)));
+      g_free (url);
+    }
+    if (UINT_MAX == edc->pindex)
+    {
+      json_t *args;
+
+      args = json_pack ("{s:o}",
+                       "policy",
+                       (json_int_t) policy);
+      AG_ra = ANASTASIS_redux_action (AG_redux_state,
+                                     "add_policy",
+                                     args,
+                                     &AG_action_cb,
+                                     NULL);
+      json_decref (args);
+    }
+    else
+    {
+      json_t *args;
+
+      args = json_pack ("{s:I, s:o}",
+                       "policy_index",
+                       (json_int_t) edc->pindex,
+                       "policy",
+                       policy);
+      AG_ra = ANASTASIS_redux_action (AG_redux_state,
+                                     "update_policy",
+                                     args,
+                                     &AG_action_cb,
+                                     NULL);
+      json_decref (args);
+    }
   }
-
+  /* clean up */
   {
     struct LineContext *lctx;
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]