gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] 05/05: worked on authentication_frame, add methods


From: gnunet
Subject: [taler-anastasis-gtk] 05/05: worked on authentication_frame, add methods, edit methods, delete methods
Date: Wed, 23 Sep 2020 19:02:55 +0200

This is an automated email from the git hooks/post-receive script.

dennis-neufeld pushed a commit to branch master
in repository anastasis-gtk.

commit 095cb095907d33460b4649194ebbc079621dec52
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Wed Sep 23 19:02:35 2020 +0200

    worked on authentication_frame, add methods, edit methods, delete methods
---
 contrib/anastasis_gtk_main_window.glade |  46 +--
 src/anastasis/anastasis-gtk_backup.c    | 712 ++++++++++++++++++++++++++++----
 2 files changed, 653 insertions(+), 105 deletions(-)

diff --git a/contrib/anastasis_gtk_main_window.glade 
b/contrib/anastasis_gtk_main_window.glade
index 6c30bcf..8b3ad4f 100644
--- a/contrib/anastasis_gtk_main_window.glade
+++ b/contrib/anastasis_gtk_main_window.glade
@@ -15,11 +15,12 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton">
+              <object class="GtkButton" 
id="anastasis_gtk_b_email_dialog_btn_cancel">
                 <property name="label" translatable="yes">Cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
+                <signal name="clicked" 
handler="anastasis_gtk_b_email_dialog_btn_cancel_clicked_cb" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">True</property>
@@ -28,7 +29,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton">
+              <object class="GtkButton" 
id="anastasis_gtk_b_email_dialog_btn_ok">
                 <property name="label" translatable="yes">OK</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -122,7 +123,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkEntry">
+                  <object class="GtkEntry" 
id="anastasis_gtk_b_email_dialog_mailaddress_entry">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
@@ -170,11 +171,12 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton">
+              <object class="GtkButton" 
id="anastasis_gtk_b_post_dialog_btn_cancel">
                 <property name="label" translatable="yes">Cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
+                <signal name="clicked" 
handler="anastasis_gtk_b_post_dialog_btn_cancel_clicked_cb" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">True</property>
@@ -183,7 +185,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton">
+              <object class="GtkButton" 
id="anastasis_gtk_b_post_dialog_btn_ok">
                 <property name="label" translatable="yes">OK</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -277,7 +279,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkEntry">
+                  <object class="GtkEntry" 
id="anastasis_gtk_b_post_dialog_full_name_entry">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
@@ -312,7 +314,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkEntry">
+                  <object class="GtkEntry" 
id="anastasis_gtk_b_post_dialog_street_entry">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
@@ -347,7 +349,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkEntry">
+                  <object class="GtkEntry" 
id="anastasis_gtk_b_post_dialog_city_entry">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
@@ -393,7 +395,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkEntry">
+                  <object class="GtkEntry" 
id="anastasis_gtk_b_post_dialog_postcode_entry">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
@@ -428,7 +430,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkEntry">
+                  <object class="GtkEntry" 
id="anastasis_gtk_b_post_dialog_country_entry">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
@@ -495,7 +497,6 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <signal name="clicked" 
handler="anastasis_gtk_b_question_dialog_btn_ok_clicked_cb" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">True</property>
@@ -684,6 +685,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
+                <signal name="clicked" 
handler="anastasis_gtk_b_sms_dialog_btn_cancel_clicked_cb" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">True</property>
@@ -797,7 +799,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkEntry">
+                  <object class="GtkEntry" 
id="anastasis_gtk_b_sms_dialog_phonenumber_entry">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
@@ -845,11 +847,12 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton">
+              <object class="GtkButton" 
id="anastasis_gtk_b_video_dialog_btn_cancel">
                 <property name="label" translatable="yes">Cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
+                <signal name="clicked" 
handler="anastasis_gtk_b_video_dialog_btn_cancel_clicked_cb" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">True</property>
@@ -858,7 +861,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton">
+              <object class="GtkButton" 
id="anastasis_gtk_b_video_dialog_btn_ok">
                 <property name="label" translatable="yes">OK</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -952,7 +955,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkEntry">
+                  <object class="GtkEntry" 
id="anastasis_gtk_b_video_dialog_photo_path_entry">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                   </object>
@@ -1543,18 +1546,6 @@
                                                 <property 
