gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] branch master updated: new files


From: gnunet
Subject: [taler-anastasis-gtk] branch master updated: new files
Date: Tue, 09 Mar 2021 21:47:58 +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 d41b367  new files
d41b367 is described below

commit d41b367683f08c3b58cc6e5a9ad11c2989476807
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Mar 9 21:47:56 2021 +0100

    new files
---
 .../anastasis-gtk_handle-secret-buttons.c          |  77 +++++++++
 src/anastasis/anastasis-gtk_io.c                   | 177 +++++++++++++++++++++
 2 files changed, 254 insertions(+)

diff --git a/src/anastasis/anastasis-gtk_handle-secret-buttons.c 
b/src/anastasis/anastasis-gtk_handle-secret-buttons.c
new file mode 100644
index 0000000..c327365
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_handle-secret-buttons.c
@@ -0,0 +1,77 @@
+/*
+     This file is part of anastasis-gtk.
+     Copyright (C) 2021 Anastasis SARL
+
+     Anastasis is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 3, or (at your
+     option) any later version.
+
+     Anastasis is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with Anastasis; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
+*/
+/**
+ * @file src/anastasis/anastasis-gtk_handle-secret-buttons.c
+ * @brief Main function of anastasis-gtk
+ * @author Christian Grothoff
+ * @author Dennis Neufeld
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_helper.h"
+#include <jansson.h>
+
+
+/**
+ * User clicked the "open" button in the dialog where the secret is entered.
+ *
+ * @param button the button
+ * @param user_data unused
+ */
+void
+anastasis_gtk_enter_secret_open_button_clicked_cb (GtkButton *button,
+                                                   gpointer user_data)
+{
+  // FIXME: open dialog
+  // load secret from file
+  GNUNET_break (0);
+}
+
+
+/**
+ * User clicked the "save as" button in the dialog with the recovered secret.
+ *
+ * @param button the button
+ * @param user_data unused
+ */
+void
+anastasis_gtk_secret_save_as_button_clicked_cb (GtkButton *button,
+                                                gpointer user_data)
+{
+  // FIXME: open save-as dialog
+  // dump secret to file
+  GNUNET_break (0);
+}
+
+
+/**
+ * User clicked the "copy" button in the dialog with the recovered secret.
+ *
+ * @param button the button
+ * @param user_data unused
+ */
+void
+anastasis_gtk_secret_copy_button_clicked_cb (GtkButton *button,
+                                             gpointer user_data)
+{
+  // FIXME: open save-as dialog
+  // dump secret to file
+  GNUNET_break (0);
+}
diff --git a/src/anastasis/anastasis-gtk_io.c b/src/anastasis/anastasis-gtk_io.c
new file mode 100644
index 0000000..05ffc0e
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_io.c
@@ -0,0 +1,177 @@
+/*
+     This file is part of anastasis-gtk.
+     Copyright (C) 2020 Anastasis SARL
+
+     Anastasis is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 3, or (at your
+     option) any later version.
+
+     Anastasis is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with Anastasis; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
+*/
+/**
+ * @file src/anastasis/anastasis-gtk_io.c
+ * @brief
+ * @author Christian Grothoff
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_helper.h"
+#include <jansson.h>
+
+
+/**
+ * Function called from the open-directory dialog upon completion.
+ *
+ * @param dialog the pseudonym selection dialog
+ * @param response_id response code from the dialog
+ * @param user_data the builder of the dialog
+ */
+void
+open_directory_dialog_response_cb (GtkDialog *dialog,
+                                   gint response_id,
+                                   gpointer user_data)
+{
+  GtkBuilder *builder = GTK_BUILDER (user_data);
+  char *filename;
+
+  if (GTK_RESPONSE_OK != response_id)
+  {
+    gtk_widget_destroy (GTK_WIDGET (dialog));
+    g_object_unref (G_OBJECT (builder));
+    return;
+  }
+  filename =
+    GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (dialog));
+  gtk_widget_destroy (GTK_WIDGET (dialog));
+  g_object_unref (G_OBJECT (builder));
+  AG_load (filename);
+  GNUNET_free (filename);
+}
+
+
+/**
+ * User clicked the "open" button.
+ *
+ * @param button the button
+ * @param user_data unused
+ */
+void
+anastasis_gtk_open_state_clicked_cb (GtkButton *button,
+                                     gpointer user_data)
+{
+  GtkWidget *ad;
+  GtkBuilder *builder;
+
+  builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_open_file_dialog.glade",
+                                        NULL);
+  if (NULL == builder)
+  {
+    GNUNET_break (0);
+    return;
+  }
+  ad = GTK_WIDGET (gtk_builder_get_object (builder,
+                                           "open_file_dialog"));
+  {
+    GtkWidget *toplevel;
+
+    toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
+    gtk_window_set_transient_for (GTK_WINDOW (ad),
+                                  GTK_WINDOW (toplevel));
+    gtk_window_present (GTK_WINDOW (ad));
+  }
+}
+
+
+/**
+ * Function called from the open-directory dialog upon completion.
+ *
+ * @param dialog the pseudonym selection dialog
+ * @param response_id response code from the dialog
+ * @param user_data the builder of the dialog
+ */
+void
+save_directory_dialog_response_cb (GtkDialog *dialog,
+                                   gint response_id,
+                                   gpointer user_data)
+{
+  GtkBuilder *builder = GTK_BUILDER (user_data);
+  char *filename;
+  const char *ana;
+
+  if (GTK_RESPONSE_ACCEPT != response_id)
+  {
+    gtk_widget_destroy (GTK_WIDGET (dialog));
+    g_object_unref (G_OBJECT (builder));
+    return;
+  }
+  filename =
+    GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (dialog));
+  gtk_widget_destroy (GTK_WIDGET (dialog));
+  g_object_unref (G_OBJECT (builder));
+  ana = strstr (filename,
+                ".ana");
+  if ( (NULL == ana) ||
+       (4 != strlen (ana)) )
+  {
+    char *tmp;
+
+    GNUNET_asprintf (&tmp,
+                     "%s.ana",
+                     filename);
+    GNUNET_free (filename);
+    filename = tmp;
+  }
+  if (0 !=
+      json_dump_file (redux_state,
+                      filename,
+                      JSON_COMPACT))
+  {
+    AG_error ("Failed to write state to `%s'\n",
+              filename);
+  }
+  GNUNET_free (filename);
+}
+
+
+/**
+ * User clicked the "save as" button.
+ *
+ * @param button the button
+ * @param user_data unused
+ */
+void
+anastasis_gtk_main_window_save_as_button_clicked_cb (GtkButton *button,
+                                                     gpointer user_data)
+{
+  GtkWidget *ad;
+  GtkBuilder *builder;
+
+  builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_save_file_dialog.glade",
+                                        NULL);
+  if (NULL == builder)
+  {
+    GNUNET_break (0);
+    return;
+  }
+  ad = GTK_WIDGET (gtk_builder_get_object (builder,
+                                           "save_file_dialog"));
+  gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (ad),
+                                     "untitled.ana");
+  {
+    GtkWidget *toplevel;
+
+    toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
+    gtk_window_set_transient_for (GTK_WINDOW (ad),
+                                  GTK_WINDOW (toplevel));
+    gtk_window_present (GTK_WINDOW (ad));
+  }
+}

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