[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis-gtk] branch master updated: fix ftbfs
From: |
gnunet |
Subject: |
[taler-anastasis-gtk] branch master updated: fix ftbfs |
Date: |
Sun, 07 Mar 2021 18:43:46 +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 0ecad29 fix ftbfs
0ecad29 is described below
commit 0ecad2902f9f553baff40603f8009cbc5aea724b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Mar 7 18:43:39 2021 +0100
fix ftbfs
---
src/anastasis/anastasis-gtk.c | 592 ++++++-----
src/anastasis/anastasis-gtk_backup.c | 1930 ++++++++++++++++++----------------
src/anastasis/anastasis-gtk_helper.c | 618 +++++------
src/include/anastasis-gtk_helper.h | 33 +-
4 files changed, 1655 insertions(+), 1518 deletions(-)
diff --git a/src/anastasis/anastasis-gtk.c b/src/anastasis/anastasis-gtk.c
index b57b902..e6cd54d 100644
--- a/src/anastasis/anastasis-gtk.c
+++ b/src/anastasis/anastasis-gtk.c
@@ -62,75 +62,75 @@ json_t *redux_state;
/**
* Callback invoked if the the "show animation"-menuitem (Help) is clicked.
- *
+ *
* @param menuitem the object which received the signal.
* @param user_data user data set when the signal handler was connected.
*/
void
anastasis_gtk_animation_activate_cb (GtkMenuItem *menuitem,
- gpointer user_data)
+ gpointer user_data)
{
- if (gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_illustration_vbox"))))
- gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_illustration_vbox")));
- else
- {
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_illustration_vbox")));
- //init pictures
- {
- char *path;
- path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX);
- if (NULL == path)
- {
- GNUNET_break (0);
- return;
- }
-
- //continent selection
- char *con_sel_path;
- GNUNET_asprintf (&con_sel_path,
- "%s/share/anastasis/continent_selection.png",
- path);
- GObject *con_sel_img = GCG_get_main_window_object (
-
"anastasis_gtk_continent_selection_image");
- gtk_image_set_from_file (GTK_IMAGE (con_sel_img), con_sel_path);
- GNUNET_free (con_sel_path);
-
- //country selection
- char *cou_sel_path;
- GNUNET_asprintf (&cou_sel_path,
- "%s/share/anastasis/country_selection.png",
- path);
- GObject *cou_sel_img = GCG_get_main_window_object (
-
"anastasis_gtk_country_selection_image");
- gtk_image_set_from_file (GTK_IMAGE (cou_sel_img), cou_sel_path);
- GNUNET_free (cou_sel_path);
-
- //user attributes
- char *user_attr_path;
- GNUNET_asprintf (&user_attr_path,
- "%s/share/anastasis/user_attributes.png",
- path);
- GObject *user_attr_img = GCG_get_main_window_object (
- "anastasis_gtk_user_attributes_image");
- gtk_image_set_from_file (GTK_IMAGE (user_attr_img), user_attr_path);
- GNUNET_free (user_attr_path);
-
- //authentication methods
- char *auth_meth_path;
- GNUNET_asprintf (&auth_meth_path,
- "%s/share/anastasis/authentication_methods.png",
- path);
- GObject *auth_meth_img = GCG_get_main_window_object (
-
"anastasis_gtk_b_authentication_methods_image");
- gtk_image_set_from_file (GTK_IMAGE (auth_meth_img), auth_meth_path);
- GNUNET_free (auth_meth_path);
-
- GNUNET_free (path);
- }
- }
+ if (gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_illustration_vbox"))))
+ gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_illustration_vbox")));
+ else
+ {
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_illustration_vbox")));
+ // init pictures
+ {
+ char *path;
+ path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX);
+ if (NULL == path)
+ {
+ GNUNET_break (0);
+ return;
+ }
+
+ // continent selection
+ char *con_sel_path;
+ GNUNET_asprintf (&con_sel_path,
+ "%s/share/anastasis/continent_selection.png",
+ path);
+ GObject *con_sel_img = GCG_get_main_window_object (
+ "anastasis_gtk_continent_selection_image");
+ gtk_image_set_from_file (GTK_IMAGE (con_sel_img), con_sel_path);
+ GNUNET_free (con_sel_path);
+
+ // country selection
+ char *cou_sel_path;
+ GNUNET_asprintf (&cou_sel_path,
+ "%s/share/anastasis/country_selection.png",
+ path);
+ GObject *cou_sel_img = GCG_get_main_window_object (
+ "anastasis_gtk_country_selection_image");
+ gtk_image_set_from_file (GTK_IMAGE (cou_sel_img), cou_sel_path);
+ GNUNET_free (cou_sel_path);
+
+ // user attributes
+ char *user_attr_path;
+ GNUNET_asprintf (&user_attr_path,
+ "%s/share/anastasis/user_attributes.png",
+ path);
+ GObject *user_attr_img = GCG_get_main_window_object (
+ "anastasis_gtk_user_attributes_image");
+ gtk_image_set_from_file (GTK_IMAGE (user_attr_img), user_attr_path);
+ GNUNET_free (user_attr_path);
+
+ // authentication methods
+ char *auth_meth_path;
+ GNUNET_asprintf (&auth_meth_path,
+ "%s/share/anastasis/authentication_methods.png",
+ path);
+ GObject *auth_meth_img = GCG_get_main_window_object (
+ "anastasis_gtk_b_authentication_methods_image");
+ gtk_image_set_from_file (GTK_IMAGE (auth_meth_img), auth_meth_path);
+ GNUNET_free (auth_meth_path);
+
+ GNUNET_free (path);
+ }
+ }
}
@@ -142,15 +142,17 @@ anastasis_gtk_animation_activate_cb (GtkMenuItem
*menuitem,
*/
void
anastasis_gtk_ia_birthdate_cal_day_selected_cb (GtkCellEditable *cell_editable,
- gpointer user_data)
+ gpointer user_data)
{
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")), false);
+ 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);
+ // 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);
}
@@ -164,13 +166,15 @@ 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);
+ 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);
+ // 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);
}
@@ -184,13 +188,15 @@ 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);
+ 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);
+ // 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);
}
@@ -204,13 +210,15 @@ 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);
+ 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);
+ // 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);
}
@@ -228,30 +236,37 @@ anastasis_gtk_continent_activated (GtkTreeView *tree_view,
GtkTreeViewColumn *column,
gpointer user_data)
{
- GtkTreeIter iter;
- GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
- GtkListStore *country_liststore = GTK_LIST_STORE
(GCG_get_main_window_object ("country_liststore"));
+ GtkTreeIter iter;
+ GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
+ GtkListStore *country_liststore = GTK_LIST_STORE (GCG_get_main_window_object
(
+ "country_liststore"));
- gtk_list_store_clear (country_liststore);
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")), false);
-
- if (gtk_tree_model_get_iter(model, &iter, path))
- {
- gchar *continent_name;
- json_t *arguments = json_object ();
- GNUNET_assert (NULL != arguments);
- gtk_tree_model_get (model, &iter, 0, &continent_name, -1);
- json_object_set (arguments, "continent", json_string (continent_name));
+ gtk_list_store_clear (country_liststore);
+ gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_main_window_forward_button")),
+ false);
- ra = ANASTASIS_redux_action (redux_state,
- "select_continent",
- arguments,
- NULL,
- &action_cb,
- NULL);
- g_free(continent_name);
- }
+ if (gtk_tree_model_get_iter (model, &iter, path))
+ {
+ gchar *continent_name;
+ json_t *arguments = json_object ();
+
+ GNUNET_assert (NULL != arguments);
+ gtk_tree_model_get (model,
+ &iter,
+ 0, &continent_name,
+ -1);
+ GNUNET_assert (0 ==
+ json_object_set_new (arguments,
+ "continent",
+ json_string (continent_name)));
+ ra = ANASTASIS_redux_action (redux_state,
+ "select_continent",
+ arguments,
+ &action_cb,
+ NULL);
+ g_free (continent_name);
+ }
}
@@ -269,43 +284,40 @@ anastasis_gtk_country_activated (GtkTreeView *tree_view,
GtkTreeViewColumn *column,
gpointer user_data)
{
- GtkTreeIter iter;
- GtkTreeModel *model= gtk_tree_view_get_model (tree_view);
-
- if (gtk_tree_model_get_iter(model, &iter, path))
- {
- gchar *country_name;
- gchar *country_code;
- gchar *country_currency;
- json_t *arguments = json_object ();
-
- if (NULL == arguments)
- {
- GNUNET_break (0);
- }
- gtk_tree_model_get (model, &iter,
- 0, &country_name,
- 1, &country_code,
- 2, &country_currency,
- -1);
- json_object_set (arguments, "country", json_string (country_name));
- json_object_set (arguments, "country_code", json_string
(country_code));
- json_object_set (arguments, "currency", json_string
(country_currency));
-
- reset_authentication_providers ();
- if (check_state (redux_state,
- ANASTASIS_generic_state_to_string
(ANASTASIS_GENERIC_STATE_COUNTRY_SELECTION)))
- ra = ANASTASIS_redux_action (redux_state,
- "select_country",
- arguments,
- ctx,
- &action_cb,
- NULL);
-
- g_free(country_name);
- g_free(country_code);
- g_free(country_currency);
- }
+ GtkTreeIter iter;
+ GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
+
+ if (gtk_tree_model_get_iter (model, &iter, path))
+ {
+ gchar *country_name;
+ gchar *country_code;
+ gchar *country_currency;
+ json_t *arguments = json_object ();
+
+ if (NULL == arguments)
+ {
+ GNUNET_break (0);
+ }
+ gtk_tree_model_get (model, &iter,
+ 0, &country_name,
+ 1, &country_code,
+ 2, &country_currency,
+ -1);
+ json_object_set (arguments, "country", json_string (country_name));
+ json_object_set (arguments, "country_code", json_string (country_code));
+ json_object_set (arguments, "currency", json_string (country_currency));
+
+ reset_authentication_providers ();
+ ra = ANASTASIS_redux_action (redux_state,
+ "select_country",
+ arguments,
+ &action_cb,
+ NULL);
+
+ g_free (country_name);
+ g_free (country_code);
+ g_free (country_currency);
+ }
}
@@ -319,16 +331,16 @@ void
anastasis_gtk_continent_unselected (GtkTreeSelection *selection,
gpointer user_data)
{
- GtkTreeModel *model;
- if (! gtk_tree_selection_get_selected (selection, &model, NULL)
- && ! check_state (redux_state,
- ANASTASIS_generic_state_to_string
(ANASTASIS_GENERIC_STATE_CONTINENT_SELECTION)))
- ra = ANASTASIS_redux_action (redux_state,
- "unselect_continent",
- NULL,
- NULL,
- &action_cb,
- NULL);
+ GtkTreeModel *model;
+
+ if (! gtk_tree_selection_get_selected (selection,
+ &model,
+ NULL))
+ ra = ANASTASIS_redux_action (redux_state,
+ "unselect_continent",
+ NULL,
+ &action_cb,
+ NULL);
}
@@ -342,17 +354,16 @@ void
anastasis_gtk_country_unselected (GtkTreeSelection *selection,
gpointer user_data)
{
- GtkTreeModel *model;
-
- if (! gtk_tree_selection_get_selected (selection, &model, NULL)
- && check_state (redux_state,
- ANASTASIS_generic_state_to_string
(ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION)))
- ra = ANASTASIS_redux_action (redux_state,
- "unselect_country",
- NULL,
- NULL,
- &action_cb,
- NULL);
+ GtkTreeModel *model;
+
+ if (! gtk_tree_selection_get_selected (selection,
+ &model,
+ NULL))
+ ra = ANASTASIS_redux_action (redux_state,
+ "unselect_country",
+ NULL,
+ &action_cb,
+ NULL);
}
@@ -366,24 +377,23 @@ void
anastasis_gtk_main_window_back_clicked (GObject *object,
gpointer user_data)
{
- ra = ANASTASIS_redux_action (redux_state,
- "back",
- NULL,
- NULL,
- &action_cb,
- NULL);
- //show identity frame, hide authentication frame
- if (check_state (redux_state,
- ANASTASIS_generic_state_to_string
(ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION)) &&
- gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_b_authentication_frame"))))
- {
- anastasis_gtk_hide_all_frames ();
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_identity_frame")));
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_user_attributes_image")));
- }
+ ra = ANASTASIS_redux_action (redux_state,
+ "back",
+ NULL,
+ &action_cb,
+ NULL);
+ // show identity frame, hide authentication frame
+ if (check_state (redux_state,
+ "USER_ATTRIBUTES_COLLECTION") &&
+ gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_b_authentication_frame"))))
+ {
+ anastasis_gtk_hide_all_frames ();
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_identity_frame")));
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_user_attributes_image")));
+ }
}
@@ -397,115 +407,121 @@ void
anastasis_gtk_main_window_forward_clicked (GObject *object,
gpointer user_data)
{
- //show identity frame, hide continent frame
- if (check_state (redux_state,
- ANASTASIS_generic_state_to_string
(ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION)) &&
- gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_continent_frame"))))
+ // show identity frame, hide continent frame
+ if (check_state (redux_state,
+ "USER_ATTRIBUTES_COLLECTION") &&
+ gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_continent_frame"))))
+ {
+ anastasis_gtk_hide_all_frames ();
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_identity_frame")));
+ gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_main_window_forward_button")),
+ false);
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_user_attributes_image")));
+ }
+
+ // show backup authentication methods frame, hide identity frame
+ if (gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_identity_frame"))) &&
+ check_attributes_fullfilled ())
+ {
+ GList *children, *iter;
+ json_t *arguments = json_object ();
+ json_t *id_attr = json_object ();
+
+ children = gtk_container_get_children (GTK_CONTAINER (
+ GCG_get_main_window_object (
+
"anastasis_gtk_identity_vbox")));
+ for (iter = children; iter != NULL; iter = g_list_next (iter))
{
- anastasis_gtk_hide_all_frames ();
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_identity_frame")));
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")), false);
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_user_attributes_image")));
+ char *entry_widget;
+ char *cal_widget;
+ const char *widget = gtk_buildable_get_name (iter->data);
+
+ GNUNET_asprintf (&entry_widget,
+ "%s_entry",
+ widget);
+ GNUNET_asprintf (&cal_widget,
+ "%s_cal",
+ widget);
+
+ if (GCG_get_main_window_object (entry_widget))
+ {
+ const char *value = gtk_entry_get_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ entry_widget)));
+ if (0 == strlen (value))
+ break;
+ if (strstr (widget, "ia_ahv"))
+ json_object_set_new (id_attr, "ahv_number", json_string (value));
+ if (strstr (widget, "ia_ssn"))
+ json_object_set_new (id_attr, "social_security_number", json_string (
+ value));
+ if (strstr (widget, "ia_full_name"))
+ json_object_set_new (id_attr, "full_name", json_string (value));
+ }
+ if (GCG_get_main_window_object (cal_widget))
+ {
+ guint day;
+ guint month;
+ guint year;
+
+ gtk_calendar_get_date (GTK_CALENDAR (GCG_get_main_window_object (
+ cal_widget)),
+ &year,
+ &month,
+ &day);
+ json_object_set_new (id_attr, "birth_year", json_integer (year));
+ json_object_set_new (id_attr, "birth_month", json_integer (month));
+ json_object_set_new (id_attr, "birth_day", json_integer (day));
+ }
+ GNUNET_free (entry_widget);
+ GNUNET_free (cal_widget);
}
+ json_object_set_new (arguments, "identity_attributes", id_attr);
- //show backup authentication methods frame, hide identity frame
- if (gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_identity_frame"))) &&
- check_attributes_fullfilled ())
+ if (check_state (redux_state,
+ "USER_ATTRIBUTES_COLLECTION"))
{
- GList *children, *iter;
- json_t *arguments = json_object ();
- json_t *id_attr = json_object ();
-
- children = gtk_container_get_children (GTK_CONTAINER
(GCG_get_main_window_object (
-
"anastasis_gtk_identity_vbox")));
- for (iter = children; iter != NULL; iter = g_list_next (iter))
- {
- char *entry_widget;
- char *cal_widget;
- const char *widget = gtk_buildable_get_name (iter->data);
-
- GNUNET_asprintf (&entry_widget,
- "%s_entry",
- widget);
- GNUNET_asprintf (&cal_widget,
- "%s_cal",
- widget);
-
- if (GCG_get_main_window_object (entry_widget))
- {
- const char *value = gtk_entry_get_text (GTK_ENTRY
(GCG_get_main_window_object (entry_widget)));
- if (0 == strlen (value))
- break;
- if (strstr (widget, "ia_ahv"))
- json_object_set_new (id_attr, "ahv_number", json_string
(value));
- if (strstr (widget, "ia_ssn"))
- json_object_set_new (id_attr, "social_security_number",
json_string (value));
- if (strstr (widget, "ia_full_name"))
- json_object_set_new (id_attr, "full_name", json_string
(value));
- }
- if (GCG_get_main_window_object (cal_widget))
- {
- guint day;
- guint month;
- guint year;
-
- gtk_calendar_get_date (GTK_CALENDAR
(GCG_get_main_window_object (cal_widget)),
- &year,
- &month,
- &day);
- json_object_set_new (id_attr, "birth_year", json_integer
(year));
- json_object_set_new (id_attr, "birth_month", json_integer
(month));
- json_object_set_new (id_attr, "birth_day", json_integer (day));
- }
- GNUNET_free (entry_widget);
- GNUNET_free (cal_widget);
- }
- json_object_set_new (arguments, "identity_attributes", id_attr);
-
- if (check_state (redux_state,
- ANASTASIS_generic_state_to_string
(ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION)))
- {
- json_t *auth_providers = get_authentication_providers ();
- if (NULL != auth_providers)
- json_object_set_new (arguments,
- "authentication_providers",
- auth_providers);
- ra = ANASTASIS_redux_action (redux_state,
- "enter_user_attributes",
- arguments,
- NULL,
- &action_cb,
- NULL);
- }
-
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")), false);
- g_list_free (children);
+ json_t *auth_providers = get_authentication_providers ();
+ if (NULL != auth_providers)
+ json_object_set_new (arguments,
+ "authentication_providers",
+ auth_providers);
+ ra = ANASTASIS_redux_action (redux_state,
+ "enter_user_attributes",
+ arguments,
+ &action_cb,
+ NULL);
}
- //show backup policy frame, hide backup authentication methods frame
- if (gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_b_authentication_frame"))))
+ gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_main_window_forward_button")),
+ false);
+ g_list_free (children);
+ }
+
+ // show backup policy frame, hide backup authentication methods frame
+ if (gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_b_authentication_frame"))))
+ {
+ if (check_state (redux_state,
+ "AUTHENTICATIONS_EDITING"))
{
- if (check_state (redux_state,
- ANASTASIS_backup_state_to_string
(ANASTASIS_BACKUP_STATE_AUTHENTICATIONS_EDITING)))
- {
- json_t *auth_methods = json_object_get (redux_state,
"authentication_methods");
-
- if (json_array_size (auth_methods) > 0)
- ra = ANASTASIS_redux_action (redux_state,
- "next",
- NULL,
- NULL,
- &action_cb,
- NULL);
- }
+ json_t *auth_methods = json_object_get (redux_state,
+ "authentication_methods");
+
+ if (json_array_size (auth_methods) > 0)
+ ra = ANASTASIS_redux_action (redux_state,
+ "next",
+ NULL,
+ &action_cb,
+ NULL);
}
+ }
}
@@ -519,7 +535,7 @@ shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Shutdown initiated\n");
-
+
GNUNET_GTK_main_loop_quit (ml);
ml = NULL;
diff --git a/src/anastasis/anastasis-gtk_backup.c
b/src/anastasis/anastasis-gtk_backup.c
index 3c96a41..687f72b 100644
--- a/src/anastasis/anastasis-gtk_backup.c
+++ b/src/anastasis/anastasis-gtk_backup.c
@@ -26,7 +26,6 @@
*/
#include <gnunet/platform.h>
#include <gnunet/gnunet_util_lib.h>
-#include <taler/taler_json_lib.h>
#include "anastasis-gtk_helper.h"
#include <jansson.h>
@@ -40,75 +39,75 @@ 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)
+ 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)
{
- 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,
- NULL,
- &action_cb,
- NULL);
- }
- index++;
- }
- gtk_widget_destroy (iter->data);
- }
+ 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,
+ &action_cb,
+ NULL);
}
- g_list_free (user_data_children);
- }
+ index++;
+ }
+ gtk_widget_destroy (iter->data);
+ }
+ }
+ g_list_free (user_data_children);
+ }
}
@@ -133,25 +132,26 @@ void
anastasis_gtk_backup_button_clicked (GObject *object,
gpointer user_data)
{
- redux_state = ANASTASIS_backup_start (cfg);
- GNUNET_assert (0 == persist_state (redux_state));
-
- if (check_state (redux_state,
- ANASTASIS_generic_state_to_string
(ANASTASIS_GENERIC_STATE_CONTINENT_SELECTION)))
- {
- init_continent_list (redux_state);
-
- gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_start_frame")));
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_main_control_vbox")));
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_continent_frame")));
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_continent_selection_image")));
- }
+ redux_state = ANASTASIS_backup_start (cfg);
+ GNUNET_assert (0 == persist_state (redux_state));
+
+ if (check_state (redux_state,
+ "CONTINENT_SELECTION"))
+ {
+ init_continent_list (redux_state);
+
+ gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_start_frame")));
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_main_control_vbox")));
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_continent_frame")));
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_continent_selection_image")));
+ }
}
+
/**
* Callback invoked if the the "backup"-button is clicked.
*
@@ -161,8 +161,8 @@ anastasis_gtk_backup_button_clicked (GObject *object,
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")));
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_edit_provider_dialog")));
}
@@ -176,15 +176,17 @@ 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);
+ 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);
}
@@ -198,89 +200,104 @@ void
anastasis_gtk_b_question_dialog_btn_ok_clicked_cb (GObject *object,
gpointer user_data)
{
- GtkHBox *hbox;
- 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 (
- GTK_ENTRY (GCG_get_main_window_object
("anastasis_gtk_b_question_dialog_question_entry")));
- GtkLabel *label_question = (GtkLabel *) gtk_label_new (question);
- const gchar *answer = gtk_entry_get_text (
- GTK_ENTRY (GCG_get_main_window_object
("anastasis_gtk_b_question_dialog_answer_entry")));
- GtkLabel *label_answer = (GtkLabel *) gtk_label_new (answer);
- {
- //build json arguments for reducer
- json_t *arguments = json_object ();
- json_t *auth_method = json_object ();
- json_t *method_data = json_object ();
-
- GNUNET_assert (0 == json_object_set_new (auth_method, "method",
json_string ("question")));
- GNUNET_assert (0 == json_object_set_new (method_data, "question",
json_string (question)));
- GNUNET_assert (0 == json_object_set_new (method_data, "answer",
json_string (answer)));
- GNUNET_assert (0 == json_object_set_new (auth_method, "data",
method_data));
- GNUNET_assert (0 == json_object_set_new (arguments,
"authentication_method", auth_method));
-
- ra = ANASTASIS_redux_action (redux_state,
- "add_authentication",
- arguments,
- NULL,
- &action_cb,
- NULL);
- }
-
- // set buttons
- GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new(1, 0);
- GtkButton *edit_btn = (GtkButton *) gtk_button_new_from_icon_name
("gtk-edit", GTK_ICON_SIZE_BUTTON);
- g_signal_connect (edit_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_auth_method_btn_edit_clicked_cb),
- hbox);
- GtkButton *delete_btn = (GtkButton *) gtk_button_new_from_icon_name
("gtk-delete", GTK_ICON_SIZE_BUTTON);
- g_signal_connect (delete_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
- hbox);
- gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
-
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_question), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_answer), 0, 0, 0);
- gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
-
- if (! is_box)
- {
- gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
- }
-
- gtk_widget_show (GTK_WIDGET (hbox));
- gtk_widget_show (GTK_WIDGET (label_prefix));
- gtk_widget_show (GTK_WIDGET (label_question));
- gtk_widget_hide (GTK_WIDGET (label_answer));
- gtk_widget_show (GTK_WIDGET (buttons));
- gtk_widget_show (GTK_WIDGET (edit_btn));
- gtk_widget_show (GTK_WIDGET (delete_btn));
-
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_question_dialog_question_entry")), "");
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_question_dialog_answer_entry")), "");
- gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_question_dialog")));
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")), true);
+ GtkHBox *hbox;
+ 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 (
+ GTK_ENTRY (GCG_get_main_window_object (
+ "anastasis_gtk_b_question_dialog_question_entry")));
+ GtkLabel *label_question = (GtkLabel *) gtk_label_new (question);
+ const gchar *answer = gtk_entry_get_text (
+ GTK_ENTRY (GCG_get_main_window_object (
+ "anastasis_gtk_b_question_dialog_answer_entry")));
+ GtkLabel *label_answer = (GtkLabel *) gtk_label_new (answer);
+ {
+ // build json arguments for reducer
+ json_t *arguments = json_object ();
+ json_t *auth_method = json_object ();
+ json_t *method_data = json_object ();
+
+ GNUNET_assert (0 == json_object_set_new (auth_method, "method",
+ json_string ("question")));
+ GNUNET_assert (0 == json_object_set_new (method_data, "question",
+ json_string (question)));
+ GNUNET_assert (0 == json_object_set_new (method_data, "answer",
+ json_string (answer)));
+ GNUNET_assert (0 == json_object_set_new (auth_method, "data",
method_data));
+ GNUNET_assert (0 == json_object_set_new (arguments,
+ "authentication_method",
+ auth_method));
+
+ ra = ANASTASIS_redux_action (redux_state,
+ "add_authentication",
+ arguments,
+ &action_cb,
+ NULL);
+ }
+
+ // set buttons
+ GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new (1, 0);
+ GtkButton *edit_btn = (GtkButton *) gtk_button_new_from_icon_name (
+ "gtk-edit", GTK_ICON_SIZE_BUTTON);
+ g_signal_connect (edit_btn,
+ "clicked",
+ G_CALLBACK (
+ anastasis_gtk_b_auth_method_btn_edit_clicked_cb),
+ hbox);
+ GtkButton *delete_btn = (GtkButton *) gtk_button_new_from_icon_name (
+ "gtk-delete", GTK_ICON_SIZE_BUTTON);
+ g_signal_connect (delete_btn,
+ "clicked",
+ G_CALLBACK (
+ anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
+ hbox);
+ gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
+
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_question), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_answer), 0, 0, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
+
+ if (! is_box)
+ {
+ gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
+ }
+
+ gtk_widget_show (GTK_WIDGET (hbox));
+ gtk_widget_show (GTK_WIDGET (label_prefix));
+ gtk_widget_show (GTK_WIDGET (label_question));
+ gtk_widget_hide (GTK_WIDGET (label_answer));
+ gtk_widget_show (GTK_WIDGET (buttons));
+ gtk_widget_show (GTK_WIDGET (edit_btn));
+ gtk_widget_show (GTK_WIDGET (delete_btn));
+
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_question_dialog_question_entry")),
+ "");
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_question_dialog_answer_entry")),
"");
+ gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_question_dialog")));
+ gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_main_window_forward_button")),
+ true);
}
@@ -294,16 +311,17 @@ void
anastasis_gtk_btn_add_auth_question_clicked_cb (GObject *object,
gpointer user_data)
{
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_question_dialog")));
- GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
-
"anastasis_gtk_b_question_dialog_btn_ok"));
- if (g_signal_question > 0)
- g_signal_handler_disconnect (ok_btn, g_signal_question);
- g_signal_question = g_signal_connect(ok_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_question_dialog_btn_ok_clicked_cb),
- NULL);
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_question_dialog")));
+ GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+ "anastasis_gtk_b_question_dialog_btn_ok"));
+ if (g_signal_question > 0)
+ g_signal_handler_disconnect (ok_btn, g_signal_question);
+ g_signal_question = g_signal_connect (ok_btn,
+ "clicked",
+ G_CALLBACK (
+
anastasis_gtk_b_question_dialog_btn_ok_clicked_cb),
+ NULL);
}
@@ -317,12 +335,15 @@ void
anastasis_gtk_b_question_dialog_btn_cancel_clicked_cb (GObject *object,
gpointer user_data)
{
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_question_dialog_question_entry")), "");
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_question_dialog_answer_entry")), "");
- gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_question_dialog")));
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_question_dialog_question_entry")),
+ "");
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_question_dialog_answer_entry")),
"");
+ gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_question_dialog")));
}
@@ -336,111 +357,126 @@ void
anastasis_gtk_b_post_dialog_btn_ok_clicked_cb (GObject *object,
gpointer user_data)
{
- GtkHBox *hbox;
- 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 ("POST: ");
- const gchar *full_name = gtk_entry_get_text (
- GTK_ENTRY (GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_full_name_entry")));
- GtkLabel *label_full_name = (GtkLabel *) gtk_label_new (full_name);
- const gchar *street = gtk_entry_get_text (
- GTK_ENTRY (GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_street_entry")));
- GtkLabel *label_street = (GtkLabel *) gtk_label_new (street);
- const gchar *city = gtk_entry_get_text (
- GTK_ENTRY (GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_city_entry")));
- GtkLabel *label_city = (GtkLabel *) gtk_label_new (city);
- const gchar *postcode = gtk_entry_get_text (
- GTK_ENTRY (GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_postcode_entry")));
- GtkLabel *label_postcode = (GtkLabel *) gtk_label_new (postcode);
- const gchar *country = gtk_entry_get_text (
- GTK_ENTRY (GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_country_entry")));
- GtkLabel *label_country = (GtkLabel *) gtk_label_new (country);
- {
- //build json arguments for reducer
- json_t *arguments = json_object ();
- json_t *auth_method = json_object ();
- json_t *method_data = json_object ();
-
- json_object_set_new (auth_method, "method", json_string ("post"));
- json_object_set_new (method_data, "full_name", json_string
(full_name));
- json_object_set_new (method_data, "street", json_string (street));
- json_object_set_new (method_data, "city", json_string (city));
- json_object_set_new (method_data, "postcode", json_string
(postcode));
- json_object_set_new (method_data, "country", json_string (country));
- json_object_set_new (auth_method, "data", method_data);
- json_object_set_new (arguments, "authentication_method",
method_data);
-
- ra = ANASTASIS_redux_action (redux_state,
- "add_authentication",
- arguments,
- NULL,
- &action_cb,
- NULL);
- }
-
- // set buttons
- GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new(1, 0);
- GtkButton *edit_btn = (GtkButton *) gtk_button_new_from_icon_name
("gtk-edit", GTK_ICON_SIZE_BUTTON);
- g_signal_connect (edit_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_auth_method_btn_edit_clicked_cb),
- hbox);
- GtkButton *delete_btn = (GtkButton *) gtk_button_new_from_icon_name
("gtk-delete", GTK_ICON_SIZE_BUTTON);
- g_signal_connect (delete_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
- hbox);
- gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
-
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_full_name), 0, 0,
0);
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_street), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_city), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_postcode), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_country), 0, 0, 0);
- gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
-
- if (! is_box)
- {
- gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
- }
-
- gtk_widget_show (GTK_WIDGET (hbox));
- gtk_widget_show (GTK_WIDGET (label_prefix));
- gtk_widget_show (GTK_WIDGET (label_full_name));
- gtk_widget_show (GTK_WIDGET (label_street));
- gtk_widget_show (GTK_WIDGET (label_city));
- gtk_widget_show (GTK_WIDGET (label_postcode));
- gtk_widget_show (GTK_WIDGET (label_country));
- gtk_widget_show (GTK_WIDGET (buttons));
- gtk_widget_show (GTK_WIDGET (edit_btn));
- gtk_widget_show (GTK_WIDGET (delete_btn));
-
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_full_name_entry")), "");
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_street_entry")), "");
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_city_entry")), "");
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_postcode_entry")), "");
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_country_entry")), "");
- gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_post_dialog")));
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")), true);
+ GtkHBox *hbox;
+ 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 ("POST: ");
+ const gchar *full_name = gtk_entry_get_text (
+ GTK_ENTRY (GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_full_name_entry")));
+ GtkLabel *label_full_name = (GtkLabel *) gtk_label_new (full_name);
+ const gchar *street = gtk_entry_get_text (
+ GTK_ENTRY (GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_street_entry")));
+ GtkLabel *label_street = (GtkLabel *) gtk_label_new (street);
+ const gchar *city = gtk_entry_get_text (
+ GTK_ENTRY (GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_city_entry")));
+ GtkLabel *label_city = (GtkLabel *) gtk_label_new (city);
+ const gchar *postcode = gtk_entry_get_text (
+ GTK_ENTRY (GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_postcode_entry")));
+ GtkLabel *label_postcode = (GtkLabel *) gtk_label_new (postcode);
+ const gchar *country = gtk_entry_get_text (
+ GTK_ENTRY (GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_country_entry")));
+ GtkLabel *label_country = (GtkLabel *) gtk_label_new (country);
+ {
+ // build json arguments for reducer
+ json_t *arguments = json_object ();
+ json_t *auth_method = json_object ();
+ json_t *method_data = json_object ();
+
+ json_object_set_new (auth_method, "method", json_string ("post"));
+ json_object_set_new (method_data, "full_name", json_string (full_name));
+ json_object_set_new (method_data, "street", json_string (street));
+ json_object_set_new (method_data, "city", json_string (city));
+ json_object_set_new (method_data, "postcode", json_string (postcode));
+ json_object_set_new (method_data, "country", json_string (country));
+ json_object_set_new (auth_method, "data", method_data);
+ json_object_set_new (arguments, "authentication_method", method_data);
+
+ ra = ANASTASIS_redux_action (redux_state,
+ "add_authentication",
+ arguments,
+ &action_cb,
+ NULL);
+ }
+
+ // set buttons
+ GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new (1, 0);
+ GtkButton *edit_btn = (GtkButton *) gtk_button_new_from_icon_name (
+ "gtk-edit", GTK_ICON_SIZE_BUTTON);
+ g_signal_connect (edit_btn,
+ "clicked",
+ G_CALLBACK (
+ anastasis_gtk_b_auth_method_btn_edit_clicked_cb),
+ hbox);
+ GtkButton *delete_btn = (GtkButton *) gtk_button_new_from_icon_name (
+ "gtk-delete", GTK_ICON_SIZE_BUTTON);
+ g_signal_connect (delete_btn,
+ "clicked",
+ G_CALLBACK (
+ anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
+ hbox);
+ gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
+
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_full_name), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_street), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_city), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_postcode), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_country), 0, 0, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
+
+ if (! is_box)
+ {
+ gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
+ }
+
+ gtk_widget_show (GTK_WIDGET (hbox));
+ gtk_widget_show (GTK_WIDGET (label_prefix));
+ gtk_widget_show (GTK_WIDGET (label_full_name));
+ gtk_widget_show (GTK_WIDGET (label_street));
+ gtk_widget_show (GTK_WIDGET (label_city));
+ gtk_widget_show (GTK_WIDGET (label_postcode));
+ gtk_widget_show (GTK_WIDGET (label_country));
+ gtk_widget_show (GTK_WIDGET (buttons));
+ gtk_widget_show (GTK_WIDGET (edit_btn));
+ gtk_widget_show (GTK_WIDGET (delete_btn));
+
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_full_name_entry")), "");
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_street_entry")), "");
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_city_entry")), "");
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_postcode_entry")), "");
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_country_entry")), "");
+ gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog")));
+ gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_main_window_forward_button")),
+ true);
}
@@ -452,18 +488,19 @@ anastasis_gtk_b_post_dialog_btn_ok_clicked_cb (GObject
*object,
*/
void
anastasis_gtk_btn_add_auth_post_clicked_cb (GObject *object,
- gpointer user_data)
+ gpointer user_data)
{
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_post_dialog")));
- GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
- "anastasis_gtk_b_post_dialog_btn_ok"));
- if (g_signal_post > 0)
- g_signal_handler_disconnect (ok_btn, g_signal_post);
- g_signal_post = g_signal_connect(ok_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_post_dialog_btn_ok_clicked_cb),
- NULL);
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog")));
+ GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_btn_ok"));
+ if (g_signal_post > 0)
+ g_signal_handler_disconnect (ok_btn, g_signal_post);
+ g_signal_post = g_signal_connect (ok_btn,
+ "clicked",
+ G_CALLBACK (
+
anastasis_gtk_b_post_dialog_btn_ok_clicked_cb),
+ NULL);
}
@@ -477,18 +514,23 @@ void
anastasis_gtk_b_post_dialog_btn_cancel_clicked_cb (GObject *object,
gpointer user_data)
{
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_full_name_entry")), "");
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_street_entry")), "");
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_city_entry")), "");
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_postcode_entry")), "");
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_country_entry")), "");
- gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_post_dialog")));
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_full_name_entry")), "");
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_street_entry")), "");
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_city_entry")), "");
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_postcode_entry")), "");
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_country_entry")), "");
+ gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog")));
}
@@ -502,79 +544,87 @@ void
anastasis_gtk_b_video_dialog_btn_ok_clicked_cb (GObject *object,
gpointer user_data)
{
- GtkHBox *hbox;
- 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 ("VIDEO: ");
- const gchar *photo_path = gtk_entry_get_text (
- GTK_ENTRY (GCG_get_main_window_object
("anastasis_gtk_b_video_dialog_photo_path_entry")));
- GtkLabel *label_photo_path = (GtkLabel *) gtk_label_new (photo_path);
- {
- //build json arguments for reducer
- json_t *arguments = json_object ();
- json_t *auth_method = json_object ();
- json_t *method_data = json_object ();
-
- json_object_set_new (auth_method, "method", json_string ("video"));
- json_object_set_new (method_data, "picture", json_string
(photo_path)); // FIXME: load photo, not only path
- json_object_set_new (auth_method, "data", method_data);
- json_object_set_new (arguments, "authentication_method",
method_data);
-
- ra = ANASTASIS_redux_action (redux_state,
- "add_authentication",
- arguments,
- NULL,
- &action_cb,
- NULL);
- }
-
- // set buttons
- GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new(1, 0);
- GtkButton *edit_btn = (GtkButton *) gtk_button_new_from_icon_name
("gtk-edit", GTK_ICON_SIZE_BUTTON);
- g_signal_connect (edit_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_auth_method_btn_edit_clicked_cb),
- hbox);
- GtkButton *delete_btn = (GtkButton *) gtk_button_new_from_icon_name
("gtk-delete", GTK_ICON_SIZE_BUTTON);
- g_signal_connect (delete_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
- hbox);
- gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
-
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_photo_path), 0, 0,
0);
- gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
-
- if (! is_box)
- {
- gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
- }
-
- gtk_widget_show (GTK_WIDGET (hbox));
- gtk_widget_show (GTK_WIDGET (label_prefix));
- gtk_widget_show (GTK_WIDGET (label_photo_path));
- gtk_widget_show (GTK_WIDGET (buttons));
- gtk_widget_show (GTK_WIDGET (edit_btn));
- gtk_widget_show (GTK_WIDGET (delete_btn));
-
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_video_dialog_photo_path_entry")), "");
- gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_video_dialog")));
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")), true);
+ GtkHBox *hbox;
+ 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 ("VIDEO: ");
+ const gchar *photo_path = gtk_entry_get_text (
+ GTK_ENTRY (GCG_get_main_window_object (
+ "anastasis_gtk_b_video_dialog_photo_path_entry")));
+ GtkLabel *label_photo_path = (GtkLabel *) gtk_label_new (photo_path);
+ {
+ // build json arguments for reducer
+ json_t *arguments = json_object ();
+ json_t *auth_method = json_object ();
+ json_t *method_data = json_object ();
+
+ json_object_set_new (auth_method, "method", json_string ("video"));
+ json_object_set_new (method_data, "picture", json_string (photo_path));
// FIXME: load photo, not only path
+ json_object_set_new (auth_method, "data", method_data);
+ json_object_set_new (arguments, "authentication_method", method_data);
+
+ ra = ANASTASIS_redux_action (redux_state,
+ "add_authentication",
+ arguments,
+ &action_cb,
+ NULL);
+ }
+
+ // set buttons
+ GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new (1, 0);
+ GtkButton *edit_btn = (GtkButton *) gtk_button_new_from_icon_name (
+ "gtk-edit", GTK_ICON_SIZE_BUTTON);
+ g_signal_connect (edit_btn,
+ "clicked",
+ G_CALLBACK (
+ anastasis_gtk_b_auth_method_btn_edit_clicked_cb),
+ hbox);
+ GtkButton *delete_btn = (GtkButton *) gtk_button_new_from_icon_name (
+ "gtk-delete", GTK_ICON_SIZE_BUTTON);
+ g_signal_connect (delete_btn,
+ "clicked",
+ G_CALLBACK (
+ anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
+ hbox);
+ gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
+
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_photo_path), 0, 0, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
+
+ if (! is_box)
+ {
+ gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
+ }
+
+ gtk_widget_show (GTK_WIDGET (hbox));
+ gtk_widget_show (GTK_WIDGET (label_prefix));
+ gtk_widget_show (GTK_WIDGET (label_photo_path));
+ gtk_widget_show (GTK_WIDGET (buttons));
+ gtk_widget_show (GTK_WIDGET (edit_btn));
+ gtk_widget_show (GTK_WIDGET (delete_btn));
+
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_video_dialog_photo_path_entry")),
+ "");
+ gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_video_dialog")));
+ gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_main_window_forward_button")),
+ true);
}
@@ -586,18 +636,19 @@ anastasis_gtk_b_video_dialog_btn_ok_clicked_cb (GObject
*object,
*/
void
anastasis_gtk_btn_add_auth_video_clicked_cb (GObject *object,
- gpointer user_data)
+ gpointer user_data)
{
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_video_dialog")));
- GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
-
"anastasis_gtk_b_video_dialog_btn_ok"));
- if (g_signal_video > 0)
- g_signal_handler_disconnect (ok_btn, g_signal_video);
- g_signal_video = g_signal_connect(ok_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_post_dialog_btn_ok_clicked_cb),
- NULL);
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_video_dialog")));
+ GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+ "anastasis_gtk_b_video_dialog_btn_ok"));
+ if (g_signal_video > 0)
+ g_signal_handler_disconnect (ok_btn, g_signal_video);
+ g_signal_video = g_signal_connect (ok_btn,
+ "clicked",
+ G_CALLBACK (
+
anastasis_gtk_b_post_dialog_btn_ok_clicked_cb),
+ NULL);
}
@@ -611,10 +662,12 @@ void
anastasis_gtk_b_video_dialog_btn_cancel_clicked_cb (GObject *object,
gpointer user_data)
{
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_video_dialog_photo_path_entry")), "");
- gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_video_dialog")));
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_video_dialog_photo_path_entry")),
+ "");
+ gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_video_dialog")));
}
@@ -628,79 +681,86 @@ void
anastasis_gtk_b_sms_dialog_btn_ok_clicked_cb (GObject *object,
gpointer user_data)
{
- GtkHBox *hbox;
- 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 ("SMS: ");
- const gchar *phonenumber = gtk_entry_get_text (
- GTK_ENTRY (GCG_get_main_window_object
("anastasis_gtk_b_sms_dialog_phonenumber_entry")));
- GtkLabel *label_phonenumber = (GtkLabel *) gtk_label_new (phonenumber);
- {
- //build json arguments for reducer
- json_t *arguments = json_object ();
- json_t *auth_method = json_object ();
- json_t *method_data = json_object ();
-
- json_object_set_new (auth_method, "method", json_string ("sms"));
- json_object_set_new (method_data, "phonenumber", json_string
(phonenumber));
- json_object_set_new (auth_method, "data", method_data);
- json_object_set_new (arguments, "authentication_method",
method_data);
-
- ra = ANASTASIS_redux_action (redux_state,
- "add_authentication",
- arguments,
- NULL,
- &action_cb,
- NULL);
- }
-
- // set buttons
- GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new(1, 0);
- GtkButton *edit_btn = (GtkButton *) gtk_button_new_from_icon_name
("gtk-edit", GTK_ICON_SIZE_BUTTON);
- g_signal_connect (edit_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_auth_method_btn_edit_clicked_cb),
- hbox);
- GtkButton *delete_btn = (GtkButton *) gtk_button_new_from_icon_name
("gtk-delete", GTK_ICON_SIZE_BUTTON);
- g_signal_connect (delete_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
- hbox);
- gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
-
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_phonenumber), 0, 0,
0);
- gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
-
- if (! is_box)
- {
- gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
- }
-
- gtk_widget_show (GTK_WIDGET (hbox));
- gtk_widget_show (GTK_WIDGET (label_prefix));
- gtk_widget_show (GTK_WIDGET (label_phonenumber));
- gtk_widget_show (GTK_WIDGET (buttons));
- gtk_widget_show (GTK_WIDGET (edit_btn));
- gtk_widget_show (GTK_WIDGET (delete_btn));
-
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_sms_dialog_phonenumber_entry")), "");
- gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_sms_dialog")));
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")), true);
+ GtkHBox *hbox;
+ 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 ("SMS: ");
+ const gchar *phonenumber = gtk_entry_get_text (
+ GTK_ENTRY (GCG_get_main_window_object (
+ "anastasis_gtk_b_sms_dialog_phonenumber_entry")));
+ GtkLabel *label_phonenumber = (GtkLabel *) gtk_label_new (phonenumber);
+ {
+ // build json arguments for reducer
+ json_t *arguments = json_object ();
+ json_t *auth_method = json_object ();
+ json_t *method_data = json_object ();
+
+ json_object_set_new (auth_method, "method", json_string ("sms"));
+ json_object_set_new (method_data, "phonenumber", json_string
(phonenumber));
+ json_object_set_new (auth_method, "data", method_data);
+ json_object_set_new (arguments, "authentication_method", method_data);
+
+ ra = ANASTASIS_redux_action (redux_state,
+ "add_authentication",
+ arguments,
+ &action_cb,
+ NULL);
+ }
+
+ // set buttons
+ GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new (1, 0);
+ GtkButton *edit_btn = (GtkButton *) gtk_button_new_from_icon_name (
+ "gtk-edit", GTK_ICON_SIZE_BUTTON);
+ g_signal_connect (edit_btn,
+ "clicked",
+ G_CALLBACK (
+ anastasis_gtk_b_auth_method_btn_edit_clicked_cb),
+ hbox);
+ GtkButton *delete_btn = (GtkButton *) gtk_button_new_from_icon_name (
+ "gtk-delete", GTK_ICON_SIZE_BUTTON);
+ g_signal_connect (delete_btn,
+ "clicked",
+ G_CALLBACK (
+ anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
+ hbox);
+ gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
+
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_phonenumber), 0, 0, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
+
+ if (! is_box)
+ {
+ gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
+ }
+
+ gtk_widget_show (GTK_WIDGET (hbox));
+ gtk_widget_show (GTK_WIDGET (label_prefix));
+ gtk_widget_show (GTK_WIDGET (label_phonenumber));
+ gtk_widget_show (GTK_WIDGET (buttons));
+ gtk_widget_show (GTK_WIDGET (edit_btn));
+ gtk_widget_show (GTK_WIDGET (delete_btn));
+
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_sms_dialog_phonenumber_entry")),
"");
+ gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_sms_dialog")));
+ gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_main_window_forward_button")),
+ true);
}
@@ -712,18 +772,19 @@ anastasis_gtk_b_sms_dialog_btn_ok_clicked_cb (GObject
*object,
*/
void
anastasis_gtk_btn_add_auth_sms_clicked_cb (GObject *object,
- gpointer user_data)
+ gpointer user_data)
{
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_sms_dialog")));
- GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
- "anastasis_gtk_b_sms_dialog_btn_ok"));
- if (g_signal_sms > 0)
- g_signal_handler_disconnect (ok_btn, g_signal_sms);
- g_signal_sms = g_signal_connect(ok_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_sms_dialog_btn_ok_clicked_cb),
- NULL);
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_sms_dialog")));
+ GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+ "anastasis_gtk_b_sms_dialog_btn_ok"));
+ if (g_signal_sms > 0)
+ g_signal_handler_disconnect (ok_btn, g_signal_sms);
+ g_signal_sms = g_signal_connect (ok_btn,
+ "clicked",
+ G_CALLBACK (
+
anastasis_gtk_b_sms_dialog_btn_ok_clicked_cb),
+ NULL);
}
@@ -737,10 +798,11 @@ void
anastasis_gtk_b_sms_dialog_btn_cancel_clicked_cb (GObject *object,
gpointer user_data)
{
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_sms_dialog_phonenumber_entry")), "");
- gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_sms_dialog")));
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_sms_dialog_phonenumber_entry")),
"");
+ gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_sms_dialog")));
}
@@ -754,79 +816,87 @@ void
anastasis_gtk_b_email_dialog_btn_ok_clicked_cb (GObject *object,
gpointer user_data)
{
- GtkHBox *hbox;
- 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 ("EMAIL: ");
- const gchar *mailaddress = gtk_entry_get_text (
- GTK_ENTRY (GCG_get_main_window_object
("anastasis_gtk_b_email_dialog_mailaddress_entry")));
- GtkLabel *label_mailaddress = (GtkLabel *) gtk_label_new (mailaddress);
- {
- //build json arguments for reducer
- json_t *arguments = json_object ();
- json_t *auth_method = json_object ();
- json_t *method_data = json_object ();
-
- json_object_set_new (auth_method, "method", json_string ("email"));
- json_object_set_new (method_data, "mailaddress", json_string
(mailaddress));
- json_object_set_new (auth_method, "data", method_data);
- json_object_set_new (arguments, "authentication_method",
method_data);
-
- ra = ANASTASIS_redux_action (redux_state,
- "add_authentication",
- arguments,
- NULL,
- &action_cb,
- NULL);
- }
-
- // set buttons
- GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new(1, 0);
- GtkButton *edit_btn = (GtkButton *) gtk_button_new_from_icon_name
("gtk-edit", GTK_ICON_SIZE_BUTTON);
- g_signal_connect (edit_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_auth_method_btn_edit_clicked_cb),
- hbox);
- GtkButton *delete_btn = (GtkButton *) gtk_button_new_from_icon_name
("gtk-delete", GTK_ICON_SIZE_BUTTON);
- g_signal_connect (delete_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
- hbox);
- gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
-
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_mailaddress), 0, 0,
0);
- gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
-
- if (! is_box)
- {
- gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
- }
-
- gtk_widget_show (GTK_WIDGET (hbox));
- gtk_widget_show (GTK_WIDGET (label_prefix));
- gtk_widget_show (GTK_WIDGET (label_mailaddress));
- gtk_widget_show (GTK_WIDGET (buttons));
- gtk_widget_show (GTK_WIDGET (edit_btn));
- gtk_widget_show (GTK_WIDGET (delete_btn));
-
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_email_dialog_mailaddress_entry")), "");
- gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_email_dialog")));
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")), true);
+ GtkHBox *hbox;
+ 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 ("EMAIL: ");
+ const gchar *mailaddress = gtk_entry_get_text (
+ GTK_ENTRY (GCG_get_main_window_object (
+ "anastasis_gtk_b_email_dialog_mailaddress_entry")));
+ GtkLabel *label_mailaddress = (GtkLabel *) gtk_label_new (mailaddress);
+ {
+ // build json arguments for reducer
+ json_t *arguments = json_object ();
+ json_t *auth_method = json_object ();
+ json_t *method_data = json_object ();
+
+ json_object_set_new (auth_method, "method", json_string ("email"));
+ json_object_set_new (method_data, "mailaddress", json_string
(mailaddress));
+ json_object_set_new (auth_method, "data", method_data);
+ json_object_set_new (arguments, "authentication_method", method_data);
+
+ ra = ANASTASIS_redux_action (redux_state,
+ "add_authentication",
+ arguments,
+ &action_cb,
+ NULL);
+ }
+
+ // set buttons
+ GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_box_new (1, 0);
+ GtkButton *edit_btn = (GtkButton *) gtk_button_new_from_icon_name (
+ "gtk-edit", GTK_ICON_SIZE_BUTTON);
+ g_signal_connect (edit_btn,
+ "clicked",
+ G_CALLBACK (
+ anastasis_gtk_b_auth_method_btn_edit_clicked_cb),
+ hbox);
+ GtkButton *delete_btn = (GtkButton *) gtk_button_new_from_icon_name (
+ "gtk-delete", GTK_ICON_SIZE_BUTTON);
+ g_signal_connect (delete_btn,
+ "clicked",
+ G_CALLBACK (
+ anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
+ hbox);
+ gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (edit_btn), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (buttons), GTK_WIDGET (delete_btn), 0, 0, 0);
+
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_prefix), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (label_mailaddress), 0, 0, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (buttons), 0, 0, 0);
+
+ if (! is_box)
+ {
+ gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), 0, 0, 0);
+ }
+
+ gtk_widget_show (GTK_WIDGET (hbox));
+ gtk_widget_show (GTK_WIDGET (label_prefix));
+ gtk_widget_show (GTK_WIDGET (label_mailaddress));
+ gtk_widget_show (GTK_WIDGET (buttons));
+ gtk_widget_show (GTK_WIDGET (edit_btn));
+ gtk_widget_show (GTK_WIDGET (delete_btn));
+
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_email_dialog_mailaddress_entry")),
+ "");
+ gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_email_dialog")));
+ gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_main_window_forward_button")),
+ true);
}
@@ -840,16 +910,17 @@ void
anastasis_gtk_btn_add_auth_email_clicked_cb (GObject *object,
gpointer user_data)
{
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_email_dialog")));
- GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
-
"anastasis_gtk_b_email_dialog_btn_ok"));
- if (g_signal_email > 0)
- g_signal_handler_disconnect (ok_btn, g_signal_email);
- g_signal_email = g_signal_connect(ok_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_email_dialog_btn_ok_clicked_cb),
- NULL);
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_email_dialog")));
+ GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+ "anastasis_gtk_b_email_dialog_btn_ok"));
+ if (g_signal_email > 0)
+ g_signal_handler_disconnect (ok_btn, g_signal_email);
+ g_signal_email = g_signal_connect (ok_btn,
+ "clicked",
+ G_CALLBACK (
+
anastasis_gtk_b_email_dialog_btn_ok_clicked_cb),
+ NULL);
}
@@ -861,12 +932,14 @@ anastasis_gtk_btn_add_auth_email_clicked_cb (GObject
*object,
*/
void
anastasis_gtk_b_email_dialog_btn_cancel_clicked_cb (GObject *object,
- gpointer user_data)
+ gpointer user_data)
{
- gtk_entry_set_text ( GTK_ENTRY (
- GCG_get_main_window_object
("anastasis_gtk_b_email_dialog_mailaddress_entry")), "");
- gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_email_dialog")));
+ gtk_entry_set_text (GTK_ENTRY (
+ GCG_get_main_window_object (
+ "anastasis_gtk_b_email_dialog_mailaddress_entry")),
+ "");
+ gtk_widget_hide (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_email_dialog")));
}
@@ -874,368 +947,393 @@ anastasis_gtk_b_email_dialog_btn_cancel_clicked_cb
(GObject *object,
* Callback invoked if the the "authentication methods edit"-button is clicked.
*
* @param object
- * @param user_data
+ * @param user_data
*/
void
anastasis_gtk_b_auth_method_btn_edit_clicked_cb (GObject *object,
gpointer user_data)
{
- GList *children, *iter;
- children = gtk_container_get_children (GTK_CONTAINER (user_data));
- bool policy_frame_active = false;
- char *type = "";
- unsigned int index = 0;
- if (gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_policy_frame"))))
- policy_frame_active = true;
- for (iter = children; iter != NULL; iter = g_list_next (iter))
- {
- const gchar *text = "";
- const gchar *widget_name = gtk_widget_get_name (GTK_WIDGET
(iter->data));
- if (0 == strcmp (widget_name, "GtkLabel"))
+ GList *children, *iter;
+ children = gtk_container_get_children (GTK_CONTAINER (user_data));
+ bool policy_frame_active = false;
+ char *type = "";
+ unsigned int index = 0;
+ if (gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_policy_frame"))))
+ policy_frame_active = true;
+ for (iter = children; iter != NULL; iter = g_list_next (iter))
+ {
+ const gchar *text = "";
+ const gchar *widget_name = gtk_widget_get_name (GTK_WIDGET (iter->data));
+ if (0 == strcmp (widget_name, "GtkLabel"))
+ {
+ text = gtk_label_get_text (GTK_LABEL (iter->data));
+ if (0 == strcmp (text, "Q: "))
+ type = "question";
+ if (0 == strcmp (text, "SMS: "))
+ type = "sms";
+ if (0 == strcmp (text, "EMAIL: "))
+ type = "email";
+ if (0 == strcmp (text, "POST: "))
+ type = "post";
+ if (0 == strcmp (text, "VIDEO: "))
+ type = "video";
+ }
+ if ((index == 0) && policy_frame_active)
+ gtk_widget_show (GTK_WIDGET (iter->data));
+ else if (index == 0)
+ gtk_widget_hide (GTK_WIDGET (iter->data));
+ if (index > 0)
+ {
+ GtkEntry *entry;
+
+ if (0 == strcmp (type, "question"))
+ {
+ if (index == 1)
+ {
+ entry = (GtkEntry *) GCG_get_main_window_object (
+ "anastasis_gtk_b_question_dialog_question_entry");
+ gtk_entry_set_text (entry, text);
+ }
+ if (index == 2)
+ {
+ gtk_entry_set_text (GTK_ENTRY (GCG_get_main_window_object (
+
"anastasis_gtk_b_question_dialog_answer_entry")),
+ text);
+ GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+
"anastasis_gtk_b_question_dialog_btn_ok"));
+ if (! policy_frame_active)
+ {
+ if (g_signal_question > 0)
+ g_signal_handler_disconnect (ok_btn, g_signal_question);
+ g_signal_question = g_signal_connect (ok_btn,
+ "clicked",
+ G_CALLBACK (
+
anastasis_gtk_b_question_dialog_btn_ok_clicked_cb),
+ user_data);
+ }
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_question_dialog")));
+ }
+ }
+ if (0 == strcmp (type, "sms"))
+ {
+ if (index == 1)
+ {
+ entry = (GtkEntry *) GCG_get_main_window_object (
+ "anastasis_gtk_b_sms_dialog_phonenumber_entry");
+ gtk_entry_set_text (entry, text);
+ GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+
"anastasis_gtk_b_sms_dialog_btn_ok"));
+ if (! policy_frame_active)
{
- text = gtk_label_get_text (GTK_LABEL (iter->data));
- if (0 == strcmp (text, "Q: "))
- type = "question";
- if (0 == strcmp (text, "SMS: "))
- type = "sms";
- if (0 == strcmp (text, "EMAIL: "))
- type = "email";
- if (0 == strcmp (text, "POST: "))
- type = "post";
- if (0 == strcmp (text, "VIDEO: "))
- type = "video";
+ if (g_signal_sms > 0)
+ g_signal_handler_disconnect (ok_btn, g_signal_sms);
+ g_signal_sms = g_signal_connect (ok_btn,
+ "clicked",
+ G_CALLBACK (
+
anastasis_gtk_b_sms_dialog_btn_ok_clicked_cb),
+ user_data);
}
- if (index == 0 && policy_frame_active)
- gtk_widget_show (GTK_WIDGET (iter->data));
- else if (index == 0)
- gtk_widget_hide (GTK_WIDGET (iter->data));
- if (index > 0)
+
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_sms_dialog")));
+ }
+ }
+ if (0 == strcmp (type, "email"))
+ {
+ if (index == 1)
+ {
+ entry = (GtkEntry *) GCG_get_main_window_object (
+ "anastasis_gtk_b_email_dialog_mailaddress_entry");
+ gtk_entry_set_text (entry, text);
+ GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+
"anastasis_gtk_b_email_dialog_btn_ok"));
+ if (! policy_frame_active)
{
- GtkEntry *entry;
-
- if (0 == strcmp (type, "question"))
- {
- if (index == 1)
- {
- entry = (GtkEntry *) GCG_get_main_window_object (
-
"anastasis_gtk_b_question_dialog_question_entry");
- gtk_entry_set_text (entry, text);
- }
- if (index == 2)
- {
- gtk_entry_set_text (GTK_ENTRY
(GCG_get_main_window_object (
-
"anastasis_gtk_b_question_dialog_answer_entry")), text);
- GtkButton *ok_btn = GTK_BUTTON
(GCG_get_main_window_object (
-
"anastasis_gtk_b_question_dialog_btn_ok"));
- if (! policy_frame_active)
- {
- if (g_signal_question > 0)
- g_signal_handler_disconnect (ok_btn,
g_signal_question);
- g_signal_question = g_signal_connect(ok_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_question_dialog_btn_ok_clicked_cb),
- user_data);
- }
- gtk_widget_show (GTK_WIDGET
(GCG_get_main_window_object (
-
"anastasis_gtk_b_question_dialog")));
- }
- }
- if (0 == strcmp (type, "sms"))
- {
- if (index == 1)
- {
- entry = (GtkEntry *) GCG_get_main_window_object (
-
"anastasis_gtk_b_sms_dialog_phonenumber_entry");
- gtk_entry_set_text (entry, text);
- GtkButton *ok_btn = GTK_BUTTON
(GCG_get_main_window_object (
- "anastasis_gtk_b_sms_dialog_btn_ok"));
- if (! policy_frame_active)
- {
- if (g_signal_sms > 0)
- g_signal_handler_disconnect (ok_btn,
g_signal_sms);
- g_signal_sms = g_signal_connect (ok_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_sms_dialog_btn_ok_clicked_cb),
- user_data);
- }
-
- gtk_widget_show (GTK_WIDGET
(GCG_get_main_window_object (
-
"anastasis_gtk_b_sms_dialog")));
- }
- }
- if (0 == strcmp (type, "email"))
- {
- if (index == 1)
- {
- entry = (GtkEntry *) GCG_get_main_window_object (
-
"anastasis_gtk_b_email_dialog_mailaddress_entry");
- gtk_entry_set_text (entry, text);
- GtkButton *ok_btn = GTK_BUTTON
(GCG_get_main_window_object (
-
"anastasis_gtk_b_email_dialog_btn_ok"));
- if (! policy_frame_active)
- {
- if (g_signal_email > 0)
- g_signal_handler_disconnect (ok_btn,
g_signal_email);
- g_signal_email = g_signal_connect (ok_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_email_dialog_btn_ok_clicked_cb),
- user_data);
- }
-
- gtk_widget_show (GTK_WIDGET
(GCG_get_main_window_object (
-
"anastasis_gtk_b_email_dialog")));
- }
- }
- if (0 == strcmp (type, "post"))
- {
- if (index == 1)
- {
- entry = (GtkEntry *) GCG_get_main_window_object (
-
"anastasis_gtk_b_post_dialog_full_name_entry");
- gtk_entry_set_text (entry, text);
- }
- if (index == 2)
- {
- entry = (GtkEntry *) GCG_get_main_window_object (
-
"anastasis_gtk_b_post_dialog_street_entry");
- gtk_entry_set_text (entry, text);
- }
- if (index == 3)
- {
- entry = (GtkEntry *) GCG_get_main_window_object (
-
"anastasis_gtk_b_post_dialog_city_entry");
- gtk_entry_set_text (entry, text);
- }
- if (index == 4)
- {
- entry = (GtkEntry *) GCG_get_main_window_object (
-
"anastasis_gtk_b_post_dialog_postcode_entry");
- gtk_entry_set_text (entry, text);
- }
- if (index == 5)
- {
- entry = (GtkEntry *) GCG_get_main_window_object (
-
"anastasis_gtk_b_post_dialog_country_entry");
- gtk_entry_set_text (entry, text);
- GtkButton *ok_btn = GTK_BUTTON
(GCG_get_main_window_object (
- "anastasis_gtk_b_post_dialog_btn_ok"));
- if (! policy_frame_active)
- {
- if (g_signal_post > 0)
- g_signal_handler_disconnect (ok_btn,
g_signal_post);
- g_signal_post = g_signal_connect (ok_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_post_dialog_btn_ok_clicked_cb),
- user_data);
- }
-
- gtk_widget_show (GTK_WIDGET
(GCG_get_main_window_object (
-
"anastasis_gtk_b_post_dialog")));
- }
- }
- if (0 == strcmp (type, "video"))
- {
- if (index == 1)
- {
- GtkEntry *entry = (GtkEntry *)
GCG_get_main_window_object (
-
"anastasis_gtk_b_video_dialog_photo_path_entry");
- gtk_entry_set_text (entry, text);
-
- GtkButton *ok_btn = GTK_BUTTON
(GCG_get_main_window_object (
-
"anastasis_gtk_b_video_dialog_btn_ok"));
- if (! policy_frame_active)
- {
- if (g_signal_video > 0)
- g_signal_handler_disconnect (ok_btn,
g_signal_video);
- g_signal_video = g_signal_connect (ok_btn,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_video_dialog_btn_ok_clicked_cb),
- user_data);
- }
-
- gtk_widget_show (GTK_WIDGET
(GCG_get_main_window_object (
-
"anastasis_gtk_b_video_dialog")));
- }
- }
- if (entry && policy_frame_active)
- gtk_editable_set_editable (GTK_EDITABLE (entry), false);
- else if (entry)
- gtk_editable_set_editable (GTK_EDITABLE (entry), true);
+ if (g_signal_email > 0)
+ g_signal_handler_disconnect (ok_btn, g_signal_email);
+ g_signal_email = g_signal_connect (ok_btn,
+ "clicked",
+ G_CALLBACK (
+
anastasis_gtk_b_email_dialog_btn_ok_clicked_cb),
+ user_data);
}
- index++;
- }
- if (policy_frame_active)
- {
- //show provider combo box
- gtk_widget_show (gtk_widget_get_parent (GTK_WIDGET
- (GCG_get_main_window_object
("anastasis_gtk_b_sms_dialog_provider"))));
- gtk_widget_show (gtk_widget_get_parent (GTK_WIDGET
- (GCG_get_main_window_object
("anastasis_gtk_b_email_dialog_provider"))));
- gtk_widget_show (gtk_widget_get_parent (GTK_WIDGET
- (GCG_get_main_window_object
("anastasis_gtk_b_question_dialog_provider"))));
- gtk_widget_show (gtk_widget_get_parent (GTK_WIDGET
- (GCG_get_main_window_object
("anastasis_gtk_b_post_dialog_provider"))));
- gtk_widget_show (gtk_widget_get_parent (GTK_WIDGET
- (GCG_get_main_window_object
("anastasis_gtk_b_video_dialog_provider"))));
-
- //hide secret answer entry
- gtk_widget_hide (gtk_widget_get_parent (GTK_WIDGET
- (GCG_get_main_window_object
("anastasis_gtk_b_question_dialog_answer_entry"))));
- }
- g_list_free (children);
+
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_email_dialog")));
+ }
+ }
+ if (0 == strcmp (type, "post"))
+ {
+ if (index == 1)
+ {
+ entry = (GtkEntry *) GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_full_name_entry");
+ gtk_entry_set_text (entry, text);
+ }
+ if (index == 2)
+ {
+ entry = (GtkEntry *) GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_street_entry");
+ gtk_entry_set_text (entry, text);
+ }
+ if (index == 3)
+ {
+ entry = (GtkEntry *) GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_city_entry");
+ gtk_entry_set_text (entry, text);
+ }
+ if (index == 4)
+ {
+ entry = (GtkEntry *) GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_postcode_entry");
+ gtk_entry_set_text (entry, text);
+ }
+ if (index == 5)
+ {
+ entry = (GtkEntry *) GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog_country_entry");
+ gtk_entry_set_text (entry, text);
+ GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+
"anastasis_gtk_b_post_dialog_btn_ok"));
+ if (! policy_frame_active)
+ {
+ if (g_signal_post > 0)
+ g_signal_handler_disconnect (ok_btn, g_signal_post);
+ g_signal_post = g_signal_connect (ok_btn,
+ "clicked",
+ G_CALLBACK (
+
anastasis_gtk_b_post_dialog_btn_ok_clicked_cb),
+ user_data);
+ }
+
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_post_dialog")));
+ }
+ }
+ if (0 == strcmp (type, "video"))
+ {
+ if (index == 1)
+ {
+ GtkEntry *entry = (GtkEntry *) GCG_get_main_window_object (
+ "anastasis_gtk_b_video_dialog_photo_path_entry");
+ gtk_entry_set_text (entry, text);
+
+ GtkButton *ok_btn = GTK_BUTTON (GCG_get_main_window_object (
+
"anastasis_gtk_b_video_dialog_btn_ok"));
+ if (! policy_frame_active)
+ {
+ if (g_signal_video > 0)
+ g_signal_handler_disconnect (ok_btn, g_signal_video);
+ g_signal_video = g_signal_connect (ok_btn,
+ "clicked",
+ G_CALLBACK (
+
anastasis_gtk_b_video_dialog_btn_ok_clicked_cb),
+ user_data);
+ }
+
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_video_dialog")));
+ }
+ }
+ if (entry && policy_frame_active)
+ gtk_editable_set_editable (GTK_EDITABLE (entry), false);
+ else if (entry)
+ gtk_editable_set_editable (GTK_EDITABLE (entry), true);
+ }
+ index++;
+ }
+ if (policy_frame_active)
+ {
+ // show provider combo box
+ gtk_widget_show (gtk_widget_get_parent (GTK_WIDGET
+ (GCG_get_main_window_object (
+
"anastasis_gtk_b_sms_dialog_provider"))));
+ gtk_widget_show (gtk_widget_get_parent (GTK_WIDGET
+ (GCG_get_main_window_object (
+
"anastasis_gtk_b_email_dialog_provider"))));
+ gtk_widget_show (gtk_widget_get_parent (GTK_WIDGET
+ (GCG_get_main_window_object (
+
"anastasis_gtk_b_question_dialog_provider"))));
+ gtk_widget_show (gtk_widget_get_parent (GTK_WIDGET
+ (GCG_get_main_window_object (
+
"anastasis_gtk_b_post_dialog_provider"))));
+ gtk_widget_show (gtk_widget_get_parent (GTK_WIDGET
+ (GCG_get_main_window_object (
+
"anastasis_gtk_b_video_dialog_provider"))));
+
+ // hide secret answer entry
+ gtk_widget_hide (gtk_widget_get_parent (GTK_WIDGET
+ (GCG_get_main_window_object (
+
"anastasis_gtk_b_question_dialog_answer_entry"))));
+ }
+ g_list_free (children);
}
/**
* Prepare authentication methods for policy generation.
- *
+ *
* @param state the state to operate on
*/
void
init_b_policy (json_t *state)
{
- GList *children, *iter;
- unsigned int row = 0;
- GtkGrid *grid = GTK_GRID (GCG_get_main_window_object
("anastasis_gtk_b_policy_grid"));
-
- //format title label for methods
- GtkFrame *frm_method_title = GTK_FRAME (gtk_grid_get_child_at (grid, 0,
0));
- gtk_widget_set_hexpand (GTK_WIDGET (frm_method_title), true);
- gtk_widget_set_halign (GTK_WIDGET (frm_method_title), GTK_ALIGN_FILL);
- gtk_widget_set_valign (GTK_WIDGET (frm_method_title), GTK_ALIGN_CENTER);
-
- //format title label for policies
- GtkFrame *frm_policy_title = GTK_FRAME (gtk_grid_get_child_at (grid, 1,
0));
- gtk_widget_set_hexpand (GTK_WIDGET (frm_policy_title), true);
- gtk_widget_set_halign (GTK_WIDGET (frm_policy_title), GTK_ALIGN_FILL);
- gtk_widget_set_valign (GTK_WIDGET (frm_policy_title), GTK_ALIGN_CENTER);
-
- //get number of policies/policy columns
- int policies_col = get_widget_width (grid, GTK_WIDGET (frm_policy_title));
-
- //format title label for backup cost
- GtkFrame *frm_b_cost_title =
- GTK_FRAME (gtk_grid_get_child_at (grid, policies_col + 1,
0));
- gtk_widget_set_hexpand (GTK_WIDGET (frm_b_cost_title), true);
- gtk_widget_set_halign (GTK_WIDGET (frm_b_cost_title), GTK_ALIGN_FILL);
- gtk_widget_set_valign (GTK_WIDGET (frm_b_cost_title), GTK_ALIGN_CENTER);
-
- //format title label for backup cost
- GtkFrame *frm_r_cost_title =
- GTK_FRAME (gtk_grid_get_child_at (grid, policies_col + 2,
0));
- gtk_widget_set_hexpand (GTK_WIDGET (frm_r_cost_title), true);
- gtk_widget_set_halign (GTK_WIDGET (frm_r_cost_title), GTK_ALIGN_FILL);
- gtk_widget_set_valign (GTK_WIDGET (frm_r_cost_title), GTK_ALIGN_CENTER);
-
- children = gtk_container_get_children (GTK_CONTAINER
(GCG_get_main_window_object (
-
"anastasis_gtk_b_authentication_vbox")));
- for (iter = children; iter != NULL; iter = g_list_next (iter))
- {
- GList *grandchildren, *inner_iter;
- grandchildren = gtk_container_get_children (GTK_CONTAINER
(iter->data));
- GtkFrame *method_frame = (GtkFrame *) gtk_frame_new (NULL);
- GtkHBox *method_hbox = (GtkHBox *) gtk_box_new
(GTK_ORIENTATION_HORIZONTAL, 2);
- unsigned int index = 0;
-
- if (GTK_IS_BOX (iter->data))
- for (inner_iter = grandchildren; inner_iter != NULL; inner_iter
= g_list_next (inner_iter))
- {
- // iterate over hbox children
- if (GTK_IS_LABEL (inner_iter->data))
- {
- const char *text = gtk_label_get_text (GTK_LABEL
(inner_iter->data));
-
- // check method type
- if (index == 0)
- {
- row++;
- gtk_grid_insert_row (grid, row);
- GtkLabel *lbl_method_type = (GtkLabel *)
gtk_label_new (text);
- gtk_box_pack_start (GTK_BOX (method_hbox),
GTK_WIDGET (lbl_method_type), 0, 0, 0);
- gtk_widget_show (GTK_WIDGET (lbl_method_type));
- }
-
- // check method attributes
- if (index == 1)
- {
- GtkLabel *lbl_method_info = (GtkLabel *)
gtk_label_new (text);
- gtk_box_pack_start (GTK_BOX (method_hbox),
GTK_WIDGET (lbl_method_info), 0, 0, 0);
- GtkButton *btn_edit_method = (GtkButton *)
gtk_button_new_from_icon_name ("gtk-edit", GTK_ICON_SIZE_BUTTON);
- g_signal_connect (btn_edit_method,
- "clicked",
- G_CALLBACK
(anastasis_gtk_b_auth_method_btn_edit_clicked_cb),
- method_hbox);
- gtk_box_pack_end (GTK_BOX (method_hbox),
GTK_WIDGET (btn_edit_method), 0, 0, 0);
- gtk_widget_show (GTK_WIDGET (lbl_method_info));
- gtk_widget_show (GTK_WIDGET (btn_edit_method));
- }
- }
- index++;
- }
-
- gtk_frame_set_shadow_type (GTK_FRAME (method_frame), GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (method_frame),
- GTK_WIDGET (method_hbox));
- gtk_grid_attach (grid,
- GTK_WIDGET (method_frame),
- 0, row, 1, 1);
- gtk_widget_show (GTK_WIDGET (method_hbox));
- gtk_widget_show (GTK_WIDGET (method_frame));
- for (unsigned int i = 0; i < policies_col; i++)
+ GList *children, *iter;
+ unsigned int row = 0;
+ GtkGrid *grid = GTK_GRID (GCG_get_main_window_object (
+ "anastasis_gtk_b_policy_grid"));
+
+ // format title label for methods
+ GtkFrame *frm_method_title = GTK_FRAME (gtk_grid_get_child_at (grid, 0, 0));
+ gtk_widget_set_hexpand (GTK_WIDGET (frm_method_title), true);
+ gtk_widget_set_halign (GTK_WIDGET (frm_method_title), GTK_ALIGN_FILL);
+ gtk_widget_set_valign (GTK_WIDGET (frm_method_title), GTK_ALIGN_CENTER);
+
+ // format title label for policies
+ GtkFrame *frm_policy_title = GTK_FRAME (gtk_grid_get_child_at (grid, 1, 0));
+ gtk_widget_set_hexpand (GTK_WIDGET (frm_policy_title), true);
+ gtk_widget_set_halign (GTK_WIDGET (frm_policy_title), GTK_ALIGN_FILL);
+ gtk_widget_set_valign (GTK_WIDGET (frm_policy_title), GTK_ALIGN_CENTER);
+
+ // get number of policies/policy columns
+ int policies_col = get_widget_width (grid, GTK_WIDGET (frm_policy_title));
+
+ // format title label for backup cost
+ GtkFrame *frm_b_cost_title =
+ GTK_FRAME (gtk_grid_get_child_at (grid, policies_col + 1, 0));
+ gtk_widget_set_hexpand (GTK_WIDGET (frm_b_cost_title), true);
+ gtk_widget_set_halign (GTK_WIDGET (frm_b_cost_title), GTK_ALIGN_FILL);
+ gtk_widget_set_valign (GTK_WIDGET (frm_b_cost_title), GTK_ALIGN_CENTER);
+
+ // format title label for backup cost
+ GtkFrame *frm_r_cost_title =
+ GTK_FRAME (gtk_grid_get_child_at (grid, policies_col + 2, 0));
+ gtk_widget_set_hexpand (GTK_WIDGET (frm_r_cost_title), true);
+ gtk_widget_set_halign (GTK_WIDGET (frm_r_cost_title), GTK_ALIGN_FILL);
+ gtk_widget_set_valign (GTK_WIDGET (frm_r_cost_title), GTK_ALIGN_CENTER);
+
+ children = gtk_container_get_children (GTK_CONTAINER (
+ GCG_get_main_window_object (
+
"anastasis_gtk_b_authentication_vbox")));
+ for (iter = children; iter != NULL; iter = g_list_next (iter))
+ {
+ GList *grandchildren, *inner_iter;
+ grandchildren = gtk_container_get_children (GTK_CONTAINER (iter->data));
+ GtkFrame *method_frame = (GtkFrame *) gtk_frame_new (NULL);
+ GtkHBox *method_hbox = (GtkHBox *) gtk_box_new (GTK_ORIENTATION_HORIZONTAL,
+ 2);
+ unsigned int index = 0;
+
+ if (GTK_IS_BOX (iter->data))
+ for (inner_iter = grandchildren; inner_iter != NULL; inner_iter =
+ g_list_next (inner_iter))
+ {
+ // iterate over hbox children
+ if (GTK_IS_LABEL (inner_iter->data))
+ {
+ const char *text = gtk_label_get_text (GTK_LABEL (inner_iter->data));
+
+ // check method type
+ if (index == 0)
{
- GtkFrame *frame = (GtkFrame *) gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- GtkCheckButton *chk_btn = (GtkCheckButton *)
gtk_check_button_new ();
- gtk_container_add (GTK_CONTAINER (frame),
- GTK_WIDGET (chk_btn));
- gtk_grid_attach (grid,
- GTK_WIDGET (frame),
- i + 1, row, 1, 1);
- gtk_widget_set_halign (GTK_WIDGET (chk_btn), GTK_ALIGN_CENTER);
- gtk_widget_set_valign (GTK_WIDGET (chk_btn), GTK_ALIGN_CENTER);
- gtk_widget_set_halign (GTK_WIDGET (frame), GTK_ALIGN_FILL);
- gtk_widget_show (GTK_WIDGET (chk_btn));
- gtk_widget_show (GTK_WIDGET (frame));
+ row++;
+ gtk_grid_insert_row (grid, row);
+ GtkLabel *lbl_method_type = (GtkLabel *) gtk_label_new (text);
+ gtk_box_pack_start (GTK_BOX (method_hbox), GTK_WIDGET (
+ lbl_method_type), 0, 0, 0);
+ gtk_widget_show (GTK_WIDGET (lbl_method_type));
}
- g_list_free (grandchildren);
- }
- g_list_free (children);
+
+ // check method attributes
+ if (index == 1)
+ {
+ GtkLabel *lbl_method_info = (GtkLabel *) gtk_label_new (text);
+ gtk_box_pack_start (GTK_BOX (method_hbox), GTK_WIDGET (
+ lbl_method_info), 0, 0, 0);
+ GtkButton *btn_edit_method =
+ (GtkButton *) gtk_button_new_from_icon_name ("gtk-edit",
+
GTK_ICON_SIZE_BUTTON);
+ g_signal_connect (btn_edit_method,
+ "clicked",
+ G_CALLBACK (
+
anastasis_gtk_b_auth_method_btn_edit_clicked_cb),
+ method_hbox);
+ gtk_box_pack_end (GTK_BOX (method_hbox), GTK_WIDGET (
+ btn_edit_method), 0, 0, 0);
+ gtk_widget_show (GTK_WIDGET (lbl_method_info));
+ gtk_widget_show (GTK_WIDGET (btn_edit_method));
+ }
+ }
+ index++;
+ }
+
+ gtk_frame_set_shadow_type (GTK_FRAME (method_frame), GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER (method_frame),
+ GTK_WIDGET (method_hbox));
+ gtk_grid_attach (grid,
+ GTK_WIDGET (method_frame),
+ 0, row, 1, 1);
+ gtk_widget_show (GTK_WIDGET (method_hbox));
+ gtk_widget_show (GTK_WIDGET (method_frame));
+ for (unsigned int i = 0; i < policies_col; i++)
+ {
+ GtkFrame *frame = (GtkFrame *) gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
+ GtkCheckButton *chk_btn = (GtkCheckButton *) gtk_check_button_new ();
+ gtk_container_add (GTK_CONTAINER (frame),
+ GTK_WIDGET (chk_btn));
+ gtk_grid_attach (grid,
+ GTK_WIDGET (frame),
+ i + 1, row, 1, 1);
+ gtk_widget_set_halign (GTK_WIDGET (chk_btn), GTK_ALIGN_CENTER);
+ gtk_widget_set_valign (GTK_WIDGET (chk_btn), GTK_ALIGN_CENTER);
+ gtk_widget_set_halign (GTK_WIDGET (frame), GTK_ALIGN_FILL);
+ gtk_widget_show (GTK_WIDGET (chk_btn));
+ gtk_widget_show (GTK_WIDGET (frame));
+ }
+ g_list_free (grandchildren);
+ }
+ g_list_free (children);
}
/**
* Initialize the auhentication methods in backup mode.
- *
+ *
* @param state the state to operate on
*/
void
init_b_auth_methods (json_t *state)
{
- json_t *providers = json_object_get (state, "authentication_providers");
- if (NULL != providers)
- {
- const char *method;
- json_t *value;
-
- json_object_foreach(providers, method, value) {
- if (0 == strcmp (method, "question"))
- gtk_widget_show (GTK_WIDGET (
- GCG_get_main_window_object
("anastasis_gtk_btn_add_auth_question")));
- if (0 == strcmp (method, "sms"))
- gtk_widget_show (GTK_WIDGET (
- GCG_get_main_window_object
("anastasis_gtk_btn_add_auth_sms")));
- if (0 == strcmp (method, "video"))
- gtk_widget_show (GTK_WIDGET (
- GCG_get_main_window_object
("anastasis_gtk_btn_add_auth_video")));
- if (0 == strcmp (method, "email"))
- gtk_widget_show (GTK_WIDGET (
- GCG_get_main_window_object
("anastasis_gtk_btn_add_auth_email")));
- if (0 == strcmp (method, "post"))
- gtk_widget_show (GTK_WIDGET (
- GCG_get_main_window_object
("anastasis_gtk_btn_add_auth_post")));
- }
- }
+ json_t *providers = json_object_get (state, "authentication_providers");
+ if (NULL != providers)
+ {
+ const char *method;
+ json_t *value;
+
+ json_object_foreach (providers, method, value) {
+ if (0 == strcmp (method, "question"))
+ gtk_widget_show (GTK_WIDGET (
+ GCG_get_main_window_object (
+ "anastasis_gtk_btn_add_auth_question")));
+ if (0 == strcmp (method, "sms"))
+ gtk_widget_show (GTK_WIDGET (
+ GCG_get_main_window_object (
+ "anastasis_gtk_btn_add_auth_sms")));
+ if (0 == strcmp (method, "video"))
+ gtk_widget_show (GTK_WIDGET (
+ GCG_get_main_window_object (
+ "anastasis_gtk_btn_add_auth_video")));
+ if (0 == strcmp (method, "email"))
+ gtk_widget_show (GTK_WIDGET (
+ GCG_get_main_window_object (
+ "anastasis_gtk_btn_add_auth_email")));
+ if (0 == strcmp (method, "post"))
+ gtk_widget_show (GTK_WIDGET (
+ GCG_get_main_window_object (
+ "anastasis_gtk_btn_add_auth_post")));
+ }
+ }
}
-
-
diff --git a/src/anastasis/anastasis-gtk_helper.c
b/src/anastasis/anastasis-gtk_helper.c
index 8ef9e6a..992974a 100644
--- a/src/anastasis/anastasis-gtk_helper.c
+++ b/src/anastasis/anastasis-gtk_helper.c
@@ -32,25 +32,25 @@
/**
* List of authentication methods and their supporting providers.
*/
-static json_t* providers;
+static json_t*providers;
/**
* List of providers we do not have a config response yet.
*/
-static json_t* missing_providers;
+static json_t*missing_providers;
/**
* Returs the authentication providers.
- *
+ *
* @return json_t
*/
json_t *
get_authentication_providers ()
{
- json_t *auth_providers = json_object_get (providers,
- "authentication_providers");
- return auth_providers;
+ json_t *auth_providers = json_object_get (providers,
+ "authentication_providers");
+ return auth_providers;
}
@@ -60,131 +60,134 @@ get_authentication_providers ()
void
reset_authentication_providers ()
{
- if (NULL != providers)
- GNUNET_assert (0 == json_object_clear (providers));
+ if (NULL != providers)
+ GNUNET_assert (0 == json_object_clear (providers));
}
/**
* Returs the providers which did not respond yet.
- *
+ *
* @return json_t
*/
json_t *
get_missing_providers ()
{
- return missing_providers;
+ return missing_providers;
}
/**
* 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)
+ 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);
+ // 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"));
+ 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));
+ // 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 */
- }
+ 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)
+ 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"))
{
- 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);
- }
+ 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);
}
- return fullfilled;
+ 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.
*
@@ -203,41 +206,41 @@ GCG_get_main_window_object (const char *name)
/**
* Function to persist a state.
* FIXME: Don't use this like its used right now (=>PRIVACY)!
- *
+ *
* @param state state to persist
*/
int
persist_state (json_t *state)
{
- char *dn;
+ char *dn;
+
+ {
+ char *path;
+ char *mode;
+
+ if (NULL != json_object_get (state, "backup_state"))
+ mode = "backup";
+ else if (NULL != json_object_get (state, "recovery_state"))
+ mode = "recovery";
+ else
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
+ path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX);
+ if (NULL == path)
{
- char *path;
- char *mode;
-
- if (NULL != json_object_get (state, "backup_state"))
- mode = "backup";
- else if (NULL != json_object_get (state, "recovery_state"))
- mode = "recovery";
- else
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
-
- path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX);
- if (NULL == path)
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- GNUNET_asprintf (&dn,
- "%s/share/anastasis/%s_state.json",
- path,
- mode);
- GNUNET_free (path);
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
}
- return json_dump_file (state, dn, JSON_COMPACT);
+ GNUNET_asprintf (&dn,
+ "%s/share/anastasis/%s_state.json",
+ path,
+ mode);
+ GNUNET_free (path);
+ }
+ return json_dump_file (state, dn, JSON_COMPACT);
}
@@ -247,25 +250,27 @@ persist_state (json_t *state)
void
anastasis_gtk_hide_all_frames ()
{
- GList *children, *iter;
-
- //hide frames
- children = gtk_container_get_children (GTK_CONTAINER
(GCG_get_main_window_object (
-
"anastasis_gtk_super_vbox")));
- for (iter = children; iter != NULL; iter = g_list_next (iter))
- {
- gtk_widget_hide (GTK_WIDGET (iter->data));
- }
- g_list_free (children);
-
- //hide illustrations
- children = gtk_container_get_children (GTK_CONTAINER
(GCG_get_main_window_object (
-
"anastasis_gtk_illustration_vbox")));
- for (iter = children; iter != NULL; iter = g_list_next (iter))
- {
- gtk_widget_hide (GTK_WIDGET (iter->data));
- }
- g_list_free (children);
+ GList *children, *iter;
+
+ // hide frames
+ children = gtk_container_get_children (GTK_CONTAINER (
+ GCG_get_main_window_object (
+ "anastasis_gtk_super_vbox")));
+ for (iter = children; iter != NULL; iter = g_list_next (iter))
+ {
+ gtk_widget_hide (GTK_WIDGET (iter->data));
+ }
+ g_list_free (children);
+
+ // hide illustrations
+ children = gtk_container_get_children (GTK_CONTAINER (
+ GCG_get_main_window_object (
+
"anastasis_gtk_illustration_vbox")));
+ for (iter = children; iter != NULL; iter = g_list_next (iter))
+ {
+ gtk_widget_hide (GTK_WIDGET (iter->data));
+ }
+ g_list_free (children);
}
@@ -278,136 +283,144 @@ anastasis_gtk_hide_all_frames ()
*/
void
action_cb (void *cls,
- enum ANASTASIS_ErrorCode error_code,
+ enum TALER_ErrorCode error_code,
json_t *response)
{
- if (NULL != response)
- redux_state = json_deep_copy (response);
- else
- {
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
- if (check_state (redux_state,
- ANASTASIS_generic_state_to_string
(ANASTASIS_GENERIC_STATE_CONTINENT_SELECTION)))
- {
- GtkListStore *country_liststore = GTK_LIST_STORE
(GCG_get_main_window_object ("country_liststore"));
-
- anastasis_gtk_hide_all_frames ();
- gtk_list_store_clear (country_liststore);
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")), false);
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_continent_selection_image")));
- }
- if (check_state (redux_state,
- ANASTASIS_generic_state_to_string
(ANASTASIS_GENERIC_STATE_COUNTRY_SELECTION)))
- {
- anastasis_gtk_hide_all_frames ();
- init_country_list (redux_state, json_string_value (json_object_get
(redux_state, "selected_continent")));
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_country_selection_image")));
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_continent_frame")));
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")), false);
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_continent_selection_image")));
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_country_selection_image")));
- }
- if (check_state (redux_state,
- ANASTASIS_generic_state_to_string
(ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION)))
- {
- gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_main_window_forward_button")), true);
- init_id_attr (redux_state, json_string_value (json_object_get
(redux_state, "selected_country")));
- }
- if (check_state (redux_state,
- ANASTASIS_backup_state_to_string
(ANASTASIS_BACKUP_STATE_AUTHENTICATIONS_EDITING)))
+ if (NULL != response)
+ redux_state = json_deep_copy (response);
+ else
+ {
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ if (check_state (redux_state,
+ "CONTINENT_SELECTION"))
+ {
+ GtkListStore *country_liststore = GTK_LIST_STORE (
+ GCG_get_main_window_object ("country_liststore"));
+
+ anastasis_gtk_hide_all_frames ();
+ gtk_list_store_clear (country_liststore);
+ gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_main_window_forward_button")),
+ false);
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_continent_selection_image")));
+ }
+ if (check_state (redux_state,
+ "COUNTRY_SELECTION"))
+ {
+ anastasis_gtk_hide_all_frames ();
+ init_country_list (redux_state, json_string_value (json_object_get (
+ redux_state,
+
"selected_continent")));
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_country_selection_image")));
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_continent_frame")));
+ gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_main_window_forward_button")),
+ false);
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_continent_selection_image")));
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_country_selection_image")));
+ }
+ if (check_state (redux_state,
+ "USER_ATTRIBUTES_COLLECTION"))
+ {
+ gtk_widget_set_sensitive (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_main_window_forward_button")),
+ true);
+ init_id_attr (redux_state, json_string_value (json_object_get (redux_state,
+
"selected_country")));
+ }
+ if (check_state (redux_state,
+ "AUTHENTICATIONS_EDITING"))
+ {
+ if (json_object_get (redux_state, "backup_state"))
{
- if (json_object_get (redux_state, "backup_state"))
- {
- anastasis_gtk_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);
- }
+ anastasis_gtk_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);
}
- if (check_state (redux_state,
- ANASTASIS_backup_state_to_string
(ANASTASIS_BACKUP_STATE_POLICIES_REVIEWING))
- && gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_authentication_frame"))))
+ }
+ if (check_state (redux_state,
+ "POLICIES_REVIEWING")
+ && gtk_widget_is_visible (GTK_WIDGET (GCG_get_main_window_object (
+
"anastasis_gtk_b_authentication_frame"))))
+ {
+ if (json_object_get (redux_state, "backup_state"))
{
- if (json_object_get (redux_state, "backup_state"))
- {
- anastasis_gtk_hide_all_frames ();
- init_b_policy (redux_state);
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
- "anastasis_gtk_b_policy_frame")));
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
-
"anastasis_gtk_b_policies_image")));
- set_policy_check_buttons (redux_state);
- }
+ anastasis_gtk_hide_all_frames ();
+ init_b_policy (redux_state);
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_policy_frame")));
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
+ "anastasis_gtk_b_policies_image")));
+ set_policy_check_buttons (redux_state);
}
- /** FIXME: Don't use this like this; now used to check if json state is
build correctly */
- if (0 == persist_state (redux_state))
- return;
- else
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to persist new state! \n");
-
-
- /** FIXME: see above
- * GNUNET_SCHEDULER_shutdown (); */
+ }
+ /** FIXME: Don't use this like this; now used to check if json state is
build correctly */
+ if (0 == persist_state (redux_state))
+ return;
+ else
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to persist new state! \n");
+
+
+ /** FIXME: see above
+ * GNUNET_SCHEDULER_shutdown (); */
}
bool
check_state (json_t *state, const char *expected_state)
{
- const char *state_name = json_string_value (json_object_get (state,
"backup_state"));
- if (NULL == state_name)
- state_name = json_string_value (json_object_get (state,
"recovery_state"));
- if (0 == strcmp (state_name, expected_state))
- return true;
- else
- return false;
+ const char *state_name = json_string_value (json_object_get (state,
+
"backup_state"));
+ if (NULL == state_name)
+ state_name = json_string_value (json_object_get (state, "recovery_state"));
+ if (0 == strcmp (state_name, expected_state))
+ return true;
+ else
+ return false;
}
/**
* Initialize the continent list.
- *
+ *
* @param init_state the initial state to get the continents from
*/
void
init_continent_list (json_t *init_state)
{
- GtkListStore *continent_liststore;
- GtkTreeIter iter;
- json_t *continent;
- size_t index;
- json_t *continents = json_object_get (init_state, "continents");
-
- continent_liststore = GTK_LIST_STORE (
- GCG_get_main_window_object ("continent_liststore"));
- gtk_list_store_clear (continent_liststore);
- json_array_foreach (continents, index, continent)
- {
- gtk_list_store_append (continent_liststore, &iter);
- gtk_list_store_set (continent_liststore, &iter,
- 0, json_string_value (continent),
- -1);
- }
+ GtkListStore *continent_liststore;
+ GtkTreeIter iter;
+ json_t *continent;
+ size_t index;
+ json_t *continents = json_object_get (init_state, "continents");
+
+ continent_liststore = GTK_LIST_STORE (
+ GCG_get_main_window_object ("continent_liststore"));
+ gtk_list_store_clear (continent_liststore);
+ json_array_foreach (continents, index, continent)
+ {
+ gtk_list_store_append (continent_liststore, &iter);
+ gtk_list_store_set (continent_liststore, &iter,
+ 0, json_string_value (continent),
+ -1);
+ }
}
/**
* Initialize the country list in dependence of selected continent.
- *
+ *
* @param state the state to get the countries from
* @param continent name of the selected continent
*/
@@ -415,33 +428,37 @@ void
init_country_list (json_t *state,
const char *continent)
{
- GtkTreeView *tree_view;
- GtkListStore *country_liststore;
- GtkTreeIter iter;
- json_t *country;
- size_t index;
- json_t *countries = json_object_get (state, "countries");
-
- country_liststore = GTK_LIST_STORE (
- GCG_get_main_window_object ("country_liststore"));
- tree_view = GTK_TREE_VIEW (GCG_get_main_window_object
("anastasis_gtk_country_treeview"));
- gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (country_liststore));
- gtk_list_store_clear (country_liststore);
- json_array_foreach (countries, index, country)
- {
- gtk_list_store_append (country_liststore, &iter);
- gtk_list_store_set (country_liststore, &iter,
- 0, json_string_value (json_object_get (country,
"name")), //FIXME implement i18n
- 1, json_string_value (json_object_get (country,
"code")),
- 2, json_string_value (json_object_get (country,
"currency")),
- -1);
- }
+ GtkTreeView *tree_view;
+ GtkListStore *country_liststore;
+ GtkTreeIter iter;
+ json_t *country;
+ size_t index;
+ json_t *countries = json_object_get (state, "countries");
+
+ country_liststore = GTK_LIST_STORE (
+ GCG_get_main_window_object ("country_liststore"));
+ tree_view = GTK_TREE_VIEW (GCG_get_main_window_object (
+ "anastasis_gtk_country_treeview"));
+ gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (country_liststore));
+ gtk_list_store_clear (country_liststore);
+ json_array_foreach (countries, index, country)
+ {
+ gtk_list_store_append (country_liststore, &iter);
+ gtk_list_store_set (country_liststore, &iter,
+ 0, json_string_value (json_object_get (country,
+ "name")),
// FIXME implement i18n
+ 1, json_string_value (json_object_get (country,
+ "code")),
+ 2, json_string_value (json_object_get (country,
+ "currency")),
+ -1);
+ }
}
/**
* Initialize the identity attributes in dependence of selected country.
- *
+ *
* @param state the state to get the attributes from
* @param country name of the selected country
*/
@@ -449,49 +466,54 @@ void
init_id_attr (json_t *state,
const char *country)
{
- GList *children, *iter;
- size_t index;
- json_t *id_attr;
- json_t *id_attributes = json_object_get (state, "required_attributes");
-
- children = gtk_container_get_children (GTK_CONTAINER
(GCG_get_main_window_object (
-
"anastasis_gtk_identity_vbox")));
- for (iter = children; iter != NULL; iter = g_list_next (iter))
- gtk_widget_hide (GTK_WIDGET (iter->data));
- g_list_free (children);
-
- json_array_foreach (id_attributes, index, id_attr)
+ GList *children, *iter;
+ size_t index;
+ json_t *id_attr;
+ json_t *id_attributes = json_object_get (state, "required_attributes");
+
+ children = gtk_container_get_children (GTK_CONTAINER (
+ GCG_get_main_window_object (
+ "anastasis_gtk_identity_vbox")));
+ for (iter = children; iter != NULL; iter = g_list_next (iter))
+ gtk_widget_hide (GTK_WIDGET (iter->data));
+ g_list_free (children);
+
+ 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 = 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)
- {
- char *label_widget;
- GNUNET_asprintf (&label_widget,
- "%s_label",
- widget_name);
- gtk_label_set_text (GTK_LABEL (GCG_get_main_window_object
(label_widget)), attr_label); //FIXME: i18n
- gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object
(widget_name)));
-
- GNUNET_free (label_widget);
- }
- else if (0 == strcmp (attr_type, "string"))
- {
- /**
- * FIXME: create new widget
- */
- }
- else if (0 == strcmp (attr_type, "date"))
- {
- /**
- * FIXME: create new widget
- */
- }
- /**
- * FIXME: handle other types
- */
+ char *label_widget;
+ GNUNET_asprintf (&label_widget,
+ "%s_label",
+ widget_name);
+ gtk_label_set_text (GTK_LABEL (GCG_get_main_window_object
(label_widget)),
+ attr_label);
// FIXME: i18n
+ gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (widget_name)));
+
+ GNUNET_free (label_widget);
}
-}
\ No newline at end of file
+ else if (0 == strcmp (attr_type, "string"))
+ {
+ /**
+ * FIXME: create new widget
+ */
+ }
+ else if (0 == strcmp (attr_type, "date"))
+ {
+ /**
+ * FIXME: create new widget
+ */
+ }
+ /**
+ * FIXME: handle other types
+ */
+ }
+}
diff --git a/src/include/anastasis-gtk_helper.h
b/src/include/anastasis-gtk_helper.h
index e37e3b7..ff7d0d1 100644
--- a/src/include/anastasis-gtk_helper.h
+++ b/src/include/anastasis-gtk_helper.h
@@ -70,28 +70,29 @@ extern struct ANASTASIS_ReduxAction *ra;
*/
void
action_cb (void *cls,
- enum ANASTASIS_ErrorCode error_code,
+ enum TALER_ErrorCode error_code,
json_t *response);
/**
* Returs the authentication providers.
- *
+ *
* @return json_t
*/
json_t *
-get_authentication_providers ();
+get_authentication_providers (void);
/**
* Reset the list of authentication providers.
*/
void
-reset_authentication_providers ();
+reset_authentication_providers (void);
+
/**
* Function to persist a state.
- *
+ *
* @param state state to persist
*/
int
@@ -110,7 +111,7 @@ GCG_get_main_window_object (const char *name);
/**
* Function to ckeck if required attributes are set.
- *
+ *
* @return bool
*/
bool
@@ -119,7 +120,7 @@ check_attributes_fullfilled ();
/**
* Checks the actual state. True, if state is correct, else false.
- *
+ *
* @param state the state to check
* @param expected_state the expected state as string
* @return bool
@@ -130,7 +131,7 @@ check_state (json_t *state, const char *expected_state);
/**
* Initialize the continent list.
- *
+ *
* @param init_state the initial state to get the continents from
*/
void
@@ -139,7 +140,7 @@ init_continent_list (json_t *init_state);
/**
* Initialize the country list in dependence of selected continent.
- *
+ *
* @param state the state to get the countries from
* @param continent name of the selected continent
*/
@@ -150,7 +151,7 @@ init_country_list (json_t *tate,
/**
* Initialize the identity attributes in dependence of selected country.
- *
+ *
* @param state the state to get the attributes from
* @param country name of the selected country
*/
@@ -161,7 +162,7 @@ init_id_attr (json_t *state,
/**
* Initialize the auhentication methods in backup mode.
- *
+ *
* @param state the state to operate on
*/
void
@@ -170,19 +171,19 @@ 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
+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
@@ -191,7 +192,7 @@ set_policy_check_buttons (json_t *state);
/**
* Initialize the policies in backup mode.
- *
+ *
* @param state the state to operate on
*/
void
@@ -224,4 +225,4 @@ anastasis_gtk_main_window_forward_clicked (GObject *object,
* Hides all frames;
*/
void
-anastasis_gtk_hide_all_frames ();
\ No newline at end of file
+anastasis_gtk_hide_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: fix ftbfs,
gnunet <=