gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] 01/03: fix config api response handling


From: gnunet
Subject: [taler-anastasis-gtk] 01/03: fix config api response handling
Date: Mon, 28 Sep 2020 15:19:48 +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 fb6dfee77f8805e715a317c80da76be313241083
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Sun Sep 27 18:42:00 2020 +0200

    fix config api response handling
---
 src/anastasis/anastasis-gtk.c        |  17 ++-
 src/anastasis/anastasis-gtk_backup.c | 243 +++++++++++++++++++----------------
 src/anastasis/anastasis-gtk_helper.c |   6 +-
 src/include/anastasis-gtk_helper.h   |  16 ++-
 4 files changed, 156 insertions(+), 126 deletions(-)

diff --git a/src/anastasis/anastasis-gtk.c b/src/anastasis/anastasis-gtk.c
index 470d557..7c21f8f 100644
--- a/src/anastasis/anastasis-gtk.c
+++ b/src/anastasis/anastasis-gtk.c
@@ -27,7 +27,8 @@
 #include <gnunet/platform.h>
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet-gtk/gnunet_gtk.h>
-#include "anastasis-gtk_helper.h"
+#include <gtk/gtk.h>
+#include <anastasis-gtk/anastasis-gtk_helper.h>
 #include <jansson.h>
 
 /**
@@ -81,7 +82,7 @@ anastasis_gtk_animation_activate_cb (GtkMenuItem *menuitem,
           if (NULL == path)
           {
             GNUNET_break (0);
-            return GNUNET_SYSERR;
+            return;
           }
 
           //continent selection
@@ -319,7 +320,7 @@ void
 anastasis_gtk_main_window_back_clicked (GObject *object,
                                         gpointer user_data)
 {
-    char *state = json_string_value (json_object_get (redux_state, 
"backup-state"));
+    const char *state = json_string_value (json_object_get (redux_state, 
"backup-state"));
     if (!state)
         state = json_string_value (json_object_get (redux_state, 
"recovery-state"));
     GNUNET_assert (state);
@@ -404,7 +405,7 @@ anastasis_gtk_main_window_forward_clicked (GObject *object,
             bool isset = false;
             char *entry_widget;
             char *cal_widget;
-            char *widget = gtk_buildable_get_name (iter->data);
+            const char *widget = gtk_buildable_get_name (iter->data);
             json_t *id_attr = json_object ();
 
             GNUNET_asprintf (&entry_widget,
@@ -474,11 +475,13 @@ anastasis_gtk_main_window_forward_clicked (GObject 
*object,
     }
 
     //show backup policy frame, hide backup authentication methods frame
+    /**
     if (gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
-                                        
"anastasis_gtk_b_authentication_frame")))
+                                        
"anastasis_gtk_b_authentication_frame"))))
     {
-        
-    }
+        if (check_state (redux_state, "ReduxUserAttributesAddedState"))
+            init_b_policy (redux_state);
+    }*/
 }
 
 
diff --git a/src/anastasis/anastasis-gtk_backup.c 
b/src/anastasis/anastasis-gtk_backup.c
index 364e55c..4e7b3ed 100644
--- a/src/anastasis/anastasis-gtk_backup.c
+++ b/src/anastasis/anastasis-gtk_backup.c
@@ -28,7 +28,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet-gtk/gnunet_gtk.h>
 #include <gtk/gtk.h>
-#include "anastasis-gtk_helper.h"
+#include <anastasis-gtk/anastasis-gtk_helper.h>
 #include <jansson.h>
 
 
@@ -92,6 +92,11 @@ struct ConfigState
    * Reference to a ServerInfo.
    */
   struct ServerInfo *server;
+
+  /**
+   * Supported methods.
+   */
+  json_t *methods;
 };
 
 guint g_signal_question;
