gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] branch master updated: ensure optional attributes


From: gnunet
Subject: [taler-anastasis-gtk] branch master updated: ensure optional attributes are shown as such
Date: Sun, 27 Feb 2022 15:37:05 +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 b85a19d  ensure optional attributes are shown as such
b85a19d is described below

commit b85a19d958b67316d54226993527285b2e301b59
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Feb 27 15:37:03 2022 +0100

    ensure optional attributes are shown as such
---
 src/anastasis/anastasis-gtk_action.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/anastasis/anastasis-gtk_action.c 
b/src/anastasis/anastasis-gtk_action.c
index 14f7cac..a597eb2 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -515,10 +515,14 @@ action_user_attributes_collecting (void)
       const char *attr_type;
       const char *attr_uuid;
       const char *attr_name;
+      bool optional = false;
       struct GNUNET_JSON_Specification spec[] = {
         GNUNET_JSON_spec_mark_optional (
           GNUNET_JSON_spec_string ("widget",
                                    &widget_name)),
+        GNUNET_JSON_spec_mark_optional (
+          GNUNET_JSON_spec_bool ("optional",
+                                 &optional)),
         GNUNET_JSON_spec_mark_optional (
           GNUNET_JSON_spec_string ("tooltip",
                                    &attr_tooltip)),
@@ -535,6 +539,7 @@ action_user_attributes_collecting (void)
       };
       struct GNUNET_HashCode uh;
       GtkWidget *w = NULL;
+      char *l = NULL;
 
       GNUNET_assert (GNUNET_OK ==
                      GNUNET_JSON_parse (id_attr,
@@ -558,19 +563,12 @@ action_user_attributes_collecting (void)
         }
         GNUNET_free (data_name);
       }
-      if ( (NULL != widget_name) &&
-           (NULL != w) &&
-           (NULL != attr_label) )
-      {
-        char *label_widget;
-
-        GNUNET_asprintf (&label_widget,
-                         "%s_label",
-                         widget_name);
-        update_label (label_widget,
-                      attr_label);
-        GNUNET_free (label_widget);
-      }
+      if (optional)
+        GNUNET_asprintf (&l,
+                         _ ("%s (optional)"),
+                         attr_label);
+      else
+        l = GNUNET_strdup (attr_label);
       if ( (NULL != widget_name) &&
            (NULL != w) )
       {
@@ -607,9 +605,10 @@ action_user_attributes_collecting (void)
       if (NULL == w)
         w = create_attribute_widget (&uh,
                                      attr_type,
-                                     attr_label,
+                                     l,
                                      attr_tooltip,
                                      id_attr);
+      GNUNET_free (l);
       if (NULL != w)
       {
         json_t *ia;

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