gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] 03/05: worked on identity attributes


From: gnunet
Subject: [taler-anastasis-gtk] 03/05: worked on identity attributes
Date: Thu, 17 Sep 2020 15:29:46 +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 467377da48599cfc17f5025a111b4d3c46fea791
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Thu Sep 17 12:32:53 2020 +0200

    worked on identity attributes
---
 contrib/anastasis_gtk_main_window.glade | 56 ++++++++++++++++++++++++++++-
 src/anastasis/anastasis-gtk_helper.c    | 64 +++++++++++++++++++++++++++++++--
 2 files changed, 116 insertions(+), 4 deletions(-)

diff --git a/contrib/anastasis_gtk_main_window.glade 
b/contrib/anastasis_gtk_main_window.glade
index e5720ff..e9ec61d 100644
--- a/contrib/anastasis_gtk_main_window.glade
+++ b/contrib/anastasis_gtk_main_window.glade
@@ -470,7 +470,61 @@
                           </packing>
                         </child>
                         <child>
-                          <placeholder/>
+                          <object class="GtkFrame" 
id="anastasis_gtk_provider_frame">
+                            <property name="can_focus">False</property>
+                            <property name="label_xalign">0</property>
+                            <property name="shadow_type">none</property>
+                            <child>
+                              <object class="GtkAlignment">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="left_padding">12</property>
+                                <child>
+                                  <object class="GtkBox" 
id="anastasis_gtk_provider_vbox">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property 
name="orientation">vertical</property>
+                                    <child>
+                                      <object class="GtkComboBoxText" 
id="anastasis_gtk_provider_combo">
+                                        <property 
name="visible">True</property>
+                                        <property 
name="can_focus">False</property>
+                                        <property 
name="hexpand">True</property>
+                                        <property name="active">0</property>
+                                        <items>
+                                          <item translatable="yes">a</item>
+                                          <item translatable="yes">b</item>
+                                          <item translatable="yes">c</item>
+                                        </items>
+                                      </object>
+                                      <packing>
+                                        <property 
name="expand">False</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child type="label">
+                              <object class="GtkLabel">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" 
translatable="yes">Please select Anastasis provider:</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">3</property>
+                          </packing>
                         </child>
                         <child>
                           <placeholder/>
diff --git a/src/anastasis/anastasis-gtk_helper.c 
b/src/anastasis/anastasis-gtk_helper.c
index fe5779a..a79745a 100644
--- a/src/anastasis/anastasis-gtk_helper.c
+++ b/src/anastasis/anastasis-gtk_helper.c
@@ -44,7 +44,7 @@ check_attributes_fullfilled ()
     json_t *id_attr;
     json_t *id_attributes = json_object_get (redux_state, 
"required_attributes");
     bool fullfilled = true;
-    
+
     json_array_foreach (id_attributes, index, id_attr)
     {
         if (json_is_true (json_object_get (id_attr, "required")))
@@ -539,12 +539,70 @@ void
 anastasis_gtk_main_window_forward_clicked (GObject *object,
                                            gpointer user_data)
 {
-    if (check_state (redux_state, "ReduxCountrySelectedState"))
+    if (check_state (redux_state, "ReduxCountrySelectedState") &&
+            gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
+                                        "anastasis_gtk_continent_frame"))))
     {
+        gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
+                                        "anastasis_gtk_continent_frame")));
         gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
                                         "anastasis_gtk_identity_frame")));
+        gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
+                                        
"anastasis_gtk_main_window_forward_button")), false);
+    }
+
+    if (gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
+                                        "anastasis_gtk_identity_frame"))) &&
+                check_attributes_fullfilled ())
+    {
+        GList *children, *iter;
+        json_t *arguments = json_object ();
+        json_t *attributes = json_array ();
+
+        children = gtk_container_get_children (GTK_CONTAINER 
(GCG_get_main_window_object (
+                                                                
"anastasis_gtk_identity_vbox")));
+        for (iter = children; iter != NULL; iter = g_list_next (iter))
+        {
+            json_t *id_attr = json_object ();
+            const char *widget = gtk_widget_get_name (GTK_WIDGET (iter->data));
+
+            if (strstr (widget, "_entry"))
+            {
+                const char *value = gtk_entry_get_text (GTK_ENTRY 
(iter->data));
+                json_object_set_new (id_attr, "type", json_string ("string"));
+                json_object_set_new (id_attr, "value", json_string (value));
+            }
+            if (strstr (widget, "_cal"))
+            {
+                guint day;
+                guint month;
+                guint year;
+
+                json_object_set_new (id_attr, "type", json_string ("date"));
+                gtk_calendar_get_date (GTK_CALENDAR (iter->data),
+                                       &year,
+                                       &month,
+                                       &day);
+                json_object_set_new (id_attr, "year", json_strin (year));
+                json_object_set_new (id_attr, "month", json_strin (month));
+                json_object_set_new (id_attr, "day", json_strin (day));
+            }
+
+            json_object_set_new (id_attr, "widget", json_string (widget));
+            json_array_append_new (attributes, id_attr);
+        }
+        json_object_set_new (arguments, "identity", attributes);
+
+        ANASTASIS_backup_action (redux_state,
+                                 "selection_country",
+                                 arguments,
+                                 &action_cb,
+                                 NULL);
+
         gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
-                                        "anastasis_gtk_continent_frame")));
+                                        "anastasis_gtk_identity_frame")));
+        gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+                                        "anastasis_gtk_provider_frame")));
         gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
                                         
"anastasis_gtk_main_window_forward_button")), false);
     }

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