gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] 02/02: fix get_config


From: gnunet
Subject: [taler-anastasis-gtk] 02/02: fix get_config
Date: Sun, 18 Oct 2020 20:49:45 +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 46a7a69b9841dfd21d4910aeda0b1768147998f5
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Sun Oct 18 20:49:31 2020 +0200

    fix get_config
---
 src/anastasis/anastasis-gtk.c        | 104 ++++++++++++++++++++---------------
 src/anastasis/anastasis-gtk_backup.c |  72 ++++++++++++------------
 src/anastasis/anastasis-gtk_helper.c |   2 +-
 src/include/anastasis-gtk_helper.h   |   5 ++
 4 files changed, 103 insertions(+), 80 deletions(-)

diff --git a/src/anastasis/anastasis-gtk.c b/src/anastasis/anastasis-gtk.c
index 58ce839..b57b902 100644
--- a/src/anastasis/anastasis-gtk.c
+++ b/src/anastasis/anastasis-gtk.c
@@ -49,6 +49,11 @@ struct GNUNET_CURL_RescheduleContext *rc;
  */
 struct GNUNET_CURL_Context *ctx;
 
+/**
+ * Handle to an ongoing action.
+ */
+struct ANASTASIS_ReduxAction *ra;
+
 /**
  * Actual state.
  */
@@ -239,12 +244,12 @@ anastasis_gtk_continent_activated (GtkTreeView *tree_view,
         gtk_tree_model_get (model, &iter, 0, &continent_name, -1);
         json_object_set (arguments, "continent", json_string (continent_name));
 
-        ANASTASIS_redux_action (redux_state,
-                                "select_continent",
-                                arguments,
-                                NULL,
-                                &action_cb,
-                                NULL);
+        ra = ANASTASIS_redux_action (redux_state,
+                                     "select_continent",
+                                     arguments,
+                                     NULL,
+                                     &action_cb,
+                                     NULL);
         g_free(continent_name);
     }
 }
@@ -290,15 +295,16 @@ anastasis_gtk_country_activated (GtkTreeView *tree_view,
             reset_authentication_providers ();
             if (check_state (redux_state, 
                              ANASTASIS_generic_state_to_string 
(ANASTASIS_GENERIC_STATE_COUNTRY_SELECTION)))
-                ANASTASIS_redux_action (redux_state,
-                                        "select_country",
-                                        arguments,
-                                        ctx,
-                                        &action_cb,
-                                        NULL);
-                
+                ra = ANASTASIS_redux_action (redux_state,
+                                             "select_country",
+                                             arguments,
+                                             ctx,
+                                             &action_cb,
+                                             NULL);
+             
             g_free(country_name);
             g_free(country_code);
+            g_free(country_currency);
         }
 }
 
@@ -317,12 +323,12 @@ anastasis_gtk_continent_unselected (GtkTreeSelection 
*selection,
     if (! gtk_tree_selection_get_selected (selection, &model, NULL)
             && ! check_state (redux_state,
                               ANASTASIS_generic_state_to_string 
(ANASTASIS_GENERIC_STATE_CONTINENT_SELECTION)))
-        ANASTASIS_redux_action (redux_state,
-                                "unselect_continent",
-                                NULL,
-                                NULL,
-                                &action_cb,
-                                NULL);
+        ra = ANASTASIS_redux_action (redux_state,
+                                     "unselect_continent",
+                                     NULL,
+                                     NULL,
+                                     &action_cb,
+                                     NULL);
 }
 
 
@@ -341,12 +347,12 @@ anastasis_gtk_country_unselected (GtkTreeSelection 
*selection,
     if (! gtk_tree_selection_get_selected (selection, &model, NULL)
             && check_state (redux_state,
                             ANASTASIS_generic_state_to_string 
(ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION)))
-        ANASTASIS_redux_action (redux_state,
-                                "unselect_country",
-                                NULL,
-                                NULL,
-                                &action_cb,
-                                NULL);
+        ra = ANASTASIS_redux_action (redux_state,
+                                     "unselect_country",
+                                     NULL,
+                                     NULL,
+                                     &action_cb,
+                                     NULL);
 }
 
 