@@ -189,15 +194,15 @@ anastasis_gtk_b_question_dialog_btn_ok_clicked_cb 
(GObject *object,
           hbox = (GtkHBox *) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
      // set labels
      GtkLabel *label_prefix = (GtkLabel *) gtk_label_new ("Q: ");
-     gchar *question = gtk_entry_get_text (
+     const gchar *question = gtk_entry_get_text (
           GTK_ENTRY (GCG_get_main_window_object 
("anastasis_gtk_b_question_dialog_question_entry")));
      GtkLabel *label_question = (GtkLabel *) gtk_label_new (question);
-     gchar *answer = gtk_entry_get_text (
+     const gchar *answer = gtk_entry_get_text (
           GTK_ENTRY (GCG_get_main_window_object 
("anastasis_gtk_b_question_dialog_answer_entry")));
      GtkLabel *label_answer = (GtkLabel *) gtk_label_new (answer);
 
      // set buttons
-     GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_hbox_new(1, 0);
+     GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new(1, 0);
      GtkButton  *edit_btn = (GtkButton *) gtk_button_new_with_label ("edit");
      g_signal_connect (edit_btn, 
                        "clicked", 
@@ -208,17 +213,17 @@ anastasis_gtk_b_question_dialog_btn_ok_clicked_cb 
(GObject *object,
                        "clicked", 
                        G_CALLBACK 
(anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
                        hbox);
-     gtk_box_pack_start (buttons, edit_btn, 0, 0, 0);
-     gtk_box_pack_start (buttons, delete_btn, 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
      
-     gtk_box_pack_start (hbox, label_prefix, 0, 0, 0);
-     gtk_box_pack_start (hbox, label_question, 0, 0, 0);
-     gtk_box_pack_start (hbox, label_answer, 0, 0, 0);
-     gtk_box_pack_end (hbox, buttons, 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_question), 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_answer), 0, 0, 0);
+     gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
 
      if (! is_box)
      {
-          gtk_box_pack_start (vbox, hbox, 0, 0, 0);
+          gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
      }
 
      gtk_widget_show (GTK_WIDGET (hbox));
@@ -252,8 +257,8 @@ anastasis_gtk_btn_add_auth_question_clicked_cb (GObject 
*object,
 {
      gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
                                         "anastasis_gtk_b_question_dialog")));
-     GtkButton *ok_btn = GCG_get_main_window_object (
-                                        
"anastasis_gtk_b_question_dialog_btn_ok");
+     GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_question_dialog_btn_ok"));
      if (g_signal_question > 0)
           g_signal_handler_disconnect (ok_btn, g_signal_question);
      g_signal_question = g_signal_connect(ok_btn, 
@@ -308,24 +313,24 @@ anastasis_gtk_b_post_dialog_btn_ok_clicked_cb (GObject 
*object,
           hbox = (GtkHBox *) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
      // set labels
      GtkLabel *label_prefix = (GtkLabel *) gtk_label_new ("POST: ");
-     gchar *full_name = gtk_entry_get_text (
+     const gchar *full_name = gtk_entry_get_text (
           GTK_ENTRY (GCG_get_main_window_object 
("anastasis_gtk_b_post_dialog_full_name_entry")));
      GtkLabel *label_full_name = (GtkLabel *) gtk_label_new (full_name);
-     gchar *street = gtk_entry_get_text (
+     const gchar *street = gtk_entry_get_text (
           GTK_ENTRY (GCG_get_main_window_object 
("anastasis_gtk_b_post_dialog_street_entry")));
      GtkLabel *label_street = (GtkLabel *) gtk_label_new (street);
-     gchar *city = gtk_entry_get_text (
+     const gchar *city = gtk_entry_get_text (
           GTK_ENTRY (GCG_get_main_window_object 
("anastasis_gtk_b_post_dialog_city_entry")));
      GtkLabel *label_city = (GtkLabel *) gtk_label_new (city);
-     gchar *postcode = gtk_entry_get_text (
+     const gchar *postcode = gtk_entry_get_text (
           GTK_ENTRY (GCG_get_main_window_object 
("anastasis_gtk_b_post_dialog_postcode_entry")));
      GtkLabel *label_postcode = (GtkLabel *) gtk_label_new (postcode);
-     gchar *country = gtk_entry_get_text (
+     const gchar *country = gtk_entry_get_text (
           GTK_ENTRY (GCG_get_main_window_object 
("anastasis_gtk_b_post_dialog_country_entry")));
      GtkLabel *label_country = (GtkLabel *) gtk_label_new (country);
 
      // set buttons
-     GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_hbox_new(1, 0);
+     GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new(1, 0);
      GtkButton  *edit_btn = (GtkButton *) gtk_button_new_with_label ("edit");
      g_signal_connect (edit_btn, 
                        "clicked", 
@@ -336,20 +341,20 @@ anastasis_gtk_b_post_dialog_btn_ok_clicked_cb (GObject 
*object,
                        "clicked", 
                        G_CALLBACK 
(anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
                        hbox);
-     gtk_box_pack_start (buttons, edit_btn, 0, 0, 0);
-     gtk_box_pack_start (buttons, delete_btn, 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
      
-     gtk_box_pack_start (hbox, label_prefix, 0, 0, 0);
-     gtk_box_pack_start (hbox, label_full_name, 0, 0, 0);
-     gtk_box_pack_start (hbox, label_street, 0, 0, 0);
-     gtk_box_pack_start (hbox, label_city, 0, 0, 0);
-     gtk_box_pack_start (hbox, label_postcode, 0, 0, 0);
-     gtk_box_pack_start (hbox, label_country, 0, 0, 0);
-     gtk_box_pack_end (hbox, buttons, 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_full_name), 0, 0, 
0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_street), 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_city), 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_postcode), 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_country), 0, 0, 0);
+     gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
 
      if (! is_box)
      {
-          gtk_box_pack_start (vbox, hbox, 0, 0, 0);
+          gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
      }
 
      gtk_widget_show (GTK_WIDGET (hbox));
@@ -392,8 +397,8 @@ anastasis_gtk_btn_add_auth_post_clicked_cb (GObject *object,
 {
      gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
                                         "anastasis_gtk_b_post_dialog")));
-     GtkButton *ok_btn = GCG_get_main_window_object (
-                                        "anastasis_gtk_b_post_dialog_btn_ok");
+     GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+                                        "anastasis_gtk_b_post_dialog_btn_ok"));
      if (g_signal_post > 0)
           g_signal_handler_disconnect (ok_btn, g_signal_post);
      g_signal_post = g_signal_connect(ok_btn, 
@@ -454,12 +459,12 @@ anastasis_gtk_b_video_dialog_btn_ok_clicked_cb (GObject 
*object,
           hbox = (GtkHBox *) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
      // set labels
      GtkLabel *label_prefix = (GtkLabel *) gtk_label_new ("VIDEO: ");
-     gchar *photo_path = gtk_entry_get_text (
+     const gchar *photo_path = gtk_entry_get_text (
           GTK_ENTRY (GCG_get_main_window_object 
("anastasis_gtk_b_video_dialog_photo_path_entry")));
      GtkLabel *label_photo_path = (GtkLabel *) gtk_label_new (photo_path);
 
      // set buttons
-     GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_hbox_new(1, 0);
+     GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new(1, 0);
      GtkButton  *edit_btn = (GtkButton *) gtk_button_new_with_label ("edit");
      g_signal_connect (edit_btn, 
                        "clicked", 
@@ -470,16 +475,16 @@ anastasis_gtk_b_video_dialog_btn_ok_clicked_cb (GObject 
*object,
                        "clicked", 
                        G_CALLBACK 
(anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
                        hbox);
-     gtk_box_pack_start (buttons, edit_btn, 0, 0, 0);
-     gtk_box_pack_start (buttons, delete_btn, 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
      
-     gtk_box_pack_start (hbox, label_prefix, 0, 0, 0);
-     gtk_box_pack_start (hbox, label_photo_path, 0, 0, 0);
-     gtk_box_pack_end (hbox, buttons, 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_photo_path), 0, 0, 
0);
+     gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
 
      if (! is_box)
      {
-          gtk_box_pack_start (vbox, hbox, 0, 0, 0);
+          gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
      }
 
      gtk_widget_show (GTK_WIDGET (hbox));
@@ -510,8 +515,8 @@ anastasis_gtk_btn_add_auth_video_clicked_cb (GObject 
*object,
 {
      gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
                                         "anastasis_gtk_b_video_dialog")));
-     GtkButton *ok_btn = GCG_get_main_window_object (
-                                        "anastasis_gtk_b_video_dialog_btn_ok");
+     GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_video_dialog_btn_ok"));
      if (g_signal_video > 0)
           g_signal_handler_disconnect (ok_btn, g_signal_video);
      g_signal_video = g_signal_connect(ok_btn, 
@@ -564,12 +569,12 @@ anastasis_gtk_b_sms_dialog_btn_ok_clicked_cb (GObject 
*object,
           hbox = (GtkHBox *) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
      // set labels
      GtkLabel *label_prefix = (GtkLabel *) gtk_label_new ("SMS: ");
-     gchar *phonenumber = gtk_entry_get_text (
+     const gchar *phonenumber = gtk_entry_get_text (
           GTK_ENTRY (GCG_get_main_window_object 
("anastasis_gtk_b_sms_dialog_phonenumber_entry")));
      GtkLabel *label_phonenumber = (GtkLabel *) gtk_label_new (phonenumber);
 
      // set buttons
-     GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_hbox_new(1, 0);
+     GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new(1, 0);
      GtkButton  *edit_btn = (GtkButton *) gtk_button_new_with_label ("edit");
      g_signal_connect (edit_btn, 
                        "clicked", 
@@ -580,16 +585,16 @@ anastasis_gtk_b_sms_dialog_btn_ok_clicked_cb (GObject 
*object,
                        "clicked", 
                        G_CALLBACK 
(anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
                        hbox);
-     gtk_box_pack_start (buttons, edit_btn, 0, 0, 0);
-     gtk_box_pack_start (buttons, delete_btn, 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
      
-     gtk_box_pack_start (hbox, label_prefix, 0, 0, 0);
-     gtk_box_pack_start (hbox, label_phonenumber, 0, 0, 0);
-     gtk_box_pack_end (hbox, buttons, 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_phonenumber), 0, 0, 
0);
+     gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
 
      if (! is_box)
      {
-          gtk_box_pack_start (vbox, hbox, 0, 0, 0);
+          gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
      }
 
      gtk_widget_show (GTK_WIDGET (hbox));
@@ -620,8 +625,8 @@ anastasis_gtk_btn_add_auth_sms_clicked_cb (GObject *object,
 {
      gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
                                         "anastasis_gtk_b_sms_dialog")));
-     GtkButton *ok_btn = GCG_get_main_window_object (
-                                        "anastasis_gtk_b_sms_dialog_btn_ok");
+     GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+                                        "anastasis_gtk_b_sms_dialog_btn_ok"));
      if (g_signal_sms > 0)
           g_signal_handler_disconnect (ok_btn, g_signal_sms);
      g_signal_sms = g_signal_connect(ok_btn, 
@@ -674,12 +679,12 @@ anastasis_gtk_b_email_dialog_btn_ok_clicked_cb (GObject 
*object,
           hbox = (GtkHBox *) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
      // set labels
      GtkLabel *label_prefix = (GtkLabel *) gtk_label_new ("EMAIL: ");
-     gchar *mailaddress = gtk_entry_get_text (
+     const gchar *mailaddress = gtk_entry_get_text (
           GTK_ENTRY (GCG_get_main_window_object 
("anastasis_gtk_b_email_dialog_mailaddress_entry")));
      GtkLabel *label_mailaddress = (GtkLabel *) gtk_label_new (mailaddress);
 
      // set buttons
-     GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_hbox_new(1, 0);
+     GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new(1, 0);
      GtkButton  *edit_btn = (GtkButton *) gtk_button_new_with_label ("edit");
      g_signal_connect (edit_btn, 
                        "clicked", 
@@ -690,16 +695,16 @@ anastasis_gtk_b_email_dialog_btn_ok_clicked_cb (GObject 
*object,
                        "clicked", 
                        G_CALLBACK 
(anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
                        hbox);
-     gtk_box_pack_start (buttons, edit_btn, 0, 0, 0);
-     gtk_box_pack_start (buttons, delete_btn, 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
      
-     gtk_box_pack_start (hbox, label_prefix, 0, 0, 0);
-     gtk_box_pack_start (hbox, label_mailaddress, 0, 0, 0);
-     gtk_box_pack_end (hbox, buttons, 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
+     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_mailaddress), 0, 0, 
0);
+     gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
 
      if (! is_box)
      {
-          gtk_box_pack_start (vbox, hbox, 0, 0, 0);
+          gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
      }
 
      gtk_widget_show (GTK_WIDGET (hbox));
@@ -730,8 +735,8 @@ anastasis_gtk_btn_add_auth_email_clicked_cb (GObject 
*object,
 {
      gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
                                         "anastasis_gtk_b_email_dialog")));
-     GtkButton *ok_btn = GCG_get_main_window_object (
-                                        "anastasis_gtk_b_email_dialog_btn_ok");
+     GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_email_dialog_btn_ok"));
      if (g_signal_email > 0)
           g_signal_handler_disconnect (ok_btn, g_signal_email);
      g_signal_email = g_signal_connect(ok_btn, 
@@ -770,12 +775,12 @@ anastasis_gtk_b_auth_method_btn_edit_clicked_cb (GObject 
*object,
 {
      GList *children, *iter;
      children = gtk_container_get_children (GTK_CONTAINER (user_data));
-     char *type;
+     char *type = "";
      unsigned int index = 0;
      for (iter = children; iter != NULL; iter = g_list_next (iter))
      {
-          gchar *text;
-          gchar *widget_name = gtk_widget_get_name (GTK_WIDGET (iter->data));
+          const gchar *text = "";
+          const gchar *widget_name = gtk_widget_get_name (GTK_WIDGET 
(iter->data));
           if (0 == strcmp (widget_name, "GtkLabel"))
           {
                text = gtk_label_get_text (GTK_LABEL (iter->data));
@@ -801,8 +806,8 @@ anastasis_gtk_b_auth_method_btn_edit_clicked_cb (GObject 
*object,
                     {
                          gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
                                         
"anastasis_gtk_b_question_dialog_answer_entry")), text);
-                         GtkButton *ok_btn = GCG_get_main_window_object (
-                                        
"anastasis_gtk_b_question_dialog_btn_ok");
+                         GtkButton *ok_btn = GTK_BUTTON 
(GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_question_dialog_btn_ok"));
                          if (g_signal_question > 0)
                               g_signal_handler_disconnect (ok_btn, 
g_signal_question);
                          g_signal_question = g_signal_connect(ok_btn, 
@@ -822,8 +827,8 @@ anastasis_gtk_b_auth_method_btn_edit_clicked_cb (GObject 
*object,
                     {
                          gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
                                         
"anastasis_gtk_b_sms_dialog_phonenumber_entry")), text);
-                         GtkButton *ok_btn = GCG_get_main_window_object (
-                                        "anastasis_gtk_b_sms_dialog_btn_ok");
+                         GtkButton *ok_btn = GTK_BUTTON 
(GCG_get_main_window_object (
+                                        "anastasis_gtk_b_sms_dialog_btn_ok"));
                          if (g_signal_sms > 0)
                               g_signal_handler_disconnect (ok_btn, 
g_signal_sms);
                          g_signal_sms = g_signal_connect (ok_btn, 
@@ -842,8 +847,8 @@ anastasis_gtk_b_auth_method_btn_edit_clicked_cb (GObject 
*object,
                     {
                          gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
                                         
"anastasis_gtk_b_email_dialog_mailaddress_entry")), text);
-                         GtkButton *ok_btn = GCG_get_main_window_object (
-                                        "anastasis_gtk_b_email_dialog_btn_ok");
+                         GtkButton *ok_btn = GTK_BUTTON 
(GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_email_dialog_btn_ok"));
                          if (g_signal_email > 0)
                               g_signal_handler_disconnect (ok_btn, 
g_signal_email);
                          g_signal_email = g_signal_connect (ok_btn, 
@@ -874,8 +879,8 @@ anastasis_gtk_b_auth_method_btn_edit_clicked_cb (GObject 
*object,
                     {
                          gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
                                         
"anastasis_gtk_b_post_dialog_country_entry")), text);
-                         GtkButton *ok_btn = GCG_get_main_window_object (
-                                        "anastasis_gtk_b_post_dialog_btn_ok");
+                         GtkButton *ok_btn = GTK_BUTTON 
(GCG_get_main_window_object (
+                                        "anastasis_gtk_b_post_dialog_btn_ok"));
                          if (g_signal_post > 0)
                               g_signal_handler_disconnect (ok_btn, 
g_signal_post);
                          g_signal_post = g_signal_connect (ok_btn, 
@@ -894,8 +899,8 @@ anastasis_gtk_b_auth_method_btn_edit_clicked_cb (GObject 
*object,
                     {
                          gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
                                         
"anastasis_gtk_b_video_dialog_photo_path_entry")), text);
-                         GtkButton *ok_btn = GCG_get_main_window_object (
-                                        "anastasis_gtk_b_video_dialog_btn_ok");
+                         GtkButton *ok_btn = GTK_BUTTON 
(GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_video_dialog_btn_ok"));
                          if (g_signal_video > 0)
                               g_signal_handler_disconnect (ok_btn, 
g_signal_video);
                          g_signal_video = g_signal_connect (ok_btn, 
@@ -922,21 +927,21 @@ anastasis_gtk_b_auth_method_btn_edit_clicked_cb (GObject 
*object,
  * @param http_status HTTP status of the request
  * @param methods supported methods by this provider
  * @param annual_fee Annual fee of this service
- * @param question_cost Cost for authentication by question
  */
 static void
 config_cb (void *cls,
            unsigned int http_status,
-           const char *methods,
+           const json_t *methods,
            const char *conf_currency,
-           const struct TALER_Amount *annual_fee,
-           const struct TALER_Amount *question_cost)
+           const struct TALER_Amount *annual_fee)
 {
-     json_t *auth_method = json_object ();
+     json_t *method;
+     size_t index;
      struct ConfigState *cs = cls;
+     json_t *method_arr = json_object_get (methods, "methods");
 
      cs->co = NULL;
-     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                "At %s:%d url is %s\n", __FILE__, __LINE__,
                cs->server->backend_url);
      if (http_status != cs->http_status)
@@ -948,52 +953,64 @@ config_cb (void *cls,
                          __LINE__);
           //return;
      }
-     if (NULL != strstr (methods, "question"))
-     {
-          gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
-                                        
"anastasis_gtk_btn_add_auth_question")));
-     }
-     if (NULL != strstr (methods, "sms"))
-     {
-          gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
-                                        "anastasis_gtk_btn_add_auth_sms")));
-     }
-     if (NULL != strstr (methods, "email"))
-     {
-          gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
-                                        "anastasis_gtk_btn_add_auth_email")));
-     }
-     if (NULL != strstr (methods, "video"))
-     {
-          gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
-                                        "anastasis_gtk_btn_add_auth_video")));
-     }
-     if (NULL != strstr (methods, "post"))
+     json_array_foreach (method_arr, index, method)
      {
-          gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
-                                        "anastasis_gtk_btn_add_auth_post")));
+          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)));
+          }
      }
 }
 
 
 /**
- * Initialize the auhentication methods.
+ * Initialize the auhentication methods in backup mode.
+ * 
+ * @param state the state to operate on
+ */
+void
+init_b_policy (json_t *state)
+{
+     json_t *arguments;
+     ANASTASIS_redux_action (state,
+                             "adding_authentication",
+                             arguments,
+                             &action_cb,
+                             NULL);
+}
+
+
+/**
+ * Initialize the auhentication methods in backup mode.
  * 
- * @param state the initial state to get the continents from
+ * @param state the state to operate on
  */
 void
-init_auth_methods (json_t *state)
+init_b_auth_methods (json_t *state)
 {
-    size_t index;
-    json_t *provider;
-    json_t *provider_list = json_object_get (state, "provider-list");
+     size_t index;
+     json_t *provider;
+     json_t *provider_list = json_object_get (state, "provider-list");
 
-    json_array_foreach (provider_list, index, provider)
-    {
+     json_array_foreach (provider_list, index, provider)
+     {
           struct ConfigState *cs = GNUNET_new (struct ConfigState);
+          struct ServerInfo *server = GNUNET_new (struct ServerInfo);
           const char *url = json_string_value (json_object_get (provider, 
"provider-url"));
           GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                      "Url is: %s\n", url);
+                    "Url is: %s\n", url);
+          server->backend_url = GNUNET_malloc (strlen (url));
+          GNUNET_strlcpy (server->backend_url,
+                          url,
+                          strlen (url));
+          cs->server = server;
           cs->http_status = MHD_HTTP_OK;
           cs->co = ANASTASIS_get_config (ctx,
                                          url,
@@ -1003,7 +1020,7 @@ init_auth_methods (json_t *state)
           {
           /** FIXME: Error handling */
           }
-    }
+     }
 }
 
 
diff --git a/src/anastasis/anastasis-gtk_helper.c 
b/src/anastasis/anastasis-gtk_helper.c
index 4eb0788..3df08af 100644
--- a/src/anastasis/anastasis-gtk_helper.c
+++ b/src/anastasis/anastasis-gtk_helper.c
@@ -28,7 +28,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet-gtk/gnunet_gtk.h>
 #include <gtk/gtk.h>
-#include "anastasis-gtk_helper.h"
+#include <anastasis-gtk/anastasis-gtk_helper.h>
 #include <jansson.h>
 
 
@@ -187,9 +187,9 @@ action_cb (void *cls,
         {
             if (json_object_get (redux_state, "backup-state"))
             {
-                init_auth_methods (redux_state);
                 gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
                                         
"anastasis_gtk_b_authentication_frame")));
+                init_b_auth_methods (redux_state);
                 gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
                                                 
"anastasis_gtk_b_authentication_methods_image")));
             }
