gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] branch master updated: add logic to show providers


From: gnunet
Subject: [taler-anastasis-gtk] branch master updated: add logic to show providers and policy versions on success
Date: Sat, 20 Mar 2021 11:30:33 +0100

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 353b92c  add logic to show providers and policy versions on success
353b92c is described below

commit 353b92cd4f0b0fefb629954b3c4d2d086284fff4
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Sat Mar 20 11:30:27 2021 +0100

    add logic to show providers and policy versions on success
---
 src/anastasis/anastasis-gtk_action.c               | 60 +++++++++++++---------
 .../anastasis-gtk_handle-policy-version-changed.c  |  4 +-
 src/anastasis/anastasis-gtk_helper.h               | 17 ++++++
 3 files changed, 54 insertions(+), 27 deletions(-)

diff --git a/src/anastasis/anastasis-gtk_action.c 
b/src/anastasis/anastasis-gtk_action.c
index 6118d65..347dea9 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -1183,35 +1183,45 @@ action_policies_paying (void)
 static void
 action_backup_finished (void)
 {
-  GtkLabel *l;
-  char *txt;
-  uint64_t version;
-  struct GNUNET_JSON_Specification spec[] = {
-    GNUNET_JSON_spec_uint64 ("max_policy_version",
-                             &version),
-    GNUNET_JSON_spec_end ()
-  };
+  json_t *arr;
+  json_t *se;
+  size_t index;
+  GtkListStore *ls;
 
   AG_hide_all_frames ();
-
-  if (GNUNET_OK !=
-      GNUNET_JSON_parse (redux_state,
-                         spec,
-                         NULL, NULL))
+  arr = json_object_get (redux_state,
+                         "success_details");
+  ls = GTK_LIST_STORE (GCG_get_main_window_object (
+                         "backup_provider_liststore"));
+  gtk_list_store_clear (ls);
+  json_array_foreach (arr, index, se)
   {
-    GNUNET_break_op (0);
-    AG_error ("State did not parse correctly");
-    return;
-  }
+    const char *url;
+    uint64_t version;
+    struct GNUNET_JSON_Specification spec[] = {
+      GNUNET_JSON_spec_uint64 ("policy_version",
+                               &version),
+      GNUNET_JSON_spec_string ("provider_url",
+                               &url),
+      GNUNET_JSON_spec_end ()
+    };
 
-  l = GTK_LABEL (GCG_get_main_window_object (
-                   "anastasis_gtk_success_backup_version_label"));
-  GNUNET_asprintf (&txt,
-                   _ ("Maximum created policy version is <b>%llu</b>."),
-                   (unsigned long long) version);
-  gtk_label_set_text (l,
-                      txt);
-  GNUNET_free (txt);
+    if (GNUNET_OK !=
+        GNUNET_JSON_parse (se,
+                           spec,
+                           NULL, NULL))
+    {
+      GNUNET_break_op (0);
+      AG_error ("State did not parse correctly");
+      return;
+    }
+    gtk_list_store_insert_with_values (ls,
+                                       NULL,
+                                       -1, /* append */
+                                       AG_BPC_PROVIDER_URL, url,
+                                       AG_BPC_BACKUP_VERSION, (guint64) 
version,
+                                       -1);
+  }
   AG_show ("anastasis_gtk_completed_frame");
   AG_show ("anastasis_gtk_success_backup_label");
   AG_hide ("anastasis_gtk_success_recovery_box");
diff --git a/src/anastasis/anastasis-gtk_handle-policy-version-changed.c 
b/src/anastasis/anastasis-gtk_handle-policy-version-changed.c
index 54d5573..32bd1e7 100644
--- a/src/anastasis/anastasis-gtk_handle-policy-version-changed.c
+++ b/src/anastasis/anastasis-gtk_handle-policy-version-changed.c
@@ -42,8 +42,8 @@ anastasis_gtk_policy_version_spin_button_changed_cb 
(GtkEditable *entry,
   AG_freeze ();
   version = gtk_spin_button_get_value_as_int (sb);
   args = json_pack ("{s:I}",
-                   "version",
-                   (json_int_t) version);
+                    "version",
+                    (json_int_t) version);
   AG_hide ("anastasis_gtk_open_challenge_box");
   ra = ANASTASIS_redux_action (redux_state,
                                "change_version",
diff --git a/src/anastasis/anastasis-gtk_helper.h 
b/src/anastasis/anastasis-gtk_helper.h
index cd21d9e..9cbecfa 100644
--- a/src/anastasis/anastasis-gtk_helper.h
+++ b/src/anastasis/anastasis-gtk_helper.h
@@ -56,6 +56,23 @@ enum AG_ProviderModelColumns
   AG_PMC_PROVIDER_URL = 0
 };
 
+
+/**
+ * Columns of the backup_provider_liststore.
+ */
+enum AG_BackupProviderColumns
+{
+  /**
+   * A gchararray.
+   */
+  AG_BPC_PROVIDER_URL = 0,
+
+  /**
+   * A guint64
+   */
+  AG_BPC_BACKUP_VERSION = 1
+};
+
 /**
  * Columns of the country_liststore.
  */

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