[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis-gtk] branch master updated: first work on auth dialog
From: |
gnunet |
Subject: |
[taler-anastasis-gtk] branch master updated: first work on auth dialog |
Date: |
Tue, 09 Mar 2021 10:50:05 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis-gtk.
The following commit(s) were added to refs/heads/master by this push:
new 7ae1589 first work on auth dialog
7ae1589 is described below
commit 7ae1589786a5118633df192922738fdfa7228c97
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Mar 9 10:50:03 2021 +0100
first work on auth dialog
---
contrib/anastasis_gtk_main_window.glade | 381 +++++++++++----------
src/anastasis/anastasis-gtk_action.c | 115 ++++++-
...astasis-gtk_handle-auth-edit-provider-clicked.c | 4 +-
src/anastasis/anastasis-gtk_helper.c | 14 +
src/anastasis/anastasis-gtk_helper.h | 10 +
5 files changed, 333 insertions(+), 191 deletions(-)
diff --git a/contrib/anastasis_gtk_main_window.glade
b/contrib/anastasis_gtk_main_window.glade
index e776f81..6498d3a 100644
--- a/contrib/anastasis_gtk_main_window.glade
+++ b/contrib/anastasis_gtk_main_window.glade
@@ -2,6 +2,11 @@
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.0"/>
+ <object class="GtkImage" id="add_image">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="stock">gtk-add</property>
+ </object>
<object class="GtkListStore" id="authentication_methods_liststore">
<columns>
<!-- column-name type -->
@@ -37,6 +42,11 @@
<property name="can-focus">False</property>
<property name="stock">gtk-yes</property>
</object>
+ <object class="GtkImage" id="image_question">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="stock">gtk-dialog-question</property>
+ </object>
<object class="GtkTreeStore" id="policy_review_treestore">
<columns>
<!-- column-name policy_name -->
@@ -637,35 +647,152 @@
<property
name="can-focus">False</property>
<property
name="orientation">vertical</property>
<child>
- <object class="GtkBox"
id="anastasis_gtk_b_authentication_hbox">
+ <object class="GtkFrame">
<property
name="visible">True</property>
<property
name="can-focus">False</property>
+ <property
name="margin-right">50</property>
+ <property
name="margin-end">50</property>
+ <property
name="hexpand">True</property>
+ <property
name="label-xalign">0</property>
+ <property
name="shadow-type">none</property>
<child>
- <object class="GtkBox"
id="anastasis_gtk_b_authentication_vbox">
+ <object class="GtkBox"
id="anastasis_gtk_add_auth_button_box">
<property
name="visible">True</property>
<property
name="can-focus">False</property>
- <property
name="orientation">vertical</property>
+ <property
name="margin-top">5</property>
+ <property
name="margin-bottom">4</property>
+ <property
name="spacing">8</property>
+ <property
name="homogeneous">True</property>
+ <child>
+ <object class="GtkButton"
id="anastasis_gtk_btn_add_auth_sms">
+ <property name="label"
translatable="yes">SMS</property>
+ <property
name="visible">True</property>
+ <property
name="can-focus">True</property>
+ <property
name="receives-default">True</property>
+ <signal name="clicked"
handler="anastasis_gtk_btn_add_auth_sms_clicked_cb" swapped="no"/>
+ </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_btn_add_auth_email">
+ <property name="label"
translatable="yes">Email</property>
+ <property
name="visible">True</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"/>
+ </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="GtkScrolledWindow">
+ <object class="GtkButton"
id="anastasis_gtk_btn_add_auth_question">
+ <property name="label"
translatable="yes">Question</property>
<property
name="visible">True</property>
<property
name="can-focus">True</property>
- <property
name="shadow-type">in</property>
+ <property
name="receives-default">True</property>
+ <property
name="image">image_question</property>
+ <signal name="clicked"
handler="anastasis_gtk_btn_add_auth_question_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_btn_add_auth_post">
+ <property name="label"
translatable="yes">Post</property>
+ <property
name="visible">True</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"/>
+ </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="GtkButton"
id="anastasis_gtk_btn_add_auth_video">
+ <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"/>
+ </object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">True</property>
+ <property
name="padding">5</property>
+ <property
name="position">4</property>
+ </packing>
+ </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">Which authorization method should be added?</property>
+ <attributes>
+ <attribute name="weight"
value="bold"/>
+ </attributes>
+ </object>
+ </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_b_authentication_hbox">
+ <property
name="visible">True</property>
+ <property
name="can-focus">False</property>
+ <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="GtkTreeView" id="anastasis_gtk_authentication_methods_list">
+ <object
class="GtkScrolledWindow">
<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>
+ <property
name="shadow-type">in</property>
<child>
- <object
class="GtkTreeViewColumn" id="auth_method_type">
+ <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>
+ <property
name="search-column">0</property>
+ <child
internal-child="selection">
+ <object
class="GtkTreeSelection"/>
+ </child>
+ <child>
+ <object
class="GtkTreeViewColumn" id="auth_method_type">
<property
name="sizing">autosize</property>
<property
name="title" translatable="yes">Type</property>
+ <property
name="clickable">True</property>
<property
name="reorderable">True</property>
<property
name="sort-indicator">True</property>
<property
name="sort-column-id">0</property>
@@ -675,10 +802,10 @@
<attribute
name="text">0</attribute>
</attributes>
</child>
- </object>
- </child>
- <child>
- <object
class="GtkTreeViewColumn" id="auth_method_visual">
+ </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>
@@ -688,17 +815,23 @@
<attribute
name="text">1</attribute>
</attributes>
</child>
+ </object>
+ </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>
+ <child type="label">
+ <object class="GtkLabel"
id="anastasis_gtk_authorization_methods_label">
+ <property
name="visible">True</property>
+ <property
name="can-focus">False</property>
+ <property name="label"
translatable="yes">Authorization methods configured so far:</property>
+ <attributes>
+ <attribute name="weight"
value="bold"/>
+ </attributes>
+ </object>
</child>
</object>
<packing>
@@ -708,188 +841,66 @@
</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>
- <property
name="fill">True</property>
- <property
name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkSeparator">
- <property
name="visible">True</property>
- <property
name="can-focus">False</property>
- </object>
- <packing>
- <property
name="expand">False</property>
- <property
name="fill">True</property>
- <property
name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment">
- <property
name="visible">True</property>
- <property
name="can-focus">False</property>
- <child>
- <object class="GtkBox">
+ <object class="GtkBox"
id="anastasis_gtk_authorization_meta_button_box">
<property
name="visible">True</property>
<property
name="can-focus">False</property>
+ <property
name="orientation">vertical</property>
<child>
- <object class="GtkFrame">
+ <object class="GtkButton"
id="anastasis_gtk_edit_provider_list">
+ <property name="label"
translatable="yes">Add provider</property>
<property
name="visible">True</property>
- <property
name="can-focus">False</property>
- <property
name="margin-right">50</property>
- <property
name="margin-end">50</property>
- <property
name="hexpand">True</property>
- <property
name="label-xalign">0</property>
- <property
name="shadow-type">none</property>
- <child>
- <object class="GtkBox">
- <property
name="visible">True</property>
- <property
name="can-focus">False</property>
- <property
name="spacing">8</property>
- <property
name="homogeneous">True</property>
- <child>
- <object
class="GtkButton" id="anastasis_gtk_btn_add_auth_sms">
- <property
name="label" translatable="yes">SMS</property>
- <property
name="can-focus">True</property>
- <property
name="receives-default">True</property>
- <signal
name="clicked" handler="anastasis_gtk_btn_add_auth_sms_clicked_cb"
swapped="no"/>
- </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_btn_add_auth_email">
- <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"/>
- </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_btn_add_auth_question">
- <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"/>
- </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_btn_add_auth_post">
- <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"/>
- </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="GtkButton" id="anastasis_gtk_btn_add_auth_video">
- <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"/>
- </object>
- <packing>
- <property
name="expand">False</property>
- <property
name="fill">True</property>
- <property
name="padding">5</property>
- <property
name="position">4</property>
- </packing>
- </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 authorization method to add:</property>
- <attributes>
- <attribute
name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
+ <property
name="can-focus">True</property>
+ <property
name="receives-default">True</property>
+ <property
name="image">add_image</property>
+ <signal name="clicked"
handler="anastasis_gtk_edit_provider_list_clicked_cb" swapped="no"/>
</object>
<packing>
- <property
name="expand">True</property>
- <property
name="fill">True</property>
+ <property
name="expand">False</property>
+ <property
name="fill">False</property>
+ <property
name="padding">10</property>
<property
name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkBox">
+ <object class="GtkButton"
id="anastasis_gtk_authentication_method_delete_button">
+ <property
name="label">gtk-delete</property>
<property
name="visible">True</property>
- <property
name="can-focus">False</property>
- <property
name="homogeneous">True</property>
- <child>
- <object
class="GtkButton" id="anastasis_gtk_btn_add_auth_edit_provider">
- <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>
- <signal name="clicked"
handler="anastasis_gtk_btn_add_auth_edit_provider_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>
+ <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">True</property>
+ <property
name="fill">False</property>
+ <property
name="padding">10</property>
<property
name="position">1</property>
</packing>
</child>
</object>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">False</property>
+ <property
name="padding">10</property>
+ <property
name="position">1</property>
+ </packing>
</child>
</object>
+ <packing>
+ <property
name="expand">True</property>
+ <property
name="fill">True</property>
+ <property
name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparator">
+ <property
name="visible">True</property>
+ <property
name="can-focus">False</property>
+ </object>
<packing>
<property
name="expand">False</property>
<property
name="fill">True</property>
- <property
name="pack-type">end</property>
<property
name="position">2</property>
</packing>
</child>
@@ -901,7 +912,7 @@ Providers</property>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="label"
translatable="yes">Configured authorization methods:</property>
+ <property name="label"
translatable="yes">Configure authorization methods!</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
diff --git a/src/anastasis/anastasis-gtk_action.c
b/src/anastasis/anastasis-gtk_action.c
index b1709e6..7d6004b 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -409,9 +409,6 @@ action_user_attributes_collecting (void)
struct GNUNET_HashCode uh;
GtkWidget *w = NULL;
- json_dumpf (id_attr,
- stderr,
- JSON_INDENT (2));
GNUNET_assert (GNUNET_OK ==
GNUNET_JSON_parse (id_attr,
spec,
@@ -503,11 +500,118 @@ action_user_attributes_collecting (void)
}
+static void
+activate_by_method (json_t *methods)
+{
+ size_t index;
+ const json_t *method;
+
+ json_array_foreach (methods,
+ index,
+ method)
+ {
+ const char *type;
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_string ("type",
+ &type),
+ GNUNET_JSON_spec_end ()
+ };
+
+ json_dumpf (method,
+ stderr,
+ JSON_INDENT (2));
+ if (GNUNET_OK !=
+ GNUNET_JSON_parse (method,
+ spec,
+ NULL, NULL))
+ {
+ GNUNET_break (0);
+ continue;
+ }
+
+ {
+ char btn[64];
+
+ GNUNET_snprintf (btn,
+ sizeof (btn),
+ "anastasis_gtk_btn_add_auth_%s",
+ type);
+ AG_sensitive (btn);
+ }
+ }
+}
+
+
static void
action_authentications_editing (void)
{
+ json_t *aps;
+
AG_hide_all_frames ();
- GNUNET_break (0);
+ AG_insensitive_children ("anastasis_gtk_add_auth_button_box");
+ aps = json_object_get (redux_state,
+ "authentication_providers");
+ {
+ const json_t *ap;
+ const char *provider_url;
+
+ json_object_foreach (aps,
+ provider_url,
+ ap)
+ {
+ uint32_t ec = 0;
+ uint32_t hc = 0;
+ json_t *methods;
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_uint32 ("error_code",
+ &ec)),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_json ("methods",
+ &methods)),
+ GNUNET_JSON_spec_uint32 ("http_status",
+ &hc),
+ GNUNET_JSON_spec_end ()
+ };
+
+ json_dumpf (ap,
+ stderr,
+ JSON_INDENT (2));
+ if (GNUNET_OK !=
+ GNUNET_JSON_parse (ap,
+ spec,
+ NULL, NULL))
+ {
+ GNUNET_break (0);
+ continue;
+ }
+ switch (hc)
+ {
+ case MHD_HTTP_OK:
+ if (NULL == methods)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Provider `%s' has no authentication methods?\n",
+ provider_url);
+ break;
+ }
+ activate_by_method (methods);
+ break;
+ default:
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Status of provider `%s' is %u/%u\n",
+ provider_url,
+ (unsigned int) ec,
+ (unsigned int) hc);
+ break;
+ }
+ GNUNET_JSON_parse_free (spec);
+ }
+ }
+ // FIXME: add logic to check if auth methods WERE added,
+ // and if so, make button sensitive!
+ AG_insensitive ("anastasis_gtk_main_window_forward_button");
+
AG_show ("anastasis_gtk_b_authentication_frame");
AG_show ("anastasis_gtk_b_authentication_methods_image");
@@ -519,6 +623,9 @@ action_policies_reviewing (void)
{
AG_hide_all_frames ();
GNUNET_break (0);
+ json_dumpf (redux_state,
+ stderr,
+ JSON_INDENT (2));
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_handle-auth-edit-provider-clicked.c
b/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
index 739427c..0acf4d1 100644
--- a/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
+++ b/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
@@ -38,8 +38,8 @@
* @param user_data unused
*/
void
-anastasis_gtk_btn_add_auth_edit_provider_clicked_cb (GtkButton *object,
- gpointer user_data)
+anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object,
+ gpointer user_data)
{
GNUNET_break (0);
#if 0
diff --git a/src/anastasis/anastasis-gtk_helper.c
b/src/anastasis/anastasis-gtk_helper.c
index bca58ee..73d682f 100644
--- a/src/anastasis/anastasis-gtk_helper.c
+++ b/src/anastasis/anastasis-gtk_helper.c
@@ -114,6 +114,20 @@ AG_show (const char *name)
}
+void
+AG_insensitive_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_set_sensitive (GTK_WIDGET (iter->data),
+ false);
+ g_list_free (children);
+}
+
+
void
AG_hide_children (const char *name)
{
diff --git a/src/anastasis/anastasis-gtk_helper.h
b/src/anastasis/anastasis-gtk_helper.h
index 8003768..c43633b 100644
--- a/src/anastasis/anastasis-gtk_helper.h
+++ b/src/anastasis/anastasis-gtk_helper.h
@@ -92,6 +92,16 @@ void
AG_hide_children (const char *name);
+/**
+ * Make all of the children of the container widget @a name in the main window
+ * insensitive.
+ *
+ * @param name name of the object
+ */
+void
+AG_insensitive_children (const char *name);
+
+
/**
* Show all of the children of the container widget @a name in the main window.
*
--
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: first work on auth dialog,
gnunet <=