@@ -360,12 +366,12 @@ void
 anastasis_gtk_main_window_back_clicked (GObject *object,
                                         gpointer user_data)
 {
-    ANASTASIS_redux_action (redux_state,
-                            "back",
-                            NULL,
-                            NULL,
-                            &action_cb,
-                            NULL);
+    ra = ANASTASIS_redux_action (redux_state,
+                                 "back",
+                                 NULL,
+                                 NULL,
+                                 &action_cb,
+                                 NULL);
     //show identity frame, hide authentication frame
     if (check_state (redux_state,
                      ANASTASIS_generic_state_to_string 
(ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION)) &&
@@ -469,12 +475,12 @@ anastasis_gtk_main_window_forward_clicked (GObject 
*object,
                 json_object_set_new (arguments,
                                     "authentication_providers",
                                     auth_providers);
-            ANASTASIS_redux_action (redux_state,
-                                    "enter_user_attributes",
-                                    arguments,
-                                    NULL,
-                                    &action_cb,
-                                    NULL);
+            ra = ANASTASIS_redux_action (redux_state,
+                                         "enter_user_attributes",
+                                         arguments,
+                                         NULL,
+                                         &action_cb,
+                                         NULL);
         }
 
         gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
@@ -492,12 +498,12 @@ anastasis_gtk_main_window_forward_clicked (GObject 
*object,
             json_t *auth_methods = json_object_get (redux_state, 
"authentication_methods");
 
             if (json_array_size (auth_methods) > 0)
-                ANASTASIS_redux_action (redux_state,
-                                        "next",
-                                        NULL,
-                                        NULL,
-                                        &action_cb,                            
            
-                                        NULL); 
+                ra = ANASTASIS_redux_action (redux_state,
+                                             "next",
+                                             NULL,
+                                             NULL,
+                                             &action_cb,                       
                 
+                                             NULL); 
         }
     }
 }
@@ -511,8 +517,20 @@ anastasis_gtk_main_window_forward_clicked (GObject *object,
 static void
 shutdown_task (void *cls)
 {
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Shutdown initiated\n");
+              
   GNUNET_GTK_main_loop_quit (ml);
   ml = NULL;
+
+  if (NULL != ra)
+  {
+    GNUNET_free (ra);
+    ra = NULL;
+  }
+
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Shutdown complete\n");
 }
 
 
diff --git a/src/anastasis/anastasis-gtk_backup.c 
b/src/anastasis/anastasis-gtk_backup.c
index d964b64..3c96a41 100644
--- a/src/anastasis/anastasis-gtk_backup.c
+++ b/src/anastasis/anastasis-gtk_backup.c
@@ -95,12 +95,12 @@ delete_auth_method (gpointer user_data)
                               GNUNET_assert (0 == json_object_set_new 
(arguments,
                                                                        
"authentication_method",
                                                                        
method));
-                              ANASTASIS_redux_action (redux_state,
-                                                      "delete_authentication",
-                                                      arguments,
-                                                      NULL,
-                                                      &action_cb,
-                                                      NULL);
+                              ra = ANASTASIS_redux_action (redux_state,
+                                                           
"delete_authentication",
+                                                            arguments,
+                                                            NULL,
+                                                            &action_cb,
+                                                            NULL);
                          }
                          index++;
                     }
@@ -232,12 +232,12 @@ anastasis_gtk_b_question_dialog_btn_ok_clicked_cb 
(GObject *object,
           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",
-                                  arguments,
-                                  NULL,
-                                  &action_cb,
-                                  NULL);
+          ra = ANASTASIS_redux_action (redux_state,
+                                       "add_authentication",
+                                       arguments,
+                                       NULL,
+                                       &action_cb,
+                                       NULL);
      }
 
      // set buttons
