[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis-gtk] 01/05: worked on identity attributes
From: |
gnunet |
Subject: |
[taler-anastasis-gtk] 01/05: worked on identity attributes |
Date: |
Thu, 17 Sep 2020 15:29:44 +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 0b288673f05d696fdcf4642fa11cbe5066574a41
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Wed Sep 16 14:49:33 2020 +0200
worked on identity attributes
---
contrib/anastasis_gtk_main_window.glade | 4 ++
src/anastasis/anastasis-gtk_helper.c | 69 +++++++++++++++++++++++++++++++--
2 files changed, 69 insertions(+), 4 deletions(-)
diff --git a/contrib/anastasis_gtk_main_window.glade
b/contrib/anastasis_gtk_main_window.glade
index 045c017..eeccf94 100644
--- a/contrib/anastasis_gtk_main_window.glade
+++ b/contrib/anastasis_gtk_main_window.glade
@@ -317,6 +317,7 @@
<property
name="can_focus">True</property>
<property
name="hexpand">True</property>
<property name="placeholder_text"
translatable="yes">Max Mustermann</property>
+ <signal name="insert-text"
handler="anastasis_gtk_ia_full_name_entry_insert_text_cb" swapped="no"/>
</object>
<packing>
<property
name="expand">False</property>
@@ -356,6 +357,7 @@
<property
name="can_focus">True</property>
<property
name="hexpand">True</property>
<property name="placeholder_text"
translatable="yes">123456789</property>
+ <signal name="insert-text"
handler="anastasis_gtk_ia_ahv_entry_insert_text_cb" swapped="no"/>
</object>
<packing>
<property
name="expand">False</property>
@@ -395,6 +397,7 @@
<property
name="can_focus">True</property>
<property
name="hexpand">True</property>
<property name="placeholder_text"
translatable="yes">123456789</property>
+ <signal name="insert-text"
handler="anastasis_gtk_ia_ssn_entry_insert_text_cb" swapped="no"/>
</object>
<packing>
<property
name="expand">False</property>
@@ -433,6 +436,7 @@
<property
name="year">2020</property>
<property name="month">8</property>
<property name="day">16</property>
+ <signal name="day-selected"
handler="anastasis_gtk_ia_birthdate_cal_day_selected_cb" swapped="no"/>
</object>
<packing>
<property
name="expand">False</property>
diff --git a/src/anastasis/anastasis-gtk_helper.c
b/src/anastasis/anastasis-gtk_helper.c
index 942f4b9..c9935eb 100644
--- a/src/anastasis/anastasis-gtk_helper.c
+++ b/src/anastasis/anastasis-gtk_helper.c
@@ -223,10 +223,10 @@ init_id_attr (json_t *state,
json_array_foreach (id_attributes, index, id_attr)
{
- char *widget_name = json_string_value (json_object_get (id_attr,
"widget"));
- char *attr_type = json_string_value (json_object_get (id_attr,
"type"));
- char *attr_name = json_string_value (json_object_get (id_attr,
"name"));
- char *attr_label = json_string_value (json_object_get (id_attr,
"label"));
+ 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_label = json_string_value (json_object_get (id_attr,
"label"));
if (widget_name)
{
@@ -258,6 +258,67 @@ init_id_attr (json_t *state,
}
+/**
+ * Callback invoked if a text is inserted in "full_name" GtkEntry.
+ *
+ * @param editable the object which received the signal
+ * @param start_pos the starting position
+ * @param cend_pos the end position
+ * @param user_data user data set when the signal handler was connected
(unused)
+ */
+void
+anastasis_gtk_ia_full_name_entry_insert_text_cb (GtkEditable *editable,
+ char *new_text,
+ int new_text_length,
+ gpointer position,
+ gpointer user_data)
+{
+ // check, if required attributes are set to activate forward button
+ {
+ bool fullfilled = true;
+ size_t index;
+ json_t *id_attr;
+ json_t *id_attributes = json_object_get (redux_state,
"required_attributes");
+
+ json_array_foreach (id_attributes, index, id_attr)
+ {
+ if (json_boolean (json_object_get (id_attr, "required")))
+ {
+ const char *type = json_string_value (json_object_get
(id_attr, "type"));
+ if (0 == strcmp (type, "string"))
+ {
+ const char *widget_name = json_string_value
(json_object_get (id_attr, "widget"));
+ char *label_widget;
+ GNUNET_asprintf (&label_widget,
+ "%s_entry",
+ widget_name);
+ GObject *entry = GCG_get_main_window_object (label_widget);
+ GNUNET_free (label_widget);
+ if (0 == gtk_entry_get_text_length (GTK_ENTRY (entry)))
+ fullfilled = false;
+ }
+ if (0 == strcmp (type, "date"))
+ {
+ guint day;
+ const char *widget_name = json_string_value
(json_object_get (id_attr, "widget"));
+ char *label_widget;
+ GNUNET_asprintf (&label_widget,
+ "%s_cal",
+ widget_name);
+ GObject *cal = GCG_get_main_window_object (label_widget);
+ GNUNET_free (label_widget);
+ if (!gtk_calendar_get_day_is_marked (GTK_CALENDAR (cal),
day))
+ fullfilled = false;
+ }
+ }
+ }
+ if (fullfilled)
+ gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_main_window_forward_button")), true);
+ }
+}
+
+
/**
* Callback invoked if a continent is selected (row-activated signal).
*
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.