[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis-gtk] branch master updated: work on anastasis-gtk (WiP)
From: |
gnunet |
Subject: |
[taler-anastasis-gtk] branch master updated: work on anastasis-gtk (WiP) |
Date: |
Mon, 08 Mar 2021 20:39:23 +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 298c3e2 work on anastasis-gtk (WiP)
298c3e2 is described below
commit 298c3e27768dc9dc9e24ee38f205e1e2a17fe337
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Mar 8 20:39:21 2021 +0100
work on anastasis-gtk (WiP)
---
contrib/anastasis_gtk_main_window.glade | 833 ++++++++++++++++-----
src/anastasis/Makefile.am | 7 +-
src/anastasis/anastasis-gtk.c | 128 +---
src/anastasis/anastasis-gtk.h | 5 +
src/anastasis/anastasis-gtk_action.c | 241 ++++--
src/anastasis/anastasis-gtk_attributes.c | 189 +++++
...{anastasis-gtk.h => anastasis-gtk_attributes.h} | 36 +-
src/anastasis/anastasis-gtk_backup.c | 134 ----
...astasis-gtk_handle-auth-delete-button-clicked.c | 128 ++++
...stasis-gtk_handle-auth-edit-provider-clicked.c} | 46 +-
.../anastasis-gtk_handle-identity-changed.c | 92 +++
...k.h => anastasis-gtk_handle-identity-changed.h} | 36 +-
...stasis-gtk_handle-main-window-forward-clicked.c | 28 +-
src/anastasis/anastasis-gtk_helper.c | 124 +--
src/anastasis/anastasis-gtk_helper.h | 77 +-
15 files changed, 1395 insertions(+), 709 deletions(-)
diff --git a/contrib/anastasis_gtk_main_window.glade
b/contrib/anastasis_gtk_main_window.glade
index 61d4621..14636bb 100644
--- a/contrib/anastasis_gtk_main_window.glade
+++ b/contrib/anastasis_gtk_main_window.glade
@@ -2,6 +2,14 @@
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.0"/>
+ <object class="GtkListStore" id="authentication_methods_liststore">
+ <columns>
+ <!-- column-name type -->
+ <column type="gchararray"/>
+ <!-- column-name visualization -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkImage" id="backup_image">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -23,19 +31,26 @@
<!-- column-name country_currency -->
<column type="gchararray"/>
</columns>
- <data>
- <row>
- <col id="0" translatable="yes">Germany</col>
- <col id="1" translatable="yes">de</col>
- <col id="2" translatable="yes">EUR</col>
- </row>
- </data>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-yes</property>
</object>
+ <object class="GtkTreeStore" id="policy_review_treestore">
+ <columns>
+ <!-- column-name policy_name -->
+ <column type="gchararray"/>
+ <!-- column-name method_type -->
+ <column type="gchararray"/>
+ <!-- column-name method_cost -->
+ <column type="gchararray"/>
+ <!-- column-name total_cost -->
+ <column type="gchararray"/>
+ <!-- column-name provider_url -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkImage" id="restore_image">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -149,6 +164,17 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel"
id="anastasis_gtk_error_label">
+ <property name="can-focus">False</property>
+ <property name="label"
translatable="yes">DYNAMIC ERROR MESSAGE</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
<object class="GtkFrame"
id="anastasis_gtk_start_frame">
<property name="visible">True</property>
@@ -176,9 +202,27 @@
<packing>
<property
name="expand">True</property>
<property
name="fill">True</property>
+ <property
name="padding">10</property>
<property
name="position">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton">
+ <property
name="label">gtk-open</property>
+ <property
name="visible">True</property>
+ <property
name="can-focus">True</property>
+ <property
name="receives-default">True</property>
+ <property name="tooltip-text"
translatable="yes">Load file with safed Anastasis state</property>
+ <property
name="use-stock">True</property>
+ <signal name="clicked"
handler="anastasis_gtk_open_state" swapped="no"/>
+ </object>
+ <packing>
+ <property
name="expand">True</property>
+ <property
name="fill">True</property>
+ <property
name="padding">10</property>
+ <property
name="position">1</property>
+ </packing>
+ </child>
<child>
<object class="GtkButton">
<property name="label"
translatable="yes">Restore</property>
@@ -190,7 +234,8 @@
<packing>
<property
name="expand">True</property>
<property
name="fill">True</property>
- <property
name="position">1</property>
+ <property
name="padding">10</property>
+ <property
name="position">2</property>
</packing>
</child>
</object>
@@ -202,13 +247,16 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label"
translatable="yes">What do you want to do?</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -298,13 +346,16 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label"
translatable="yes">Where do you live?</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -322,9 +373,8 @@
<property
name="can-focus">False</property>
<property
name="orientation">vertical</property>
<child>
- <object class="GtkBox"
id="anastasis_gtk_ia_full_name">
+ <object class="GtkBox"
id="anastasis_gtk_ia_full_name_box">
<property
name="can-focus">False</property>
- <property
name="homogeneous">True</property>
<child>
<object class="GtkLabel"
id="anastasis_gtk_ia_full_name_label">
<property
name="visible">True</property>
@@ -333,12 +383,12 @@
<property
name="valign">center</property>
<property
name="margin-left">20</property>
<property
name="margin-start">20</property>
- <property
name="hexpand">True</property>
<property name="label"
translatable="yes">Full name:</property>
</object>
<packing>
<property
name="expand">False</property>
- <property
name="fill">True</property>
+ <property
name="fill">False</property>
+ <property
name="padding">5</property>
<property
name="position">0</property>
</packing>
</child>
@@ -348,11 +398,56 @@
<property
name="can-focus">True</property>
<property
name="hexpand">True</property>
<property
name="placeholder-text" translatable="yes">Max Mustermann</property>
- <signal name="changed"
handler="anastasis_gtk_ia_full_name_entry_changed_cb" swapped="no"/>
+ <signal name="changed"
handler="AG_identity_changed" swapped="no"/>
+ </object>
+ <packing>
+ <property
name="expand">True</property>
+ <property
name="fill">True</property>
+ <property
name="padding">5</property>
+ <property
name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">False</property>
+ <property
name="padding">5</property>
+ <property
name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox"
id="anastasis_gtk_ia_birthdate_box">
+ <property
name="can-focus">False</property>
+ <child>
+ <object class="GtkLabel"
id="anastasis_gtk_ia_birthdate_label">
+ <property
name="visible">True</property>
+ <property
name="can-focus">False</property>
+ <property
name="halign">start</property>
+ <property
name="margin-left">20</property>
+ <property
name="margin-start">20</property>
+ <property name="label"
translatable="yes">Birthdate:</property>
</object>
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
+ <property
name="padding">5</property>
+ <property
name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCalendar"
id="anastasis_gtk_ia_birthdate_cal">
+ <property
name="visible">True</property>
+ <property
name="can-focus">True</property>
+ <property
name="year">1980</property>
+ <property
name="month">8</property>
+ <property
name="day">22</property>
+ <property
name="show-week-numbers">True</property>
+ <signal name="day-selected"
handler="AG_identity_changed" swapped="no"/>
+ </object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">False</property>
+ <property
name="padding">5</property>
<property
name="position">1</property>
</packing>
</child>
@@ -360,13 +455,13 @@
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
- <property
name="position">0</property>
+ <property
name="padding">5</property>
+ <property
name="position">1</property>
</packing>
</child>
<child>
- <object class="GtkBox"
id="anastasis_gtk_ia_ahv">
+ <object class="GtkBox"
id="anastasis_gtk_ia_ahv_box">
<property
name="can-focus">False</property>
- <property
name="homogeneous">True</property>
<child>
<object class="GtkLabel"
id="anastasis_gtk_ia_ahv_label">
<property
name="visible">True</property>
@@ -375,12 +470,12 @@
<property
name="valign">center</property>
<property
name="margin-left">20</property>
<property
name="margin-start">20</property>
- <property
name="hexpand">True</property>
<property name="label"
translatable="yes">AHV number:</property>
</object>
<packing>
<property
name="expand">False</property>
- <property
name="fill">True</property>
+ <property
name="fill">False</property>
+ <property
name="padding">5</property>
<property
name="position">0</property>
</packing>
</child>
@@ -388,13 +483,18 @@
<object class="GtkEntry"
id="anastasis_gtk_ia_ahv_entry">
<property
name="visible">True</property>
<property
name="can-focus">True</property>
- <property
name="hexpand">True</property>
- <property
name="placeholder-text" translatable="yes">123456789</property>
- <signal name="changed"
handler="anastasis_gtk_ia_ahv_entry_changed_cb" swapped="no"/>
+ <property
name="max-length">13</property>
+ <property
name="width-chars">14</property>
+ <property
name="max-width-chars">13</property>
+ <property
name="caps-lock-warning">False</property>
+ <property
name="placeholder-text" translatable="yes">7561234567897</property>
+ <property
name="input-purpose">number</property>
+ <signal name="changed"
handler="AG_identity_changed" swapped="no"/>
</object>
<packing>
<property
name="expand">False</property>
- <property
name="fill">True</property>
+ <property
name="fill">False</property>
+ <property
name="padding">5</property>
<property
name="position">1</property>
</packing>
</child>
@@ -402,41 +502,44 @@
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
- <property
name="position">1</property>
+ <property
name="position">2</property>
</packing>
</child>
<child>
- <object class="GtkBox"
id="anastasis_gtk_ia_ssn">
+ <object class="GtkBox"
id="anastasis_gtk_ia_ssn_de_box">
<property
name="can-focus">False</property>
- <property
name="homogeneous">True</property>
<child>
- <object class="GtkLabel"
id="anastasis_gtk_ia_ssn_label">
+ <object class="GtkLabel"
id="anastasis_gtk_ia_ssn_de_label">
<property
name="visible">True</property>
<property
name="can-focus">False</property>
<property
name="halign">start</property>
<property
name="valign">center</property>
<property
name="margin-left">20</property>
<property
name="margin-start">20</property>
- <property
name="hexpand">True</property>
<property name="label"
translatable="yes">Social security number:</property>
</object>
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
+ <property
name="padding">5</property>
<property
name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkEntry"
id="anastasis_gtk_ia_ssn_entry">
+ <object class="GtkEntry"
id="anastasis_gtk_ia_ssn_de_entry">
<property
name="visible">True</property>
<property
name="can-focus">True</property>
- <property
name="hexpand">True</property>
- <property
name="placeholder-text" translatable="yes">123456789</property>
- <signal name="changed"
handler="anastasis_gtk_ia_ssn_entry_changed_cb" swapped="no"/>
+ <property
name="max-length">12</property>
+ <property
name="width-chars">13</property>
+ <property
name="max-width-chars">12</property>
+ <property
name="placeholder-text" translatable="yes">14230460S534</property>
+ <property
name="input-purpose">alpha</property>
+ <signal name="changed"
handler="AG_identity_changed" swapped="no"/>
</object>
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
+ <property
name="padding">5</property>
<property
name="position">1</property>
</packing>
</child>
@@ -444,43 +547,44 @@
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
- <property
name="position">2</property>
+ <property
name="padding">5</property>
+ <property
name="position">3</property>
</packing>
</child>
<child>
- <object class="GtkBox"
id="anastasis_gtk_ia_birthdate">
+ <object class="GtkBox"
id="anastasis_gtk_ia_ssn_us_box">
<property
name="can-focus">False</property>
- <property
name="homogeneous">True</property>
<child>
- <object class="GtkLabel"
id="anastasis_gtk_ia_birthdate_label">
+ <object class="GtkLabel"
id="anastasis_gtk_ia_ssn_us_label">
<property
name="visible">True</property>
<property
name="can-focus">False</property>
<property
name="halign">start</property>
+ <property
name="valign">center</property>
<property
name="margin-left">20</property>
<property
name="margin-start">20</property>
- <property
name="hexpand">True</property>
- <property name="label"
translatable="yes">Birthdate:</property>
+ <property name="label"
translatable="yes">Social security number:</property>
</object>
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
+ <property
name="padding">5</property>
<property
name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkCalendar"
id="anastasis_gtk_ia_birthdate_cal">
+ <object class="GtkEntry"
id="anastasis_gtk_ia_ssn_us_entry">
<property
name="visible">True</property>
<property
name="can-focus">True</property>
- <property
name="hexpand">True</property>
- <property
name="year">2020</property>
- <property
name="month">8</property>
- <property
name="day">22</property>
- <property
name="show-day-names">False</property>
- <signal name="day-selected"
handler="anastasis_gtk_ia_birthdate_cal_day_selected_cb" swapped="no"/>
+ <property
name="max-length">11</property>
+ <property
name="width-chars">12</property>
+ <property
name="max-width-chars">11</property>
+ <property
name="placeholder-text" translatable="yes">000-00-0000</property>
+ <signal name="changed"
handler="AG_identity_changed" swapped="no"/>
</object>
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
+ <property
name="padding">5</property>
<property
name="position">1</property>
</packing>
</child>
@@ -488,7 +592,8 @@
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
- <property
name="position">3</property>
+ <property
name="padding">5</property>
+ <property
name="position">4</property>
</packing>
</child>
</object>
@@ -500,13 +605,17 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label"
translatable="yes">Who are you?</property>
+ <attributes>
+ <attribute name="style" value="normal"/>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
@@ -534,7 +643,59 @@
<property
name="can-focus">False</property>
<property
name="orientation">vertical</property>
<child>
- <placeholder/>
+ <object
class="GtkScrolledWindow">
+ <property
name="visible">True</property>
+ <property
name="can-focus">True</property>
+ <property
name="shadow-type">in</property>
+ <child>
+ <object
class="GtkTreeView" id="anastasis_gtk_authentication_methods_list">
+ <property
name="visible">True</property>
+ <property
name="can-focus">True</property>
+ <property
name="model">authentication_methods_liststore</property>
+ <property
name="enable-search">False</property>
+ <child
internal-child="selection">
+ <object
class="GtkTreeSelection">
+ <property
name="mode">multiple</property>
+ <signal
name="changed" handler="anastasis_gtk_authentication_method_selection_changed"
swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object
class="GtkTreeViewColumn" id="auth_method_type">
+ <property
name="sizing">autosize</property>
+ <property
name="title" translatable="yes">Type</property>
+ <property
name="reorderable">True</property>
+ <property
name="sort-indicator">True</property>
+ <property
name="sort-column-id">0</property>
+ <child>
+ <object
class="GtkCellRendererText" id="type"/>
+ <attributes>
+ <attribute
name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object
class="GtkTreeViewColumn" id="auth_method_visual">
+ <property
name="sizing">autosize</property>
+ <property
name="title" translatable="yes">Details</property>
+ <property
name="expand">True</property>
+ <child>
+ <object
class="GtkCellRendererText" id="visualization"/>
+ <attributes>
+ <attribute
name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property
name="expand">True</property>
+ <property
name="fill">True</property>
+ <property
name="padding">5</property>
+ <property
name="position">0</property>
+ </packing>
</child>
</object>
<packing>
@@ -543,6 +704,23 @@
<property
name="position">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton"
id="anastasis_gtk_authentication_method_delete_button">
+ <property
name="label">gtk-delete</property>
+ <property
name="visible">True</property>
+ <property
name="sensitive">False</property>
+ <property
name="can-focus">True</property>
+ <property
name="receives-default">True</property>
+ <property
name="use-stock">True</property>
+ <signal name="clicked"
handler="anastasis_gtk_authentication_method_delete_button_clicked_cb"
swapped="no"/>
+ </object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">False</property>
+ <property
name="padding">5</property>
+ <property
name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property
name="expand">False</property>
@@ -594,12 +772,13 @@
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
+ <property
name="padding">5</property>
<property
name="position">0</property>
</packing>
</child>
<child>
<object
class="GtkButton" id="anastasis_gtk_btn_add_auth_email">
- <property
name="label" translatable="yes">EMAIL</property>
+ <property
name="label" translatable="yes">Email</property>
<property
name="can-focus">True</property>
<property
name="receives-default">True</property>
<signal
name="clicked" handler="anastasis_gtk_btn_add_auth_email_clicked_cb"
swapped="no"/>
@@ -607,13 +786,13 @@
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
+ <property
name="padding">5</property>
<property
name="position">1</property>
</packing>
</child>
<child>
<object
class="GtkButton" id="anastasis_gtk_btn_add_auth_question">
- <property
name="label" translatable="yes">SECURE
-QUESTION</property>
+ <property
name="label" translatable="yes">Question</property>
<property
name="can-focus">True</property>
<property
name="receives-default">True</property>
<signal
name="clicked" handler="anastasis_gtk_btn_add_auth_question_clicked_cb"
swapped="no"/>
@@ -621,12 +800,13 @@ QUESTION</property>
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
+ <property
name="padding">5</property>
<property
name="position">2</property>
</packing>
</child>
<child>
<object
class="GtkButton" id="anastasis_gtk_btn_add_auth_post">
- <property
name="label" translatable="yes">POST</property>
+ <property
name="label" translatable="yes">Post</property>
<property
name="can-focus">True</property>
<property
name="receives-default">True</property>
<signal
name="clicked" handler="anastasis_gtk_btn_add_auth_post_clicked_cb"
swapped="no"/>
@@ -634,12 +814,13 @@ QUESTION</property>
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
+ <property
name="padding">5</property>
<property
name="position">3</property>
</packing>
</child>
<child>
<object
class="GtkButton" id="anastasis_gtk_btn_add_auth_video">
- <property
name="label" translatable="yes">VIDEO AUTH</property>
+ <property
name="label" translatable="yes">Video</property>
<property
name="can-focus">True</property>
<property
name="receives-default">True</property>
<signal
name="clicked" handler="anastasis_gtk_btn_add_auth_video_clicked_cb"
swapped="no"/>
@@ -647,6 +828,7 @@ QUESTION</property>
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
+ <property
name="padding">5</property>
<property
name="position">4</property>
</packing>
</child>
@@ -656,7 +838,10 @@ QUESTION</property>
<object class="GtkLabel">
<property
name="visible">True</property>
<property
name="can-focus">False</property>
- <property name="label"
translatable="yes">Add Method</property>
+ <property name="label"
translatable="yes">Select authorization method to add:</property>
+ <attributes>
+ <attribute
name="weight" value="bold"/>
+ </attributes>
</object>
</child>
</object>
@@ -671,14 +856,11 @@ QUESTION</property>
<property
name="visible">True</property>
<property
name="can-focus">False</property>
<property
name="homogeneous">True</property>
- <child>
- <placeholder/>
- </child>
<child>
<object
class="GtkButton" id="anastasis_gtk_btn_add_auth_edit_provider">
- <property name="label"
translatable="yes">Edit
-Provider</property>
- <property
name="visible">True</property>
+ <property name="label"
translatable="yes">Configure
+Anastasis
+Providers</property>
<property
name="can-focus">True</property>
<property
name="receives-default">True</property>
<property
name="halign">end</property>
@@ -687,6 +869,7 @@ Provider</property>
<packing>
<property
name="expand">False</property>
<property
name="fill">False</property>
+ <property
name="padding">5</property>
<property
name="position">1</property>
</packing>
</child>
@@ -715,14 +898,17 @@ Provider</property>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="label"
translatable="yes">Authentication Methods</property>
+ <property name="label"
translatable="yes">Configured authorization methods:</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
<child>
@@ -736,157 +922,422 @@ Provider</property>
<property name="can-focus">False</property>
<property name="left-padding">12</property>
<child>
- <!-- n-columns=7 n-rows=3 -->
- <object class="GtkGrid"
id="anastasis_gtk_b_policy_grid">
+ <object class="GtkScrolledWindow">
<property
name="visible">True</property>
- <property
name="can-focus">False</property>
+ <property
name="can-focus">True</property>
+ <property
name="shadow-type">in</property>
<child>
- <object class="GtkFrame">
+ <object class="GtkTreeView"
id="anastasis_gtk_review_policy_treeview">
<property
name="visible">True</property>
- <property
name="can-focus">False</property>
- <property
name="hexpand">True</property>
- <property
name="label-xalign">0</property>
- <property
name="shadow-type">in</property>
+ <property
name="can-focus">True</property>
+ <property
name="model">policy_review_treestore</property>
+ <child internal-child="selection">
+ <object
class="GtkTreeSelection"/>
+ </child>
<child>
- <object class="GtkLabel">
- <property
name="visible">True</property>
- <property
name="can-focus">False</property>
- <property name="label"
translatable="yes">Method</property>
- <attributes>
- <attribute name="weight"
value="ultrabold"/>
- </attributes>
+ <object
class="GtkTreeViewColumn" id="policy_name_column0">
+ <property
name="sizing">autosize</property>
+ <property name="title"
translatable="yes">Policy</property>
+ <child>
+ <object
class="GtkCellRendererText" id="policy_name_column"/>
+ <attributes>
+ <attribute
name="text">0</attribute>
+ </attributes>
+ </child>
</object>
</child>
- <child type="label_item">
+ <child>
+ <object
class="GtkTreeViewColumn" id="challenge_type_column">
+ <property
name="sizing">autosize</property>
+ <property name="title"
translatable="yes">Type</property>
+ <child>
+ <object
class="GtkCellRendererText" id="challenge_type_column1"/>
+ <attributes>
+ <attribute
name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object
class="GtkTreeViewColumn" id="policy_cost">
+ <property
name="sizing">autosize</property>
+ <property name="title"
translatable="yes">Cost</property>
+ <child>
+ <object
class="GtkCellRendererText" id="cost_column"/>
+ <attributes>
+ <attribute
name="text">3</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object
class="GtkTreeViewColumn" id="provider_column">
+ <property name="title"
translatable="yes">Provider</property>
+ <child>
+ <object
class="GtkCellRendererText" id="provider_url_column">
+ <property
name="ellipsize">end</property>
+ </object>
+ <attributes>
+ <attribute
name="text">4</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </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">Review Recovery Policy</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame">
+ <property name="visible">True</property>
+ <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">
+ <property
name="visible">True</property>
+ <property
name="can-focus">False</property>
+ <property
name="orientation">vertical</property>
+ <child>
+ <object class="GtkBox"
id="anastasis_gtk_open_challenge_box">
+ <property
name="visible">True</property>
+ <property
name="can-focus">False</property>
+ <child>
<placeholder/>
</child>
</object>
<packing>
- <property
name="left-attach">0</property>
- <property
name="top-attach">0</property>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkFrame">
+ <object class="GtkLabel"
id="anastasis_gtk_open_challenge_label">
+ <property
name="visible">True</property>
+ <property
name="can-focus">False</property>
+ <property name="label"
translatable="yes">DYNAMIC TEXT EXPLAINING CHALLENGES NEEDED TO RECOVER
SECRET.</property>
+ </object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="position">1</property>
+ </packing>
+ </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">Select challenge to recover secret:</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame"
id="anastasis_gtk_enter_secret_frame">
+ <property name="visible">True</property>
+ <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">
+ <property
name="visible">True</property>
+ <property
name="can-focus">False</property>
+ <property
name="orientation">vertical</property>
+ <child>
+ <object class="GtkBox">
+ <property
name="name">anastasis_gtk_enter_secret_as_text_box</property>
<property
name="visible">True</property>
<property
name="can-focus">False</property>
- <property
name="hexpand">True</property>
- <property
name="label-xalign">0</property>
- <property
name="shadow-type">in</property>
<child>
<object class="GtkLabel">
<property
name="visible">True</property>
<property
name="can-focus">False</property>
- <property name="label"
translatable="yes">Recovery Cost</property>
- <attributes>
- <attribute name="weight"
value="bold"/>
- </attributes>
+ <property name="label"
translatable="yes">Enter as text:</property>
</object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="padding">5</property>
+ <property
name="position">0</property>
+ </packing>
</child>
- <child type="label_item">
- <placeholder/>
+ <child>
+ <object class="GtkEntry"
id="anastasis_gtk_enter_secret_entry">
+ <property
name="visible">True</property>
+ <property
name="can-focus">True</property>
+ </object>
+ <packing>
+ <property
name="expand">True</property>
+ <property
name="fill">True</property>
+ <property
name="padding">5</property>
+ <property
name="position">1</property>
+ </packing>
</child>
</object>
<packing>
- <property
name="left-attach">6</property>
- <property
name="top-attach">0</property>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkFrame">
- <property
name="visible">True</property>
+ <object class="GtkBox">
+ <property
name="name">anastasis_gtk_enter_secret_file_box</property>
<property
name="can-focus">False</property>
- <property
name="hexpand">True</property>
- <property
name="label-xalign">0</property>
- <property
name="shadow-type">in</property>
<child>
<object class="GtkLabel">
<property
name="visible">True</property>
<property
name="can-focus">False</property>
- <property name="label"
translatable="yes">Backup cost</property>
- <attributes>
- <attribute name="weight"
value="bold"/>
- </attributes>
+ <property name="label"
translatable="yes">Use file input:</property>
</object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="padding">5</property>
+ <property
name="position">0</property>
+ </packing>
</child>
- <child type="label_item">
- <placeholder/>
+ <child>
+ <object class="GtkButton"
id="anastasis_gtk_enter_secret_open_button">
+ <property
name="label">gtk-open</property>
+ <property
name="visible">True</property>
+ <property
name="can-focus">True</property>
+ <property
name="receives-default">True</property>
+ <property
name="use-stock">True</property>
+ <signal name="clicked"
handler="anastasis_gtk_enter_secret_open_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="padding">5</property>
+ <property
name="position">1</property>
+ </packing>
</child>
</object>
<packing>
- <property
name="left-attach">5</property>
- <property
name="top-attach">0</property>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="position">1</property>
+ </packing>
+ </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">Provide secret to backup:</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame"
id="anastasis_gtk_pay_frame">
+ <property name="visible">True</property>
+ <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>
+ <placeholder/>
+ </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">Payment required:</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame"
id="anastasis_gtk_completed_frame">
+ <property name="visible">True</property>
+ <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_success_box">
+ <property
name="visible">True</property>
+ <property
name="can-focus">False</property>
+ <child>
+ <object class="GtkLabel"
id="anastasis_gtk_success_backup_label">
+ <property
name="visible">True</property>
+ <property
name="can-focus">False</property>
+ <property name="label"
translatable="yes">Your backup is complete.</property>
+ <property
name="justify">center</property>
+ </object>
+ <packing>
+ <property
name="expand">True</property>
+ <property
name="fill">True</property>
+ <property
name="padding">5</property>
+ <property
name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkFrame">
+ <object class="GtkBox">
<property
name="visible">True</property>
<property
name="can-focus">False</property>
- <property
name="hexpand">True</property>
- <property
name="label-xalign">0</property>
- <property
name="shadow-type">in</property>
+ <property
name="orientation">vertical</property>
<child>
- <object class="GtkLabel">
+ <object class="GtkLabel"
id="anastasis_gtk_success_recovery_label">
<property
name="visible">True</property>
<property
name="can-focus">False</property>
- <property name="label"
translatable="yes">Recovery policies</property>
- <attributes>
- <attribute name="weight"
value="bold"/>
- </attributes>
+ <property name="label"
translatable="yes">Your secret was recovered:</property>
</object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="position">0</property>
+ </packing>
</child>
- <child type="label_item">
- <placeholder/>
+ <child>
+ <object class="GtkBox">
+ <property
name="visible">True</property>
+ <property
name="can-focus">False</property>
+ <child>
+ <object class="GtkLabel"
id="anastasis_gtk_secret_value_label">
+ <property
name="visible">True</property>
+ <property
name="can-focus">False</property>
+ <property name="label"
translatable="yes">THE SECRET TEXT</property>
+ </object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="padding">5</property>
+ <property
name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton"
id="anastasis_gtk_secret_copy_button">
+ <property
name="label">gtk-copy</property>
+ <property
name="visible">True</property>
+ <property
name="can-focus">True</property>
+ <property
name="receives-default">True</property>
+ <property
name="use-stock">True</property>
+ <signal name="clicked"
handler="anastasis_gtk_secret_copy_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="padding">5</property>
+ <property
name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton"
id="anastasis_gtk_secret_save_as_button">
+ <property
name="label">gtk-save-as</property>
+ <property
name="visible">True</property>
+ <property
name="can-focus">True</property>
+ <property
name="receives-default">True</property>
+ <property
name="use-stock">True</property>
+ <signal name="clicked"
handler="anastasis_gtk_secret_save_as_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="padding">5</property>
+ <property
name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage"
id="anastasis_gtk_secret_qr_image">
+ <property
name="visible">True</property>
+ <property
name="can-focus">False</property>
+ <property
name="stock">gtk-missing-image</property>
+ </object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="padding">5</property>
+ <property
name="position">2</property>
+ </packing>
</child>
</object>
<packing>
- <property
name="left-attach">1</property>
- <property
name="top-attach">0</property>
- <property name="width">4</property>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="position">4</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
</object>
</child>
</object>
@@ -895,19 +1346,19 @@ Provider</property>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="label"
translatable="yes">Review Recovery Policy</property>
+ <property name="label"
translatable="yes">Success!</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
</child>
</object>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">9</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
</object>
<packing>
<property name="expand">True</property>
@@ -1036,6 +1487,7 @@ Provider</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
+ <property name="padding">5</property>
<property name="position">0</property>
</packing>
</child>
@@ -1050,6 +1502,48 @@ Provider</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton"
id="anastasis_gtk_main_window_save_as_button">
+ <property name="label">gtk-save-as</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="use-stock">True</property>
+ <signal name="clicked"
handler="anastasis_gtk_main_window_save_as_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton"
id="anastasis_gtk_main_window_quit_button">
+ <property name="label">gtk-quit</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="use-stock">True</property>
+ <signal name="clicked"
handler="anastasis_gtk_main_window_quit_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparator">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
<child>
<object class="GtkButton"
id="anastasis_gtk_main_window_forward_button">
<property name="label">gtk-go-forward</property>
@@ -1063,7 +1557,8 @@ Provider</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="padding">5</property>
+ <property name="position">5</property>
</packing>
</child>
</object>
diff --git a/src/anastasis/Makefile.am b/src/anastasis/Makefile.am
index 652a8ad..9a2a755 100644
--- a/src/anastasis/Makefile.am
+++ b/src/anastasis/Makefile.am
@@ -12,15 +12,17 @@ bin_PROGRAMS = anastasis-gtk
anastasis_gtk_SOURCES = \
anastasis-gtk.c \
- anastasis-gtk_action.c anastasis-gtk_action.h \
anastasis-gtk_about.c \
- anastasis-gtk_backup.c \
+ anastasis-gtk_action.c anastasis-gtk_action.h \
+ anastasis-gtk_attributes.c anastasis-gtk_attributes.h \
anastasis-gtk_dispatch.c anastasis-gtk_dispatch.h \
anastasis-gtk_handle-backup-button-clicked.c \
anastasis-gtk_handle-continent-activated.c \
anastasis-gtk_handle-continent-unselected.c \
anastasis-gtk_handle-country-activated.c \
anastasis-gtk_handle-country-unselected.c \
+ anastasis-gtk_handle-identity-changed.c \
+ anastasis-gtk_handle-identity-changed.h \
anastasis-gtk_handle-main-window-forward-clicked.c \
anastasis-gtk_handle-main-window-forward-clicked.h \
anastasis-gtk_handle-main-window-back-clicked.c \
@@ -33,6 +35,7 @@ anastasis_gtk_LDADD = \
-lgnunetgtk \
-lgnunetutil \
-lgnunetcurl \
+ -lgnunetjson \
-ljansson \
-ltalerjson \
-lanastasisrest \
diff --git a/src/anastasis/anastasis-gtk.c b/src/anastasis/anastasis-gtk.c
index 17e7ab7..d1ad995 100644
--- a/src/anastasis/anastasis-gtk.c
+++ b/src/anastasis/anastasis-gtk.c
@@ -44,6 +44,11 @@ const struct GNUNET_CONFIGURATION_Handle *cfg;
*/
static struct GNUNET_CURL_RescheduleContext *rc;
+/**
+ * Hash map from UUID hashes to GtkWidgets.
+ */
+struct GNUNET_CONTAINER_MultiHashMap *AG_entry_attributes;
+
/**
* Curl context for communication with taler backend
*/
@@ -129,94 +134,6 @@ anastasis_gtk_animation_activate_cb (GtkMenuItem *menuitem,
}
-/**
- * Callback invoked if a text is inserted in "cal" GtkEntry.
- *
- * @param cell_editable the object on which the signal was emitted
- * @param user_data user data set when the signal handler was connected
(unused)
- */
-void
-anastasis_gtk_ia_birthdate_cal_day_selected_cb (GtkCellEditable *cell_editable,
- gpointer user_data)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")),
- false);
-
- // check, if required attributes are set to activate forward button
- if (check_attributes_fullfilled ())
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")),
- true);
-}
-
-
-/**
- * Callback invoked if a text is inserted in "ssn" GtkEntry.
- *
- * @param cell_editable the object on which the signal was emitted
- * @param user_data user data set when the signal handler was connected
(unused)
- */
-void
-anastasis_gtk_ia_ssn_entry_changed_cb (GtkCellEditable *cell_editable,
- gpointer user_data)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")),
- false);
-
- // check, if required attributes are set to activate forward button
- if (check_attributes_fullfilled ())
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")),
- true);
-}
-
-
-/**
- * Callback invoked if a text is inserted in "ahv" GtkEntry.
- *
- * @param cell_editable the object on which the signal was emitted
- * @param user_data user data set when the signal handler was connected
(unused)
- */
-void
-anastasis_gtk_ia_ahv_entry_changed_cb (GtkCellEditable *cell_editable,
- gpointer user_data)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")),
- false);
-
- // check, if required attributes are set to activate forward button
- if (check_attributes_fullfilled ())
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")),
- true);
-}
-
-
-/**
- * Callback invoked if a text is inserted in "full_name" GtkEntry.
- *
- * @param cell_editable the object on which the signal was emitted
- * @param user_data user data set when the signal handler was connected
(unused)
- */
-void
-anastasis_gtk_ia_full_name_entry_changed_cb (GtkCellEditable *cell_editable,
- gpointer user_data)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")),
- false);
-
- // check, if required attributes are set to activate forward button
- if (check_attributes_fullfilled ())
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")),
- true);
-}
-
-
/**
* Task run on shutdown.
*
@@ -241,6 +158,8 @@ shutdown_task (void *cls)
}
GNUNET_GTK_main_loop_quit (ml);
ml = NULL;
+ GNUNET_CONTAINER_multihashmap_destroy (AG_entry_attributes);
+ AG_entry_attributes = NULL;
if (NULL != ra)
{
ANASTASIS_redux_action_cancel (ra);
@@ -265,6 +184,37 @@ anastasis_gtk_quit_cb (GObject *object,
}
+/**
+ * User clicked the "quit" button.
+ *
+ * @param button the button
+ * @param user_data unused
+ */
+void
+anastasis_gtk_main_window_quit_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ GNUNET_SCHEDULER_shutdown ();
+}
+
+
+/**
+ * User clicked the "save as" button.
+ *
+ * @param button the button
+ * @param user_data unused
+ */
+void
+anastasis_gtk_main_window_save_as_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ // FIXME: open save-as dialog
+ // dump state to file
+ // +exit?
+ GNUNET_break (0);
+}
+
+
/**
* Actual main function run right after GNUnet's scheduler
* is initialized. Initializes up GTK and Glade.
@@ -277,6 +227,8 @@ run (void *cls)
GtkWidget *main_window;
ml = cls;
+ AG_entry_attributes = GNUNET_CONTAINER_multihashmap_create (16,
+ GNUNET_NO);
if (GNUNET_OK !=
GNUNET_GTK_main_loop_build_window (ml,
NULL))
diff --git a/src/anastasis/anastasis-gtk.h b/src/anastasis/anastasis-gtk.h
index fae5077..df90378 100644
--- a/src/anastasis/anastasis-gtk.h
+++ b/src/anastasis/anastasis-gtk.h
@@ -41,6 +41,11 @@ extern struct GNUNET_GTK_MainLoop *ml;
*/
extern const struct GNUNET_CONFIGURATION_Handle *cfg;
+/**
+ * Hash map from UUID hashes to GtkWidgets.
+ */
+extern struct GNUNET_CONTAINER_MultiHashMap *AG_entry_attributes;
+
/**
* Actual state.
*/
diff --git a/src/anastasis/anastasis-gtk_action.c
b/src/anastasis/anastasis-gtk_action.c
index 54ea507..15f4b94 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -28,6 +28,7 @@
#include <gnunet/gnunet_util_lib.h>
#include "anastasis-gtk_dispatch.h"
#include "anastasis-gtk_helper.h"
+#include "anastasis-gtk_handle-identity-changed.h"
#include <jansson.h>
@@ -198,6 +199,138 @@ action_country_selecting (void)
}
+/**
+ * Create widget for "string" type user attributes.
+ *
+ * @param details not used
+ * @return widget to be used for string entry
+ */
+static GtkWidget *
+ctor_entry (const json_t *details)
+{
+ (void) details;
+ return gtk_entry_new ();
+}
+
+
+/**
+ * Create widget for "date" type user attributes.
+ *
+ * @param details not used
+ * @return widget to be used for date entry
+ */
+static GtkWidget *
+ctor_date (const json_t *details)
+{
+ (void) details;
+ return gtk_calendar_new ();
+}
+
+
+/**
+ * Create widget of @a type under @a uuid with @a label and @a tooltip
+ * for the identity attribute editing dialog. Stores all created widgets
+ * in the #AG_entry_attributes and ensures that we never create the same
+ * widget (by @a uuid) twice.
+ *
+ * @param uuid unique ID of the widget, only create one per UUID
+ * @param type type of the widget to create
+ * @param label label to use
+ * @param tooltip tooltip to use
+ * @param id_attr potential additional inputs for the widget creation
+ */
+static void
+create_attribute_widget (const char *uuid,
+ const char *type,
+ const char *label,
+ const char *tooltip,
+ const json_t *id_attr)
+{
+ static struct
+ {
+ const char *type;
+ GtkWidget *(*ctor)(const json_t *details);
+ } type_map [] = {
+ { .type = "string",
+ .ctor = &ctor_entry },
+ { .type = "date",
+ .ctor = &ctor_date },
+ { .type = NULL,
+ .ctor = NULL }
+ };
+ struct GNUNET_HashCode uh;
+ GtkWidget *w;
+
+ GNUNET_CRYPTO_hash (uuid,
+ strlen (uuid),
+ &uh);
+ w = GNUNET_CONTAINER_multihashmap_get (AG_entry_attributes,
+ &uh);
+ if (NULL != w)
+ {
+ gtk_widget_show (w);
+ return;
+ }
+ for (unsigned int i = 0; NULL != type_map[i].type; i++)
+ {
+ GtkBox *box;
+
+ if (0 != strcmp (type_map[i].type,
+ type))
+ continue;
+ w = type_map[i].ctor (id_attr);
+ GNUNET_assert (NULL != w);
+ box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL,
+ 5 /* spacing in pixels */));
+ {
+ GtkWidget *glabel;
+
+ glabel = gtk_label_new (label);
+ gtk_box_pack_end (box, /* parent */
+ glabel, /* child */
+ false, /* expand */
+ false, /* fill */
+ 5); /* padding */
+
+ }
+ GNUNET_assert (0 ==
+ g_signal_connect (w,
+ "changed",
+ G_CALLBACK (&AG_identity_changed),
+ NULL));
+ gtk_widget_set_tooltip_text (w,
+ tooltip);
+ gtk_box_pack_end (box, /* parent */
+ w, /* child */
+ false, /* expand */
+ false, /* fill */
+ 5); /* padding */
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CONTAINER_multihashmap_put (AG_entry_attributes,
+ &uh,
+ w,
+
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+ {
+ GtkBox *pbox;
+
+ pbox = GTK_BOX (GCG_get_main_window_object (
+ "anastasis_gtk_identity_vbox"));
+ gtk_box_pack_end (pbox, /* parent */
+ GTK_WIDGET (box), /* child */
+ false, /* expand */
+ false, /* fill */
+ 5); /* padding */
+
+ }
+ return;
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "FATAL: required attribute type `%s' not supported\n",
+ type);
+ GNUNET_assert (0);
+}
+
+
static void
action_user_attributes_collecting (void)
{
@@ -214,48 +347,69 @@ action_user_attributes_collecting (void)
json_array_foreach (id_attributes, index, id_attr)
{
- 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)
+ const char *widget_name = NULL;
+ const char *attr_tooltip = NULL;
+ const char *attr_type;
+ const char *attr_label;
+ const char *attr_uuid;
+ 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_string ("tooltip",
+ &attr_tooltip)),
+ GNUNET_JSON_spec_string ("type",
+ &attr_type),
+ GNUNET_JSON_spec_string ("uuid",
+ &attr_uuid),
+ // FIXME: need i18n variant of spec_string!
+ GNUNET_JSON_spec_string ("label",
+ &attr_label),
+ GNUNET_JSON_spec_end ()
+ };
+
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_JSON_parse (id_attr,
+ spec,
+ NULL, NULL));
+ if (NULL != widget_name)
{
char *label_widget;
+ char *box_widget;
+ GObject *label;
+ GObject *box;
GNUNET_asprintf (&label_widget,
"%s_label",
widget_name);
- gtk_label_set_text (GTK_LABEL (GCG_get_main_window_object (
- label_widget)),
- attr_label);
- AG_show (widget_name);
+ label = GCG_get_main_window_object (label_widget);
+ if (NULL != label)
+ gtk_label_set_text (GTK_LABEL (label),
+ attr_label);
+ GNUNET_asprintf (&box_widget,
+ "%s_box",
+ widget_name);
+ AG_show (label_widget);
+ box = GCG_get_main_window_object (box_widget);
+ if (NULL != box)
+ AG_show_children (box_widget);
GNUNET_free (label_widget);
+ GNUNET_free (box_widget);
}
- else if (0 == strcmp (attr_type, "string"))
- {
- /**
- * FIXME: create new widget
- */
- }
- else if (0 == strcmp (attr_type, "date"))
+ else
{
- /**
- * FIXME: create new widget
- */
+ create_attribute_widget (attr_uuid,
+ attr_type,
+ attr_label,
+ attr_tooltip,
+ id_attr);
}
- /**
- * FIXME: handle other types
- */
}
}
AG_sensitive ("anastasis_gtk_main_window_prev_button");
- // FIXME: check if dialog state is consistent, if so, enable forward button!
- AG_insensitive ("anastasis_gtk_main_window_forward_button");
+ AG_identity_changed ();
AG_show ("anastasis_gtk_identity_frame");
AG_show ("anastasis_gtk_user_attributes_image");
}
@@ -264,33 +418,22 @@ action_user_attributes_collecting (void)
static void
action_authentications_editing (void)
{
- if (json_object_get (redux_state, "backup_state"))
- {
- AG_hide_all_frames ();
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_authentication_frame")));
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_b_authentication_methods_image")));
- init_b_auth_methods (redux_state);
- }
+ AG_hide_all_frames ();
+ GNUNET_break (0);
+ AG_show ("anastasis_gtk_b_authentication_frame");
+ AG_show ("anastasis_gtk_b_authentication_methods_image");
+
}
static void
action_policies_reviewing (void)
{
- if (gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_b_authentication_frame"))))
- {
- if (json_object_get (redux_state, "backup_state"))
- {
- AG_hide_all_frames ();
- init_b_policy (redux_state);
- AG_show ("anastasis_gtk_b_policy_frame");
- AG_show ("anastasis_gtk_b_policies_image");
- set_policy_check_buttons (redux_state);
- }
- }
+ AG_hide_all_frames ();
+ GNUNET_break (0);
+ AG_show ("anastasis_gtk_b_policy_frame");
+ AG_show ("anastasis_gtk_b_policies_image");
+ // set_policy_check_buttons (redux_state);
}
diff --git a/src/anastasis/anastasis-gtk_attributes.c
b/src/anastasis/anastasis-gtk_attributes.c
new file mode 100644
index 0000000..55153e0
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_attributes.c
@@ -0,0 +1,189 @@
+/*
+ This file is part of anastasis-gtk.
+ Copyright (C) 2020 Anastasis SARL
+
+ Anastasis is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ Anastasis is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Anastasis; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+/**
+ * @file src/anastasis/anastasis-gtk_handle-identity-changed.c
+ * @brief
+ * @author Christian Grothoff
+ * @author Dennis Neufeld
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_helper.h"
+#include "anastasis-gtk_action.h"
+#include "anastasis-gtk_attributes.h"
+
+
+static json_t *
+extract_entry (GtkWidget *entry)
+{
+ const gchar *txt;
+
+ txt = gtk_entry_get_text (GTK_ENTRY (entry));
+ if (0 == strlen (txt))
+ return NULL;
+ return json_string (txt);
+}
+
+
+static json_t *
+extract_cal (GtkWidget *cal)
+{
+ guint day;
+ guint month;
+ guint year;
+ char txt[12];
+
+ gtk_calendar_get_date (GTK_CALENDAR (cal),
+ &year,
+ &month,
+ &day);
+ if (! (day && month && day))
+ return NULL;
+ GNUNET_snprintf (txt,
+ sizeof (txt),
+ "%04u-%02u-%02u",
+ (unsigned int) year,
+ (unsigned int) month,
+ (unsigned int) day);
+ return json_string (txt);
+}
+
+
+json_t *
+AG_collect_attributes ()
+{
+ const json_t *id_attributes;
+ json_t *result;
+ size_t index;
+ json_t *id_attr;
+
+ id_attributes = json_object_get (redux_state,
+ "required_attributes");
+ GNUNET_assert (NULL != id_attributes);
+ result = json_object ();
+ GNUNET_assert (NULL != result);
+ json_array_foreach (id_attributes, index, id_attr)
+ {
+ GtkWidget *w;
+ const char *widget_name = NULL;
+ const char *attr_name;
+ const char *attr_type;
+ const char *attr_uuid;
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_string ("widget",
+ &widget_name)),
+ GNUNET_JSON_spec_string ("type",
+ &attr_type),
+ GNUNET_JSON_spec_string ("name",
+ &attr_name),
+ GNUNET_JSON_spec_string ("uuid",
+ &attr_uuid),
+ GNUNET_JSON_spec_end ()
+ };
+
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_JSON_parse (id_attr,
+ spec,
+ NULL, NULL));
+ if (NULL != widget_name)
+ {
+ static struct
+ {
+ const char *type;
+ const char *suffix;
+ } type_map [] = {
+ { .type = "string",
+ .suffix = "entry" },
+ { .type = "date",
+ .suffix = "cal" },
+ { .type = NULL,
+ .suffix = NULL }
+ };
+ char *data_widget;
+ bool found = false;
+
+ for (unsigned int i = 0; NULL != type_map[i].type; i++)
+ {
+ if (0 != strcmp (type_map[i].type,
+ attr_type))
+ continue;
+ GNUNET_asprintf (&data_widget,
+ "%s_%s",
+ widget_name,
+ type_map[i].suffix);
+ w = GTK_WIDGET (GCG_get_main_window_object (data_widget));
+ GNUNET_assert (NULL != w);
+ GNUNET_free (data_widget);
+ found = true;
+ break;
+ }
+ GNUNET_assert (found);
+ }
+ else
+ {
+ struct GNUNET_HashCode uh;
+
+ GNUNET_CRYPTO_hash (attr_uuid,
+ strlen (attr_uuid),
+ &uh);
+ w = GNUNET_CONTAINER_multihashmap_get (AG_entry_attributes,
+ &uh);
+
+ }
+
+ {
+ static struct
+ {
+ const char *type;
+ json_t * (*extract)(GtkWidget *w);
+ } e_map [] = {
+ { .type = "string",
+ .extract = &extract_entry },
+ { .type = "date",
+ .extract = &extract_cal },
+ { .type = NULL,
+ .extract = NULL }
+ };
+ json_t *val = NULL;
+
+ for (unsigned int i = 0; NULL != e_map[i].type; i++)
+ {
+ if (0 != strcmp (e_map[i].type,
+ attr_type))
+ continue;
+ val = e_map[i].extract (w);
+ break;
+ }
+ if (NULL == val)
+ {
+ json_decref (result);
+ return NULL;
+ }
+ GNUNET_assert (0 ==
+ json_object_set_new (result,
+ attr_name,
+ val));
+ }
+ }
+ return json_pack ("{s:o}",
+ "identity_attributes",
+ result);
+}
diff --git a/src/anastasis/anastasis-gtk.h
b/src/anastasis/anastasis-gtk_attributes.h
similarity index 62%
copy from src/anastasis/anastasis-gtk.h
copy to src/anastasis/anastasis-gtk_attributes.h
index fae5077..e6480e8 100644
--- a/src/anastasis/anastasis-gtk.h
+++ b/src/anastasis/anastasis-gtk_attributes.h
@@ -17,39 +17,23 @@
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
-
/**
- * @file src/include/anastasis-gtk_helper.h
- * @brief Definition of helpers.
+ * @file src/anastasis/anastasis-gtk_attributes.h
+ * @brief
* @author Christian Grothoff
* @author Dennis Neufeld
*/
-#ifndef ANASTASIS_GTK_H
-#define ANASTASIS_GTK_H
-#include <gnunet-gtk/gnunet_gtk.h>
-#include <gtk/gtk.h>
-#include <anastasis/anastasis_service.h>
-#include <anastasis/anastasis_redux.h>
-
-/**
- * Handle to our main loop.
- */
-extern struct GNUNET_GTK_MainLoop *ml;
-
-/**
- * Our configuration.
- */
-extern const struct GNUNET_CONFIGURATION_Handle *cfg;
+#ifndef ANASTASIS_GTK_ATTRIBUTES_H
+#define ANASTASIS_GTK_ATTRIBUTES_H
-/**
- * Actual state.
- */
-extern json_t *redux_state;
+#include <jansson.h>
/**
- * Handle to an ongoing action.
+ * Tries to compile the user's attributes into a JSON object.
+ *
+ * @return NULL on failure
*/
-extern struct ANASTASIS_ReduxAction *ra;
-
+json_t *
+AG_collect_attributes (void);
#endif
diff --git a/src/anastasis/anastasis-gtk_backup.c
b/src/anastasis/anastasis-gtk_backup.c
index 29d5a47..f4deb29 100644
--- a/src/anastasis/anastasis-gtk_backup.c
+++ b/src/anastasis/anastasis-gtk_backup.c
@@ -38,129 +38,6 @@ guint g_signal_post;
guint g_signal_video;
-/**
- * Delete method from hbox.
- *
- * @param user_data pointer to hbox containing method
- */
-static void
-delete_auth_method (gpointer user_data)
-{
- if (GTK_IS_BOX (user_data))
- {
- GList *user_data_children, *iter;
- user_data_children = gtk_container_get_children (GTK_CONTAINER
(user_data));
-
- // parse state to delete method
- if (NULL != user_data_children)
- {
- const gchar *label;
- json_t *arguments = json_object ();
- GNUNET_assert (NULL != arguments);
- json_t *method = json_object ();
- GNUNET_assert (NULL != method);
- json_t *value = json_object ();
- GNUNET_assert (NULL != value);
- unsigned int index = 0;
-
- for (iter = user_data_children; iter != NULL; iter = g_list_next (iter))
- {
- if (GTK_IS_LABEL (iter->data))
- {
- label = gtk_label_get_text (GTK_LABEL (iter->data));
-
- if (index == 0)
- {
- char *method_type = NULL;
- if (0 == strcmp ("Q: ", label))
- method_type = "question";
- if (0 == strcmp ("SMS: ", label))
- method_type = "sms";
- if (0 == strcmp ("VIDEO: ", label))
- method_type = "video";
- if (0 == strcmp ("POST: ", label))
- method_type = "post";
- if (0 == strcmp ("EMAIL: ", label))
- method_type = "email";
-
- GNUNET_assert (0 == json_object_set_new (method,
- "method",
- json_string (
- method_type)));
- }
- if (index == 1)
- {
- GNUNET_assert (0 == json_object_set_new (method,
- "value",
- json_string (label)));
- GNUNET_assert (0 == json_object_set_new (arguments,
- "authentication_method",
- method));
- ra = ANASTASIS_redux_action (redux_state,
- "delete_authentication",
- arguments,
- &AG_action_cb,
- NULL);
- }
- index++;
- }
- gtk_widget_destroy (iter->data);
- }
- }
- g_list_free (user_data_children);
- }
-}
-
-
-/**
- * Callback invoked if the the "authentication methods edit"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-void
-anastasis_gtk_b_auth_method_btn_edit_clicked_cb (GObject *object,
- gpointer user_data);
-
-
-/**
- * Callback invoked if the the "backup"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-void
-anastasis_gtk_btn_add_auth_edit_provider_clicked_cb ()
-{
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_edit_provider_dialog")));
-}
-
-
-/**
- * Callback invoked if the the "authentication methods delete"-button is
clicked.
- *
- * @param object
- * @param user_data unused
- */
-void
-anastasis_gtk_b_auth_method_btn_delete_clicked_cb (GObject *object,
- gpointer user_data)
-{
- delete_auth_method (user_data);
-
- // if no methods, set sensitivity of forward button to false
- GList *vbox_children = gtk_container_get_children (GTK_CONTAINER (
-
GCG_get_main_window_object (
-
"anastasis_gtk_b_authentication_vbox")));
- if (NULL == vbox_children)
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")),
- false);
- g_list_free (vbox_children);
-}
-
-
/**
* Callback invoked if the the "secure question OK"-button is clicked.
*
@@ -175,17 +52,6 @@ anastasis_gtk_b_question_dialog_btn_ok_clicked_cb (GObject
*object,
GtkBox *vbox = GTK_BOX (GCG_get_main_window_object (
"anastasis_gtk_b_authentication_vbox"));
- bool is_box = GTK_IS_BOX (user_data);
-
- if (is_box)
- {
- hbox = (GtkHBox *) user_data;
- // if is_box is true, we are editing and have to delete the old method
- delete_auth_method (user_data);
- }
- else
- hbox = (GtkHBox *) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-
// set labels
GtkLabel *label_prefix = (GtkLabel *) gtk_label_new ("Q: ");
const gchar *question = gtk_entry_get_text (
diff --git a/src/anastasis/anastasis-gtk_handle-auth-delete-button-clicked.c
b/src/anastasis/anastasis-gtk_handle-auth-delete-button-clicked.c
new file mode 100644
index 0000000..022aec7
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_handle-auth-delete-button-clicked.c
@@ -0,0 +1,128 @@
+/*
+ This file is part of anastasis-gtk.
+ Copyright (C) 2020 Anastasis SARL
+
+ Anastasis is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ Anastasis is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Anastasis; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+/**
+ * @file src/anastasis/anastasis-gtk_backup.c
+ * @brief Main function of anastasis-gtk
+ * @author Christian Grothoff
+ * @author Dennis Neufeld
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_action.h"
+#include "anastasis-gtk_helper.h"
+#include <jansson.h>
+
+
+/**
+ * Delete method from hbox.
+ *
+ * @param user_data pointer to hbox containing method
+ */
+static void
+delete_auth_method (gpointer user_data)
+{
+ if (GTK_IS_BOX (user_data))
+ {
+ GList *user_data_children, *iter;
+ user_data_children = gtk_container_get_children (GTK_CONTAINER
(user_data));
+
+ // parse state to delete method
+ if (NULL != user_data_children)
+ {
+ const gchar *label;
+ json_t *arguments = json_object ();
+ GNUNET_assert (NULL != arguments);
+ json_t *method = json_object ();
+ GNUNET_assert (NULL != method);
+ json_t *value = json_object ();
+ GNUNET_assert (NULL != value);
+ unsigned int index = 0;
+
+ for (iter = user_data_children; iter != NULL; iter = g_list_next (iter))
+ {
+ if (GTK_IS_LABEL (iter->data))
+ {
+ label = gtk_label_get_text (GTK_LABEL (iter->data));
+
+ if (index == 0)
+ {
+ char *method_type = NULL;
+ if (0 == strcmp ("Q: ", label))
+ method_type = "question";
+ if (0 == strcmp ("SMS: ", label))
+ method_type = "sms";
+ if (0 == strcmp ("VIDEO: ", label))
+ method_type = "video";
+ if (0 == strcmp ("POST: ", label))
+ method_type = "post";
+ if (0 == strcmp ("EMAIL: ", label))
+ method_type = "email";
+
+ GNUNET_assert (0 == json_object_set_new (method,
+ "method",
+ json_string (
+ method_type)));
+ }
+ if (index == 1)
+ {
+ GNUNET_assert (0 == json_object_set_new (method,
+ "value",
+ json_string (label)));
+ GNUNET_assert (0 == json_object_set_new (arguments,
+ "authentication_method",
+ method));
+ ra = ANASTASIS_redux_action (redux_state,
+ "delete_authentication",
+ arguments,
+ &AG_action_cb,
+ NULL);
+ }
+ index++;
+ }
+ gtk_widget_destroy (iter->data);
+ }
+ }
+ g_list_free (user_data_children);
+ }
+}
+
+
+/**
+ * Callback invoked if the the "authentication methods delete"-button is
clicked.
+ *
+ * @param object
+ * @param user_data unused
+ */
+void
+anastasis_gtk_b_auth_method_btn_delete_clicked_cb (GObject *object,
+ gpointer user_data)
+{
+ delete_auth_method (user_data);
+
+ // if no methods, set sensitivity of forward button to false
+ GList *vbox_children = gtk_container_get_children (GTK_CONTAINER (
+
GCG_get_main_window_object (
+
"anastasis_gtk_b_authentication_vbox")));
+ if (NULL == vbox_children)
+ gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_main_window_forward_button")),
+ false);
+ g_list_free (vbox_children);
+}
diff --git a/src/anastasis/anastasis-gtk.h
b/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
similarity index 57%
copy from src/anastasis/anastasis-gtk.h
copy to src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
index fae5077..739427c 100644
--- a/src/anastasis/anastasis-gtk.h
+++ b/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
@@ -19,37 +19,31 @@
*/
/**
- * @file src/include/anastasis-gtk_helper.h
- * @brief Definition of helpers.
+ * @file src/anastasis/anastasis-gtk_backup.c
+ * @brief Main function of anastasis-gtk
* @author Christian Grothoff
* @author Dennis Neufeld
*/
-#ifndef ANASTASIS_GTK_H
-#define ANASTASIS_GTK_H
-#include <gnunet-gtk/gnunet_gtk.h>
-#include <gtk/gtk.h>
-#include <anastasis/anastasis_service.h>
-#include <anastasis/anastasis_redux.h>
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_action.h"
+#include "anastasis-gtk_helper.h"
+#include <jansson.h>
-/**
- * Handle to our main loop.
- */
-extern struct GNUNET_GTK_MainLoop *ml;
-
-/**
- * Our configuration.
- */
-extern const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
- * Actual state.
+ * Callback invoked if the the "Edit"-provider list button is clicked.
+ *
+ * @param object
+ * @param user_data unused
*/
-extern json_t *redux_state;
-
-/**
- * Handle to an ongoing action.
- */
-extern struct ANASTASIS_ReduxAction *ra;
-
-
+void
+anastasis_gtk_btn_add_auth_edit_provider_clicked_cb (GtkButton *object,
+ gpointer user_data)
+{
+ GNUNET_break (0);
+#if 0
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_edit_provider_dialog")));
#endif
+}
diff --git a/src/anastasis/anastasis-gtk_handle-identity-changed.c
b/src/anastasis/anastasis-gtk_handle-identity-changed.c
new file mode 100644
index 0000000..34a795b
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_handle-identity-changed.c
@@ -0,0 +1,92 @@
+/*
+ This file is part of anastasis-gtk.
+ Copyright (C) 2020 Anastasis SARL
+
+ Anastasis is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ Anastasis is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Anastasis; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+/**
+ * @file src/anastasis/anastasis-gtk_handle-identity-changed.c
+ * @brief
+ * @author Christian Grothoff
+ * @author Dennis Neufeld
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_helper.h"
+#include "anastasis-gtk_action.h"
+#include "anastasis-gtk_attributes.h"
+#include "anastasis-gtk_handle-identity-changed.h"
+#include <jansson.h>
+
+
+/**
+ * Function called with the results of #ANASTASIS_redux_action.
+ *
+ * @param cls closure
+ * @param error_code Error code
+ * @param response new state as result or config information of provider
+ */
+static void
+test_ok_cb (void *cls,
+ enum TALER_ErrorCode error_code,
+ json_t *response)
+{
+ bool *result = cls;
+
+ if (TALER_EC_NONE == error_code)
+ *result = true;
+}
+
+
+/**
+ * Function to ckeck if required attributes are set.
+ *
+ * @return true if user-provided attributes satisfy the constraints
+ */
+static bool
+check_attributes_fullfilled (void)
+{
+ struct ANASTASIS_ReduxAction *ta;
+ json_t *args;
+ bool result;
+
+ args = AG_collect_attributes ();
+ if (NULL == args)
+ return false;
+ result = false;
+ ta = ANASTASIS_redux_action (redux_state,
+ "enter_user_attributes",
+ args,
+ &test_ok_cb,
+ &result);
+ if (NULL != ta)
+ {
+ GNUNET_break (0);
+ ANASTASIS_redux_action_cancel (ta);
+ }
+ json_decref (args);
+ return result;
+}
+
+
+void
+AG_identity_changed (void)
+{
+ if (check_attributes_fullfilled ())
+ AG_sensitive ("anastasis_gtk_main_window_forward_button");
+ else
+ AG_insensitive ("anastasis_gtk_main_window_forward_button");
+}
diff --git a/src/anastasis/anastasis-gtk.h
b/src/anastasis/anastasis-gtk_handle-identity-changed.h
similarity index 62%
copy from src/anastasis/anastasis-gtk.h
copy to src/anastasis/anastasis-gtk_handle-identity-changed.h
index fae5077..826b69c 100644
--- a/src/anastasis/anastasis-gtk.h
+++ b/src/anastasis/anastasis-gtk_handle-identity-changed.h
@@ -17,39 +17,21 @@
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
-
/**
- * @file src/include/anastasis-gtk_helper.h
- * @brief Definition of helpers.
+ * @file src/anastasis/anastasis-gtk_handle-identity-changed.c
+ * @brief
* @author Christian Grothoff
* @author Dennis Neufeld
*/
-#ifndef ANASTASIS_GTK_H
-#define ANASTASIS_GTK_H
-#include <gnunet-gtk/gnunet_gtk.h>
-#include <gtk/gtk.h>
-#include <anastasis/anastasis_service.h>
-#include <anastasis/anastasis_redux.h>
-
-/**
- * Handle to our main loop.
- */
-extern struct GNUNET_GTK_MainLoop *ml;
+#ifndef ANASTASIS_GTK_HANDLE_IDENTITY_CHANGED_H
+#define ANASTASIS_GTK_HANDLE_IDENTITY_CHANGED_H
/**
- * Our configuration.
+ * Function called when the user changed anything about its identity.
+ * Check whether the current input is valid and enables/disables the
+ * 'forward' button accordingly.
*/
-extern const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-/**
- * Actual state.
- */
-extern json_t *redux_state;
-
-/**
- * Handle to an ongoing action.
- */
-extern struct ANASTASIS_ReduxAction *ra;
-
+void
+AG_identity_changed (void);
#endif
diff --git a/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c
b/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c
index ee1b25f..02e0f7a 100644
--- a/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c
+++ b/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c
@@ -26,6 +26,7 @@
#include <gnunet/platform.h>
#include <gnunet/gnunet_util_lib.h>
#include "anastasis-gtk_action.h"
+#include "anastasis-gtk_attributes.h"
#include "anastasis-gtk_dispatch.h"
#include "anastasis-gtk_helper.h"
#include <jansson.h>
@@ -80,7 +81,17 @@ AG_forward_country_selecting (void)
static void
forward_user_attributes_collecting (void)
{
+ json_t *args;
+ AG_freeze ();
+ args = AG_collect_attributes ();
+ GNUNET_assert (NULL != args);
+ ra = ANASTASIS_redux_action (redux_state,
+ "enter_user_attributes",
+ args,
+ &AG_action_cb,
+ NULL);
+ json_decref (args);
}
@@ -92,11 +103,6 @@ forward_authentications_editing (void)
json_t *arguments = json_object ();
json_t *id_attr = json_object ();
- if (! check_attributes_fullfilled ())
- {
- GNUNET_break (0);
- return;
- }
children = gtk_container_get_children (GTK_CONTAINER (
GCG_get_main_window_object (
"anastasis_gtk_identity_vbox")));
@@ -180,7 +186,6 @@ forward_authentications_editing (void)
NULL,
&AG_action_cb,
NULL);
- GNUNET_assert (NULL != ra);
}
}
}
@@ -189,7 +194,14 @@ forward_authentications_editing (void)
static void
forward_policies_reviewing (void)
{
+ GNUNET_break (0);
+}
+
+static void
+forward_secret_editing (void)
+{
+ GNUNET_break (0);
}
@@ -212,8 +224,8 @@ anastasis_gtk_main_window_forward_clicked (GObject *object,
.action = &forward_authentications_editing },
{ .state = "POLICIES_REVIEWING",
.action = &forward_policies_reviewing },
- { .state = "TBD",
- .action = NULL },
+ { .state = "SECRET_EDITING",
+ .action = &forward_secret_editing },
{ .state = NULL,
.action = NULL }
};
diff --git a/src/anastasis/anastasis-gtk_helper.c
b/src/anastasis/anastasis-gtk_helper.c
index b36400e..bca58ee 100644
--- a/src/anastasis/anastasis-gtk_helper.c
+++ b/src/anastasis/anastasis-gtk_helper.c
@@ -124,6 +124,19 @@ AG_hide_children (const char *name)
for (GList *iter = children; iter != NULL; iter = g_list_next (iter))
gtk_widget_hide (GTK_WIDGET (iter->data));
g_list_free (children);
+}
+
+
+void
+AG_show_children (const char *name)
+{
+ GList *children;
+
+ children = gtk_container_get_children (GTK_CONTAINER (
+ GCG_get_main_window_object (name)));
+ for (GList *iter = children; iter != NULL; iter = g_list_next (iter))
+ gtk_widget_show (GTK_WIDGET (iter->data));
+ g_list_free (children);
}
@@ -153,117 +166,6 @@ AG_check_state (json_t *state,
}
-/**
- * Get num of cols a widget takes in a grid.
- *
- * @param grid Grid the widget belongs to
- * @param widget Widget to look up
- * @return int
- */
-int
-get_widget_width (GtkGrid *grid,
- GtkWidget *widget)
-{
- // get number of policies/policy columns
- GValue val_policies_col = G_VALUE_INIT;
- g_value_init (&val_policies_col, G_TYPE_INT);
- gtk_container_child_get_property (GTK_CONTAINER (grid),
- GTK_WIDGET (widget),
- "width",
- &val_policies_col);
- return g_value_get_int (&val_policies_col);
-}
-
-
-/**
- * Set policy check buttons according to policies in state.
- *
- * @param state the state to operate on
- */
-void
-set_policy_check_buttons (json_t *state)
-{
- GtkGrid *grid = GTK_GRID (GCG_get_main_window_object (
- "anastasis_gtk_b_policy_grid"));
-
- // get number of policies/policy columns
- GtkFrame *frm_policy_title = GTK_FRAME (gtk_grid_get_child_at (grid, 1, 0));
- int cols = get_widget_width (grid, GTK_WIDGET (frm_policy_title));
-
- for (unsigned int i = 0; i < cols; i++)
- {
- /** FIXME: set check buttons here */
- }
-}
-
-
-/**
- * Function to ckeck if required attributes are set.
- *
- * @return bool
- */
-bool
-check_attributes_fullfilled ()
-{
- size_t index;
- 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)
- {
- const char *type = json_string_value (json_object_get (id_attr, "type"));
- const char *widget_name = json_string_value (json_object_get (id_attr,
- "widget"));
- if (0 == strcmp (type, "string"))
- {
- char *entry_widget;
- if (widget_name)
- {
- GNUNET_asprintf (&entry_widget,
- "%s_entry",
- widget_name);
- }
- else
- {
- /** FIXME: create a new GtkEntry here */
- }
-
- GObject *entry = GCG_get_main_window_object (entry_widget);
- if (0 == gtk_entry_get_text_length (GTK_ENTRY (entry)))
- fullfilled = false;
- GNUNET_free (entry_widget);
- }
- if (0 == strcmp (type, "date"))
- {
- guint day;
- guint month;
- guint year;
- char *cal_widget;
- if (widget_name)
- {
- GNUNET_asprintf (&cal_widget,
- "%s_cal",
- widget_name);
- }
- else
- {
- /** FIXME: create a new GtkCalendar here */
- }
- GObject *cal = GCG_get_main_window_object (cal_widget);
- gtk_calendar_get_date (GTK_CALENDAR (cal),
- &year,
- &month,
- &day);
- if (! (day && month && day))
- fullfilled = false;
- GNUNET_free (cal_widget);
- }
- }
- return fullfilled;
-}
-
-
/**
* Get an object from the main window.
*
diff --git a/src/anastasis/anastasis-gtk_helper.h
b/src/anastasis/anastasis-gtk_helper.h
index 89ef818..8003768 100644
--- a/src/anastasis/anastasis-gtk_helper.h
+++ b/src/anastasis/anastasis-gtk_helper.h
@@ -93,22 +93,22 @@ AG_hide_children (const char *name);
/**
- * Get an object from the main window.
+ * Show all of the children of the container widget @a name in the main window.
*
* @param name name of the object
- * @return NULL on error
*/
-GObject *
-GCG_get_main_window_object (const char *name);
+void
+AG_show_children (const char *name);
/**
- * Function to ckeck if required attributes are set.
+ * Get an object from the main window.
*
- * @return bool
+ * @param name name of the object
+ * @return NULL on error
*/
-bool
-check_attributes_fullfilled ();
+GObject *
+GCG_get_main_window_object (const char *name);
/**
@@ -123,67 +123,6 @@ AG_check_state (json_t *state,
const char *expected_state);
-/**
- * Initialize the auhentication methods in backup mode.
- *
- * @param state the state to operate on
- */
-void
-init_b_auth_methods (json_t *state);
-
-
-/**
- * Get num of cols a widget takes in a grid.
- *
- * @param grid Grid the widget belongs to
- * @param widget Widget to look up
- * @return int
- */
-int
-get_widget_width (GtkGrid *grid,
- GtkWidget *widget);
-
-
-/**
- * Set policy check buttons according to policies in state.
- *
- * @param state the state to operate on
- */
-void
-set_policy_check_buttons (json_t *state);
-
-
-/**
- * Initialize the policies in backup mode.
- *
- * @param state the state to operate on
- */
-void
-init_b_policy (json_t *state);
-
-
-/**
- * Callback invoked if the the "back"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-void
-anastasis_gtk_main_window_back_clicked (GObject *object,
- gpointer user_data);
-
-
-/**
- * Callback invoked if the the "forward"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-void
-anastasis_gtk_main_window_forward_clicked (GObject *object,
- gpointer user_data);
-
-
/**
* Hides all frames;
*/
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis-gtk] branch master updated: work on anastasis-gtk (WiP),
gnunet <=