@@ -309,7 +309,7 @@ init_id_attr (json_t *state,
     {
         const char *widget_name = json_string_value (json_object_get (id_attr, 
"widget"));
         const char *attr_type = json_string_value (json_object_get (id_attr, 
"type"));
-        const char *attr_name = json_string_value (json_object_get (id_attr, 
"name"));
+        //const char *attr_name = json_string_value (json_object_get (id_attr, 
"name"));
         const char *attr_label = json_string_value (json_object_get (id_attr, 
"label"));
         
         if (widget_name)
diff --git a/src/include/anastasis-gtk_helper.h 
b/src/include/anastasis-gtk_helper.h
index c1f384f..7bcd44e 100644
--- a/src/include/anastasis-gtk_helper.h
+++ b/src/include/anastasis-gtk_helper.h
@@ -26,6 +26,7 @@
  */
 
 #include <gnunet-gtk/gnunet_gtk.h>
+#include <gtk/gtk.h>
 #include <anastasis/anastasis_service.h>
 #include <anastasis/anastasis_redux.h>
 
@@ -140,12 +141,21 @@ init_id_attr (json_t *state,
 
 
 /**
- * Initialize the auhentication methods.
+ * Initialize the auhentication methods in backup mode.
  * 
- * @param state the initial state to get the continents from
+ * @param state the state to operate on
  */
 void
-init_auth_methods (json_t *state);
+init_b_auth_methods (json_t *state);
+
+
+/**
+ * Initialize the policies in backup mode.
+ * 
+ * @param state the state to operate on
+ */
+void
+init_b_policy (json_t *state);
 
 
 /**

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