@@ -380,12 +380,12 @@ anastasis_gtk_b_post_dialog_btn_ok_clicked_cb (GObject 
*object,
           json_object_set_new (auth_method, "data", method_data);
           json_object_set_new (arguments, "authentication_method", 
method_data);
 
-          ANASTASIS_redux_action (redux_state,
-                                  "add_authentication",
-                                  arguments,
-                                  NULL,
-                                  &action_cb,
-                                  NULL);
+          ra = ANASTASIS_redux_action (redux_state,
+                                       "add_authentication",
+                                       arguments,
+                                       NULL,
+                                       &action_cb,
+                                       NULL);
      }
 
      // set buttons
@@ -530,12 +530,12 @@ anastasis_gtk_b_video_dialog_btn_ok_clicked_cb (GObject 
*object,
           json_object_set_new (auth_method, "data", method_data);
           json_object_set_new (arguments, "authentication_method", 
method_data);
 
-          ANASTASIS_redux_action (redux_state,
-                                  "add_authentication",
-                                  arguments,
-                                  NULL,
-                                  &action_cb,
-                                  NULL);
+          ra = ANASTASIS_redux_action (redux_state,
+                                       "add_authentication",
+                                       arguments,
+                                       NULL,
+                                       &action_cb,
+                                       NULL);
      }
 
      // set buttons
@@ -656,12 +656,12 @@ anastasis_gtk_b_sms_dialog_btn_ok_clicked_cb (GObject 
*object,
           json_object_set_new (auth_method, "data", method_data);
           json_object_set_new (arguments, "authentication_method", 
method_data);
 
-          ANASTASIS_redux_action (redux_state,
-                                  "add_authentication",
-                                  arguments,
-                                  NULL,
-                                  &action_cb,
-                                  NULL);
+          ra = ANASTASIS_redux_action (redux_state,
+                                       "add_authentication",
+                                       arguments,
+                                       NULL,
+                                       &action_cb,
+                                       NULL);
      }
 
      // set buttons
@@ -782,12 +782,12 @@ anastasis_gtk_b_email_dialog_btn_ok_clicked_cb (GObject 
*object,
           json_object_set_new (auth_method, "data", method_data);
           json_object_set_new (arguments, "authentication_method", 
method_data);
 
-          ANASTASIS_redux_action (redux_state,
-                                  "add_authentication",
-                                  arguments,
-                                  NULL,
-                                  &action_cb,
-                                  NULL);
+          ra = ANASTASIS_redux_action (redux_state,
+                                       "add_authentication",
+                                       arguments,
+                                       NULL,
+                                       &action_cb,
+                                       NULL);
      }
 
      // set buttons
diff --git a/src/anastasis/anastasis-gtk_helper.c 
b/src/anastasis/anastasis-gtk_helper.c
index 489aa8b..8ef9e6a 100644
--- a/src/anastasis/anastasis-gtk_helper.c
+++ b/src/anastasis/anastasis-gtk_helper.c
@@ -301,7 +301,7 @@ action_cb (void *cls,
                                     
"anastasis_gtk_continent_selection_image")));
     }
     if (check_state (redux_state, 
-                        ANASTASIS_generic_state_to_string 
(ANASTASIS_GENERIC_STATE_COUNTRY_SELECTION)))
+                     ANASTASIS_generic_state_to_string 
(ANASTASIS_GENERIC_STATE_COUNTRY_SELECTION)))
     {
         anastasis_gtk_hide_all_frames ();
         init_country_list (redux_state, json_string_value (json_object_get 
(redux_state, "selected_continent")));
diff --git a/src/include/anastasis-gtk_helper.h 
b/src/include/anastasis-gtk_helper.h
index 3646a1a..e37e3b7 100644
--- a/src/include/anastasis-gtk_helper.h
+++ b/src/include/anastasis-gtk_helper.h
@@ -55,6 +55,11 @@ extern struct GNUNET_CURL_Context *ctx;
  */
 extern struct GNUNET_CURL_RescheduleContext *rc;
 
+/**
+ * Handle to an ongoing action.
+ */
+extern struct ANASTASIS_ReduxAction *ra;
+
 
 /**
  * Function called with the results of #ANASTASIS_redux_action.

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