name="position">0</property>
                                               </packing>
                                             </child>
-                                            <child>
-                                              <object class="GtkScrollbar">
-                                                <property 
name="visible">True</property>
-                                                <property 
name="can_focus">False</property>
-                                                <property 
name="orientation">vertical</property>
-                                              </object>
-                                              <packing>
-                                                <property 
name="expand">False</property>
-                                                <property 
name="fill">True</property>
-                                                <property 
name="position">1</property>
-                                              </packing>
-                                            </child>
                                           </object>
                                           <packing>
                                             <property 
name="expand">False</property>
@@ -1714,6 +1705,7 @@ Provider</property>
                                           <packing>
                                             <property 
name="expand">False</property>
                                             <property 
name="fill">True</property>
+                                            <property 
name="pack_type">end</property>
                                             <property 
name="position">2</property>
                                           </packing>
                                         </child>
diff --git a/src/anastasis/anastasis-gtk_backup.c 
b/src/anastasis/anastasis-gtk_backup.c
index 49eb1e2..ad5f3b4 100644
--- a/src/anastasis/anastasis-gtk_backup.c
+++ b/src/anastasis/anastasis-gtk_backup.c
@@ -94,6 +94,23 @@ struct ConfigState
   struct ServerInfo *server;
 };
 
+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 "authentication methods edit"-button is clicked.
+ *
+ * @param object
+ * @param user_data unused
+ */
+void
+anastasis_gtk_b_auth_method_btn_edit_clicked_cb (GObject *object,
+                                                 gpointer user_data);
+
 
 /**
  * Callback invoked if the the "backup"-button is clicked.
@@ -124,66 +141,6 @@ anastasis_gtk_backup_button_clicked (GObject *object,
 }
 
 
-/**
- * Callback invoked if the the "authentication methods edit"-button is clicked.
- *
- * @param object
- * @param user_data unused
- */
-void
-anastasis_gtk_b_auth_method_btn_edit_clicked_cb (GObject *object,
-                                                 gpointer user_data)
-{
-     GList *children, *iter;
-     children = gtk_container_get_children (GTK_CONTAINER (user_data));
-     char *type;
-     unsigned int index = 0;
-     for (iter = children; iter != NULL; iter = g_list_next (iter))
-     {
-          gchar *text;
-          gchar *widget_name = gtk_widget_get_name (GTK_WIDGET (iter->dara));
-          if (0 == strcmp (widget_name, "GtkLabel"))
-          {
-               text = gtk_label_get_text (GTK_LABEL (iter->dara));
-               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)
-          {
-               if (0 == strcmp (type, "question"))
-               {
-                    if (index == 1)
-                         gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
-                                        
"anastasis_gtk_b_question_dialog_question_entry")), text);
-                    if (index == 2)
-                         gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
-                                        
"anastasis_gtk_b_question_dialog_answer_entry")), text);
-               }
-          }
-          index++;
-     }
-     g_list_free (children);
-
-     GtkButton *ok_btn = GCG_get_main_window_object (
-                                        
"anastasis_gtk_b_question_dialog_btn_ok");
-     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")));
-}
-
-
 /**
  * Callback invoked if the the "authentication methods delete"-button is 
clicked.
  *
@@ -198,21 +155,6 @@ anastasis_gtk_b_auth_method_btn_delete_clicked_cb (GObject 
*object,
 }
 
 
-/**
- * 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")));
-}
-
-
 /**
  * Callback invoked if the the "secure question OK"-button is clicked.
  *
@@ -224,9 +166,20 @@ anastasis_gtk_b_question_dialog_btn_ok_clicked_cb (GObject 
*object,
                                                    gpointer user_data)
 {
      GtkBox *vbox = GTK_BOX (GCG_get_main_window_object 
("anastasis_gtk_b_authentication_vbox"));
-     GtkHBox *hbox = (GtkHBox *) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+     GtkHBox *hbox;
      GtkSeparator *separator = (GtkSeparator *) gtk_separator_new 
(GTK_ORIENTATION_HORIZONTAL);
 
+     bool is_box = GTK_IS_BOX (user_data);
+     if (is_box)
+     {
+          hbox = (GtkHBox *) user_data;
+          GList *children, *iter;
+          children = gtk_container_get_children (GTK_CONTAINER (user_data));
+          for (iter = children; iter != NULL; iter = g_list_next (iter))
+               gtk_widget_destroy (iter->data);
+     }
+     else
+          hbox = (GtkHBox *) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
      // set labels
      GtkLabel *label_prefix = (GtkLabel *) gtk_label_new ("Q: ");
      gchar *question = gtk_entry_get_text (
@@ -256,8 +209,11 @@ anastasis_gtk_b_question_dialog_btn_ok_clicked_cb (GObject 
*object,
      gtk_box_pack_start (hbox, label_answer, 0, 0, 0);
      gtk_box_pack_end (hbox, buttons, 0, 0, 0);
 
-     gtk_box_pack_start (vbox, hbox, 0, 0, 0);
-     gtk_box_pack_start (vbox, separator, 0, 0, 0);
+     if (! is_box)
+     {
+          gtk_box_pack_start (vbox, hbox, 0, 0, 0);
+          gtk_box_pack_start (vbox, separator, 0, 0, 0);
+     }
 
      gtk_widget_show (GTK_WIDGET (hbox));
      gtk_widget_show (GTK_WIDGET (label_prefix));
@@ -277,6 +233,29 @@ anastasis_gtk_b_question_dialog_btn_ok_clicked_cb (GObject 
*object,
 }
 
 
+/**
+ * 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 = 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.
  *
@@ -296,6 +275,105 @@ anastasis_gtk_b_question_dialog_btn_cancel_clicked_cb 
(GObject *object,
 }
 
 
+/**
+ * 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"));
+     GtkSeparator *separator = (GtkSeparator *) gtk_separator_new 
(GTK_ORIENTATION_HORIZONTAL);
+
+     bool is_box = GTK_IS_BOX (user_data);
+     if (is_box)
+     {
+          hbox = (GtkHBox *) user_data;
+          GList *children, *iter;
+          children = gtk_container_get_children (GTK_CONTAINER (user_data));
+          for (iter = children; iter != NULL; iter = g_list_next (iter))
+               gtk_widget_destroy (iter->data);
+     }
+     else
+          hbox = (GtkHBox *) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+     // set labels
+     GtkLabel *label_prefix = (GtkLabel *) gtk_label_new ("POST: ");
+     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);
+     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);
+     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);
+     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);
+     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);
+
+     // set buttons
+     GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_hbox_new(1, 0);
+     GtkButton  *edit_btn = (GtkButton *) gtk_button_new_with_label ("edit");
+     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_with_label 
("delete");
+     g_signal_connect (delete_btn, 
+                       "clicked", 
+                       G_CALLBACK 
(anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
+                       hbox);
+     gtk_box_pack_start (buttons, edit_btn, 0, 0, 0);
+     gtk_box_pack_start (buttons, delete_btn, 0, 0, 0);
+     
+     gtk_box_pack_start (hbox, label_prefix, 0, 0, 0);
+     gtk_box_pack_start (hbox, label_full_name, 0, 0, 0);
+     gtk_box_pack_start (hbox, label_street, 0, 0, 0);
+     gtk_box_pack_start (hbox, label_city, 0, 0, 0);
+     gtk_box_pack_start (hbox, label_postcode, 0, 0, 0);
+     gtk_box_pack_start (hbox, label_country, 0, 0, 0);
+     gtk_box_pack_end (hbox, buttons, 0, 0, 0);
+
+     if (! is_box)
+     {
+          gtk_box_pack_start (vbox, hbox, 0, 0, 0);
+          gtk_box_pack_start (vbox, separator, 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_widget_show (GTK_WIDGET (separator));
+
+     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 "post"-button is clicked.
  *
@@ -308,6 +386,110 @@ anastasis_gtk_btn_add_auth_post_clicked_cb (GObject 
*object,
 {
      gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
                                         "anastasis_gtk_b_post_dialog")));
+     GtkButton *ok_btn = 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.
+ *
+ * @param object
+ * @param user_data unused
+ */
+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"));
+     GtkSeparator *separator = (GtkSeparator *) gtk_separator_new 
(GTK_ORIENTATION_HORIZONTAL);
+
+     bool is_box = GTK_IS_BOX (user_data);
+     if (is_box)
+     {
+          hbox = (GtkHBox *) user_data;
+          GList *children, *iter;
+          children = gtk_container_get_children (GTK_CONTAINER (user_data));
+          for (iter = children; iter != NULL; iter = g_list_next (iter))
+               gtk_widget_destroy (iter->data);
+     }
+     else
+          hbox = (GtkHBox *) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+     // set labels
+     GtkLabel *label_prefix = (GtkLabel *) gtk_label_new ("VIDEO: ");
+     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);
+
+     // set buttons
+     GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_hbox_new(1, 0);
+     GtkButton  *edit_btn = (GtkButton *) gtk_button_new_with_label ("edit");
+     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_with_label 
("delete");
+     g_signal_connect (delete_btn, 
+                       "clicked", 
+                       G_CALLBACK 
(anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
+                       hbox);
+     gtk_box_pack_start (buttons, edit_btn, 0, 0, 0);
+     gtk_box_pack_start (buttons, delete_btn, 0, 0, 0);
+     
+     gtk_box_pack_start (hbox, label_prefix, 0, 0, 0);
+     gtk_box_pack_start (hbox, label_photo_path, 0, 0, 0);
+     gtk_box_pack_end (hbox, buttons, 0, 0, 0);
+
+     if (! is_box)
+     {
+          gtk_box_pack_start (vbox, hbox, 0, 0, 0);
+          gtk_box_pack_start (vbox, separator, 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_widget_show (GTK_WIDGET (separator));
+
+     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")));
 }
 
 
@@ -323,6 +505,102 @@ 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 = 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"));
+     GtkSeparator *separator = (GtkSeparator *) gtk_separator_new 
(GTK_ORIENTATION_HORIZONTAL);
+
+     bool is_box = GTK_IS_BOX (user_data);
+     if (is_box)
+     {
+          hbox = (GtkHBox *) user_data;
+          GList *children, *iter;
+          children = gtk_container_get_children (GTK_CONTAINER (user_data));
+          for (iter = children; iter != NULL; iter = g_list_next (iter))
+               gtk_widget_destroy (iter->data);
+     }
+     else
+          hbox = (GtkHBox *) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+     // set labels
+     GtkLabel *label_prefix = (GtkLabel *) gtk_label_new ("SMS: ");
+     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);
+
+     // set buttons
+     GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_hbox_new(1, 0);
+     GtkButton  *edit_btn = (GtkButton *) gtk_button_new_with_label ("edit");
+     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_with_label 
("delete");
+     g_signal_connect (delete_btn, 
+                       "clicked", 
+                       G_CALLBACK 
(anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
+                       hbox);
+     gtk_box_pack_start (buttons, edit_btn, 0, 0, 0);
+     gtk_box_pack_start (buttons, delete_btn, 0, 0, 0);
+     
+     gtk_box_pack_start (hbox, label_prefix, 0, 0, 0);
+     gtk_box_pack_start (hbox, label_phonenumber, 0, 0, 0);
+     gtk_box_pack_end (hbox, buttons, 0, 0, 0);
+
+     if (! is_box)
+     {
+          gtk_box_pack_start (vbox, hbox, 0, 0, 0);
+          gtk_box_pack_start (vbox, separator, 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_widget_show (GTK_WIDGET (separator));
+
+     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")));
 }
 
 
@@ -338,6 +616,102 @@ anastasis_gtk_btn_add_auth_sms_clicked_cb (GObject 
*object,
 {
      gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
                                         "anastasis_gtk_b_sms_dialog")));
+     GtkButton *ok_btn = 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"));
+     GtkSeparator *separator = (GtkSeparator *) gtk_separator_new 
(GTK_ORIENTATION_HORIZONTAL);
+
+     bool is_box = GTK_IS_BOX (user_data);
+     if (is_box)
+     {
+          hbox = (GtkHBox *) user_data;
+          GList *children, *iter;
+          children = gtk_container_get_children (GTK_CONTAINER (user_data));
+          for (iter = children; iter != NULL; iter = g_list_next (iter))
+               gtk_widget_destroy (iter->data);
+     }
+     else
+          hbox = (GtkHBox *) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+     // set labels
+     GtkLabel *label_prefix = (GtkLabel *) gtk_label_new ("EMAIL: ");
+     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);
+
+     // set buttons
+     GtkHButtonBox *buttons = (GtkHButtonBox *) gtk_hbox_new(1, 0);
+     GtkButton  *edit_btn = (GtkButton *) gtk_button_new_with_label ("edit");
+     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_with_label 
("delete");
+     g_signal_connect (delete_btn, 
+                       "clicked", 
+                       G_CALLBACK 
(anastasis_gtk_b_auth_method_btn_delete_clicked_cb),
+                       hbox);
+     gtk_box_pack_start (buttons, edit_btn, 0, 0, 0);
+     gtk_box_pack_start (buttons, delete_btn, 0, 0, 0);
+     
+     gtk_box_pack_start (hbox, label_prefix, 0, 0, 0);
+     gtk_box_pack_start (hbox, label_mailaddress, 0, 0, 0);
+     gtk_box_pack_end (hbox, buttons, 0, 0, 0);
+
+     if (! is_box)
+     {
+          gtk_box_pack_start (vbox, hbox, 0, 0, 0);
+          gtk_box_pack_start (vbox, separator, 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_widget_show (GTK_WIDGET (separator));
+
+     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")));
 }
 
 
@@ -353,6 +727,188 @@ anastasis_gtk_btn_add_auth_email_clicked_cb (GObject 
*object,
 {
      gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object (
                                         "anastasis_gtk_b_email_dialog")));
+     GtkButton *ok_btn = 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 unused
+ */
+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));
+     char *type;
+     unsigned int index = 0;
+     for (iter = children; iter != NULL; iter = g_list_next (iter))
+     {
+          gchar *text;
+          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)
+          {
+               if (0 == strcmp (type, "question"))
+               {
+                    if (index == 1)
+                         gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_question_dialog_question_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 = 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),
+                                                              user_data);
+                         
+                         gtk_widget_show (GTK_WIDGET 
(GCG_get_main_window_object (
+                                                            
"anastasis_gtk_b_question_dialog")));
+                         break;
+                    }
+                    
+               }
+               if (0 == strcmp (type, "sms"))
+               {
+                    if (index == 1)
+                    {
+                         gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_sms_dialog_phonenumber_entry")), text);
+                         GtkButton *ok_btn = 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),
+                                                          user_data);
+                         
+                         gtk_widget_show (GTK_WIDGET 
(GCG_get_main_window_object (
+                                                            
"anastasis_gtk_b_sms_dialog")));
+                         break;
+                    }
+               }
+               if (0 == strcmp (type, "email"))
+               {
+                    if (index == 1)
+                    {
+                         gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_email_dialog_mailaddress_entry")), text);
+                         GtkButton *ok_btn = 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),
+                                                            user_data);
+                         
+                         gtk_widget_show (GTK_WIDGET 
(GCG_get_main_window_object (
+                                                            
"anastasis_gtk_b_email_dialog")));
+                         break;
+                    }
+               }
+               if (0 == strcmp (type, "post"))
+               {
+                    if (index == 1)
+                         gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_post_dialog_full_name_entry")), text);
+                    if (index == 2)
+                         gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_post_dialog_street_entry")), text);
+                    if (index == 3)
+                         gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_post_dialog_city_entry")), text);
+                    if (index == 4)
+                         gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_post_dialog_postcode_entry")), text);
+                    if (index == 5)
+                    {
+                         gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_post_dialog_country_entry")), text);
+                         GtkButton *ok_btn = 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),
+                                                           user_data);
+                         
+                         gtk_widget_show (GTK_WIDGET 
(GCG_get_main_window_object (
+                                                            
"anastasis_gtk_b_post_dialog")));
+                         break;
+                    }
+               }
+               if (0 == strcmp (type, "video"))
+               {
+                    if (index == 1)
+                    {
+                         gtk_entry_set_text (GTK_ENTRY 
(GCG_get_main_window_object (
+                                        
"anastasis_gtk_b_video_dialog_photo_path_entry")), text);
+                         GtkButton *ok_btn = 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_video_dialog_btn_ok_clicked_cb),
+                                                            user_data);
+                         
+                         gtk_widget_show (GTK_WIDGET 
(GCG_get_main_window_object (
+                                                            
"anastasis_gtk_b_video_dialog")));
+                         break;
+                    }
+               }
+          }
+          index++;
+     }
+     g_list_free (children);
 }
 
 

-- 
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]