gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] 04/05: fix method deletion


From: gnunet
Subject: [taler-anastasis-gtk] 04/05: fix method deletion
Date: Mon, 12 Oct 2020 20:34:59 +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.

commit ca10218a7a5ac7520cb36fb008e9c801450e28f4
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Mon Oct 12 16:15:01 2020 +0200

    fix method deletion
---
 src/anastasis/anastasis-gtk_backup.c | 50 +++++++++++++++++++++++++++---------
 1 file changed, 38 insertions(+), 12 deletions(-)

diff --git a/src/anastasis/anastasis-gtk_backup.c 
b/src/anastasis/anastasis-gtk_backup.c
index 54bba20..27d8f7e 100644
--- a/src/anastasis/anastasis-gtk_backup.c
+++ b/src/anastasis/anastasis-gtk_backup.c
@@ -109,22 +109,47 @@ anastasis_gtk_b_auth_method_btn_delete_clicked_cb 
(GObject *object,
           // parse state to delete method
           if (NULL != user_data_children)
           {
+               const gchar *label;
+               json_t *arguments = json_object ();
+               GNUNET_assert (NULL != arguments);
+               json_t *method = json_object ();
+               GNUNET_assert (NULL != method);
+               json_t *value = json_object ();
+               GNUNET_assert (NULL != value);
                unsigned int index = 0;
 
-               for (iter = user_data_children; iter != NULL; iter = 
g_list_next (iter)){
+               for (iter = user_data_children; iter != NULL; iter = 
g_list_next (iter))
+               {
                     if (GTK_IS_LABEL (iter->data))
                     {
+                         label= gtk_label_get_text (GTK_LABEL (iter->data));
+
                          if (index == 0)
                          {
-                              index++;
-                              continue;
+                              char *method_type = NULL;
+                              if (0 == strcmp ("Q: ", label))
+                                    method_type = "question";
+                              if (0 == strcmp ("SMS: ", label))
+                                   method_type = "sms";
+                              if (0 == strcmp ("VIDEO: ", label))
+                                   method_type = "video";
+                              if (0 == strcmp ("POST: ", label))
+                                   method_type = "post";
+                              if (0 == strcmp ("EMAIL: ", label))
+                                   method_type = "email";
+
+                              GNUNET_assert (0 == json_object_set_new (method,
+                                                                       
"method",
+                                                                       
json_string (method_type)));
                          }
                          if (index == 1)
                          {
-                              const gchar *label = gtk_label_get_text 
(GTK_LABEL (iter->data));
-                              json_t *arguments = json_string (label);
-
-                              GNUNET_assert (NULL != arguments);
+                              GNUNET_assert (0 == json_object_set_new (method,
+                                                                       "value",
+                                                                       
json_string (label)));
+                              GNUNET_assert (0 == json_object_set_new 
(arguments,
+                                                                       
"authentication_method",
+                                                                       
method));
                               ANASTASIS_redux_action (redux_state,
                                                       "delete_authentication",
                                                       arguments,
@@ -133,6 +158,7 @@ anastasis_gtk_b_auth_method_btn_delete_clicked_cb (GObject 
*object,
                                                       NULL);
                               break;
                          }
+                         index++;
                     }
                }
           }
@@ -190,11 +216,11 @@ anastasis_gtk_b_question_dialog_btn_ok_clicked_cb 
(GObject *object,
           json_t *auth_method = json_object ();
           json_t *method_data = json_object ();
 
-          json_object_set_new (auth_method, "method", json_string 
("question"));
-          json_object_set_new (method_data, "question", json_string 
(question));
-          json_object_set_new (method_data, "answer", json_string (answer));
-          json_object_set_new (auth_method, "data", method_data);
-          json_object_set_new (arguments, "authentication_method", 
method_data);
+          GNUNET_assert (0 == json_object_set_new (auth_method, "method", 
json_string ("question")));
+          GNUNET_assert (0 == json_object_set_new (method_data, "question", 
json_string (question)));
+          GNUNET_assert (0 == json_object_set_new (method_data, "answer", 
json_string (answer)));
+          GNUNET_assert (0 == json_object_set_new (auth_method, "data", 
method_data));
+          GNUNET_assert (0 ==  json_object_set_new (arguments, 
"authentication_method", auth_method));
 
           ANASTASIS_redux_action (redux_state,
                                   "add_authentication",

-- 
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]