gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] branch master updated: dce


From: gnunet
Subject: [taler-anastasis-gtk] branch master updated: dce
Date: Mon, 15 Mar 2021 10:53:34 +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 59d6259  dce
59d6259 is described below

commit 59d625925ed23e541895a60a101622bf1949216e
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Mon Mar 15 10:53:25 2021 +0100

    dce
---
 src/anastasis/anastasis-gtk_backup.c | 1036 ----------------------------------
 1 file changed, 1036 deletions(-)

diff --git a/src/anastasis/anastasis-gtk_backup.c 
b/src/anastasis/anastasis-gtk_backup.c
index f4deb29..7799ce4 100644
--- a/src/anastasis/anastasis-gtk_backup.c
+++ b/src/anastasis/anastasis-gtk_backup.c
@@ -31,346 +31,6 @@
 #include <jansson.h>
 
 
-guint g_signal_question;
-guint g_signal_sms;
-guint g_signal_email;
-guint g_signal_post;
-guint g_signal_video;
-
-
-/**
- * Callback invoked if the the "secure question OK"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-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"));
-
-  // 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,
-                                 &AG_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);
-}
-
-
-/**
- * Callback invoked if the the "secure question"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-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);
-}
-
-
-/**
- * Callback invoked if the the "secure question Cancel"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-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")));
-}
-
-
-/**
- * Callback invoked if the the "post OK"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-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,
-                                 &AG_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);
-}
-
-
-/**
- * Callback invoked if the the "post"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-void
-anastasis_gtk_btn_add_auth_post_clicked_cb (GObject *object,
-                                            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);
-}
-
-
-/**
- * Callback invoked if the the "secure question Cancel"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-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")));
-}
-
-
 /**
  * Callback invoked if the the "video OK"-button is clicked.
  *
@@ -477,700 +137,4 @@ anastasis_gtk_btn_add_auth_video_clicked_cb (GObject 
*object,
 {
   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);
-}
-
-
-/**
- * Callback invoked if the the "video Cancel"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-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")));
-}
-
-
-/**
- * Callback invoked if the the "sms OK"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-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,
-                                 &AG_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);
-}
-
-
-/**
- * Callback invoked if the the "sms"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-void
-anastasis_gtk_btn_add_auth_sms_clicked_cb (GObject *object,
-                                           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);
-}
-
-
-/**
- * Callback invoked if the the "sms Cancel"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-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")));
-}
-
-
-/**
- * Callback invoked if the the "email OK"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-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,
-                                 &AG_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);
-}
-
-
-/**
- * Callback invoked if the the "email"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-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);
-}
-
-
-/**
- * Callback invoked if the the "email Cancel"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-void
-anastasis_gtk_b_email_dialog_btn_cancel_clicked_cb (GObject *object,
-                                                    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")));
-}
-
-
-/**
- * Callback invoked if the the "authentication methods edit"-button is clicked.
- *
- * @param object
- * @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"))
-    {
-      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)
-          {
-            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);
-    }
-    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++)
-    {
-      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")));
-    }
-  }
 }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]