gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] branch master updated: work on context menu in ana


From: gnunet
Subject: [taler-anastasis-gtk] branch master updated: work on context menu in anastasis-gtk
Date: Wed, 30 Jun 2021 14:08:29 +0200

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 fe93673  work on context menu in anastasis-gtk
fe93673 is described below

commit fe93673039f65a4585e9309d3c03601ce606b5b7
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Jun 30 14:08:27 2021 +0200

    work on context menu in anastasis-gtk
---
 contrib/anastasis_gtk_main_window.glade            |   9 +
 src/anastasis/Makefile.am                          |   8 +
 src/anastasis/anastasis-gtk_action.c               |  47 ++--
 .../anastasis-gtk_handle-policy-activate.c         |  66 +++++
 src/anastasis/anastasis-gtk_handle-policy-button.c |  78 ++++++
 src/anastasis/anastasis-gtk_handle-policy-meta.c   | 304 +++++++++++++++++----
 src/anastasis/anastasis-gtk_helper.h               |  17 +-
 src/anastasis/anastasis-gtk_pe-add-policy.c        |  39 +++
 src/anastasis/anastasis-gtk_pe-delete-challenge.c  |  38 +++
 src/anastasis/anastasis-gtk_pe-delete-policy.c     |  38 +++
 src/anastasis/anastasis-gtk_pe-edit-policy.c       |  38 +++
 src/anastasis/anastasis-gtk_pe.h                   |  66 +++++
 12 files changed, 679 insertions(+), 69 deletions(-)

diff --git a/contrib/anastasis_gtk_main_window.glade 
b/contrib/anastasis_gtk_main_window.glade
index c561b86..9eff709 100644
--- a/contrib/anastasis_gtk_main_window.glade
+++ b/contrib/anastasis_gtk_main_window.glade
@@ -156,6 +156,12 @@ Author: Christian Grothoff, Dennis Neufeld
       <column type="gchararray"/>
       <!-- column-name expiration_time_str -->
       <column type="gchararray"/>
+      <!-- column-name policy_index -->
+      <column type="guint"/>
+      <!-- column-name is_challenge -->
+      <column type="gboolean"/>
+      <!-- column-name method_index -->
+      <column type="guint"/>
     </columns>
   </object>
   <object class="GtkAdjustment" id="policy_version_adjustment">
@@ -1234,6 +1240,9 @@ Author: Christian Grothoff, Dennis Neufeld
                                             <property 
name="visible">True</property>
                                             <property 
name="can-focus">True</property>
                                             <property 
name="model">policy_review_treestore</property>
+                                            <signal name="button-press-event" 
handler="anastasis_gtk_review_policy_treeview_button_press_event_cb" 
swapped="no"/>
+                                            <signal name="key-press-event" 
handler="anastasis_gtk_review_policy_treeview_key_press_event_cb" swapped="no"/>
+                                            <signal name="row-activated" 
handler="anastasis_gtk_review_policy_treeview_row_activated_cb" swapped="no"/>
                                             <child internal-child="selection">
                                               <object 
class="GtkTreeSelection"/>
                                             </child>
diff --git a/src/anastasis/Makefile.am b/src/anastasis/Makefile.am
index 9a2ec03..27b63b0 100644
--- a/src/anastasis/Makefile.am
+++ b/src/anastasis/Makefile.am
@@ -40,8 +40,16 @@ anastasis_gtk_SOURCES = \
   anastasis-gtk_handle-method-question.c \
   anastasis-gtk_handle-method-sms.c \
   anastasis-gtk_handle-payqr-selection-changed.c \
+  anastasis-gtk_handle-policy-activate.c \
+  anastasis-gtk_handle-policy-button.c \
+  anastasis-gtk_handle-policy-meta.c \
   anastasis-gtk_handle-policy-version-changed.c \
   anastasis-gtk_helper.c  anastasis-gtk_helper.h \
+  anastasis-gtk_pe.h \
+  anastasis-gtk_pe-add-policy.c \
+  anastasis-gtk_pe-delete-challenge.c \
+  anastasis-gtk_pe-delete-policy.c \
+  anastasis-gtk_pe-edit-policy.c \
   os_installation.c
 
 anastasis_gtk_LDADD = \
diff --git a/src/anastasis/anastasis-gtk_action.c 
b/src/anastasis/anastasis-gtk_action.c
index 344d5be..b829a0a 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -875,24 +875,31 @@ action_policies_reviewing (void)
           GNUNET_break (0);
           continue;
         }
-        gtk_tree_store_insert_with_values (ts,
-                                           &miter,
-                                           &piter, /* parent */
-                                           -1, /* append */
-                                           AG_PRMC_POLICY_NAME,
-                                           instructions,
-                                           AG_PRMC_METHOD_TYPE,
-                                           type,
-                                           AG_PRMC_COST,
-                                           TALER_amount2s (&method_cost),
-                                           AG_PRMC_PROVIDER_URL,
-                                           provider,
-                                           AG_PRMC_EXPIRATION_TIME_STR,
-                                           /* FIXME #6841: support paying for 
recovery documents to be stored for more than one 'term' */
-                                           
GNUNET_STRINGS_absolute_time_to_string (
-                                             GNUNET_TIME_relative_to_absolute (
-                                               lt)),
-                                           -1);
+        gtk_tree_store_insert_with_values (
+          ts,
+          &miter,
+          &piter,   /* parent */
+          -1,       /* append */
+          AG_PRMC_POLICY_NAME,
+          instructions,
+          AG_PRMC_METHOD_TYPE,
+          type,
+          AG_PRMC_COST,
+          TALER_amount2s (&method_cost),
+          AG_PRMC_PROVIDER_URL,
+          provider,
+          AG_PRMC_EXPIRATION_TIME_STR,
+          /* FIXME #6841: support paying for recovery documents to be stored 
for more than one 'term' */
+          GNUNET_STRINGS_absolute_time_to_string (
+            GNUNET_TIME_relative_to_absolute (
+              lt)),
+          AG_PRMC_POLICY_INDEX,
+          (guint) pindex,
+          AG_PRMC_IS_CHALLENGE,
+          TRUE,
+          AG_PRMC_METHOD_INDEX,
+          (guint) mindex,
+          -1);
         min_lt = GNUNET_TIME_relative_min (lt,
                                            min_lt);
         if (NULL == summary)
@@ -922,6 +929,10 @@ action_policies_reviewing (void)
                           GNUNET_STRINGS_absolute_time_to_string (
                             GNUNET_TIME_relative_to_absolute (
                               min_lt)),
+                          AG_PRMC_POLICY_INDEX,
+                          (guint) pindex,
+                          AG_PRMC_IS_CHALLENGE,
+                          FALSE,
                           -1);
       GNUNET_free (summary);
     }
diff --git a/src/anastasis/anastasis-gtk_handle-policy-activate.c 
b/src/anastasis/anastasis-gtk_handle-policy-activate.c
new file mode 100644
index 0000000..ddb89ec
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_handle-policy-activate.c
@@ -0,0 +1,66 @@
+/*
+     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-policy-activate.c
+ * @brief Handle double-click in policy review
+ * @author Christian Grothoff
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_action.h"
+#include "anastasis-gtk_helper.h"
+#include "anastasis-gtk_pe.h"
+#include <jansson.h>
+
+
+void
+anastasis_gtk_review_policy_treeview_row_activated_cb (
+                                                       GtkTreeView       
*tree_view,
+                                                       GtkTreePath       *path,
+                                                       GtkTreeViewColumn 
*column,
+                                                       gpointer           
user_data)
+{
+  GtkTreeModel *tm = gtk_tree_view_get_model (tree_view);
+  GtkTreeIter iter;
+  guint pindex;
+  gboolean is_challenge;
+
+  if (NULL == path)
+    return;
+  if (! gtk_tree_model_get_iter (tm,
+                                 &iter,
+                                 path))
+  {
+    GNUNET_break (0);
+    return;
+  }
+  gtk_tree_path_free (path);
+  gtk_tree_model_get (tm,
+                      &iter,
+                      AG_PRMC_POLICY_INDEX,
+                      &pindex,
+                      AG_PRMC_IS_CHALLENGE,
+                      &is_challenge,
+                      -1);
+  if (! is_challenge)
+    return;
+  AG_edit_policy (pindex);
+}
diff --git a/src/anastasis/anastasis-gtk_handle-policy-button.c 
b/src/anastasis/anastasis-gtk_handle-policy-button.c
new file mode 100644
index 0000000..4b4cbdd
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_handle-policy-button.c
@@ -0,0 +1,78 @@
+/*
+     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-policy-button.c
+ * @brief Handle right-click context menu in policy review
+ * @author Christian Grothoff
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_action.h"
+#include "anastasis-gtk_helper.h"
+#include "anastasis-gtk_pe.h"
+#include <jansson.h>
+
+
+gboolean
+anastasis_gtk_review_policy_treeview_key_press_event_cb (GtkWidget *widget,
+                                                         GdkEvent  *event,
+                                                         gpointer user_data)
+{
+  GtkTreeView *tv;
+  GtkTreeSelection *ts;
+  GtkTreeModel *tm;
+  GtkTreeIter iter;
+  guint pindex;
+  gboolean is_challenge;
+  guint mindex;
+
+  if ( (GDK_KEY_PRESS != event->type) ||
+       (GDK_KEY_Delete != ((GdkEventKey *) event)->keyval) )
+    return FALSE;
+  tv = GTK_TREE_VIEW (GCG_get_main_window_object (
+                        "anastasis_gtk_review_policy_treeview"));
+  ts = gtk_tree_view_get_selection (tv);
+  if (! gtk_tree_selection_get_selected (ts,
+                                         &tm,
+                                         &iter))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Nothing selected, cannot delete\n");
+    return FALSE;
+  }
+  gtk_tree_model_get (tm,
+                      &iter,
+                      AG_PRMC_POLICY_INDEX,
+                      &pindex,
+                      AG_PRMC_IS_CHALLENGE,
+                      &is_challenge,
+                      AG_PRMC_METHOD_INDEX,
+                      &mindex,
+                      -1);
+  if (is_challenge)
+    AG_delete_challenge (pindex,
+                         mindex);
+  else
+    AG_delete_policy (pindex);
+  return TRUE;
+
+  /* FIXME: check if user pressed 'delete' key and then delete policy / policy 
auth method */
+}
diff --git a/src/anastasis/anastasis-gtk_handle-policy-meta.c 
b/src/anastasis/anastasis-gtk_handle-policy-meta.c
index 3b41ea4..5ec16ed 100644
--- a/src/anastasis/anastasis-gtk_handle-policy-meta.c
+++ b/src/anastasis/anastasis-gtk_handle-policy-meta.c
@@ -27,23 +27,174 @@
 #include <gnunet/gnunet_util_lib.h>
 #include "anastasis-gtk_action.h"
 #include "anastasis-gtk_helper.h"
+#include "anastasis-gtk_pe.h"
 #include <jansson.h>
 
 
+/**
+ * Context for menu callbacks.
+ */
+struct MenuContext
+{
+  /**
+   * Reference to the row that the user right-clicked.
+   */
+  GtkTreeRowReference *rr;
+
+};
+
+
+/**
+ * The user selected the 'add policy' menu.
+ *
+ * @param menuitem the selected menu
+ * @param user_data a `struct MenuContext`
+ */
+static void
+add_from_ctx_menu (GtkMenuItem *menuitem,
+                   gpointer user_data)
+{
+  (void) user_data;
+  (void) menuitem;
+  AG_add_policy ();
+}
+
+
+/**
+ * The user selected the 'delete challenge' menu item.
+ *
+ * @param menuitem the selected menu
+ * @param user_data a `struct MenuContext`
+ */
+static void
+delete_challenge_from_ctx_menu (GtkMenuItem *menuitem,
+                                gpointer user_data)
+{
+  struct MenuContext *ctx = user_data;
+  GtkTreePath *path = gtk_tree_row_reference_get_path (ctx->rr);
+  GtkTreeModel *tm = gtk_tree_row_reference_get_model (ctx->rr);
+  GtkTreeIter iter;
+  guint pindex;
+  gboolean is_challenge;
+  guint mindex;
+
+  if (NULL == path)
+    return;
+  if (! gtk_tree_model_get_iter (tm,
+                                 &iter,
+                                 path))
+  {
+    GNUNET_break (0);
+    return;
+  }
+  gtk_tree_path_free (path);
+  gtk_tree_model_get (tm,
+                      &iter,
+                      AG_PRMC_POLICY_INDEX,
+                      &pindex,
+                      AG_PRMC_IS_CHALLENGE,
+                      &is_challenge,
+                      AG_PRMC_METHOD_INDEX,
+                      &mindex,
+                      -1);
+  if (! is_challenge)
+  {
+    GNUNET_break (0);
+    return;
+  }
+  AG_delete_challenge (pindex,
+                       mindex);
+}
+
+
+/**
+ * The user selected the 'delete policy' menu item.
+ *
+ * @param menuitem the selected menu
+ * @param user_data a `struct MenuContext`
+ */
+static void
+delete_policy_from_ctx_menu (GtkMenuItem *menuitem,
+                             gpointer user_data)
+{
+  struct MenuContext *ctx = user_data;
+  GtkTreePath *path = gtk_tree_row_reference_get_path (ctx->rr);
+  GtkTreeModel *tm = gtk_tree_row_reference_get_model (ctx->rr);
+  GtkTreeIter iter;
+  guint pindex;
+
+  if (NULL == path)
+    return;
+  if (! gtk_tree_model_get_iter (tm,
+                                 &iter,
+                                 path))
+  {
+    GNUNET_break (0);
+    return;
+  }
+  gtk_tree_path_free (path);
+  gtk_tree_model_get (tm,
+                      &iter,
+                      AG_PRMC_POLICY_INDEX,
+                      &pindex,
+                      -1);
+  AG_delete_policy (pindex);
+}
+
+
+/**
+ * The user selected the 'edit policy' menu.
+ *
+ * @param menuitem the selected menu
+ * @param user_data a `struct MenuContext`
+ */
+static void
+edit_from_ctx_menu (GtkMenuItem *menuitem,
+                    gpointer user_data)
+{
+  struct MenuContext *ctx = user_data;
+  GtkTreePath *path = gtk_tree_row_reference_get_path (ctx->rr);
+  GtkTreeModel *tm = gtk_tree_row_reference_get_model (ctx->rr);
+  GtkTreeIter iter;
+  guint pindex;
+
+  if (NULL == path)
+    return;
+  if (! gtk_tree_model_get_iter (tm,
+                                 &iter,
+                                 path))
+  {
+    GNUNET_break (0);
+    return;
+  }
+  gtk_tree_path_free (path);
+  gtk_tree_model_get (tm,
+                      &iter,
+                      AG_PRMC_POLICY_INDEX,
+                      &pindex,
+                      -1);
+  AG_edit_policy (pindex);
+}
+
+
 /**
  * An item was selected from the context menu; destroy the menu shell.
  *
  * @param menushell menu to destroy
- * @param user_data the 'XXX' of the menu
+ * @param user_data the 'struct MenuContext' of the menu
  */
 static void
 context_popup_selection_done (GtkMenuShell *menushell,
                               gpointer user_data)
 {
-  void *ctx = user_data;
+  struct MenuContext *ctx = user_data;
 
   gtk_widget_destroy (GTK_WIDGET (menushell));
-  gtk_tree_row_reference_free (ctx->rr);
+  if (NULL != ctx->rr)
+  {
+    gtk_tree_row_reference_free (ctx->rr);
+    ctx->rr = NULL;
+  }
   GNUNET_free (ctx);
 }
 
@@ -62,48 +213,87 @@ get_popup (GtkTreeModel *tm,
            GtkTreeIter *iter)
 {
   GtkMenu *menu;
-  GtkWidget *child;
-  GtkTreePath *path;
-  void *ctx = NULL;
+  struct MenuContext *ctx;
 
-  path = gtk_tree_model_get_path (tm,
-                                  iter);
-  ctx->rr = gtk_tree_row_reference_new (tm,
-                                        path);
-  gtk_tree_path_free (path);
-  gtk_tree_model_get (tm,
-                      iter,
-                      FIXME,
-                      &FIXME,
-                      -1);
+  ctx = GNUNET_new (struct MenuContext);
   menu = GTK_MENU (gtk_menu_new ());
+  if (NULL != iter)
   {
-    /* only display download menus if there is a URI */
-    child = gtk_menu_item_new_with_label (_ ("_Delete"));
-    g_signal_connect (child,
-                      "activate",
-                      G_CALLBACK (delete_ctx_menu),
-                      ctx);
-    gtk_label_set_use_underline (GTK_LABEL (
-                                            gtk_bin_get_child (GTK_BIN 
(child))),
-                                 TRUE);
-    gtk_widget_show (child);
-    gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
-  }
+    gboolean is_challenge;
 
-  {
-  /* Insert a separator */
-  child = gtk_separator_menu_item_new ();
-  gtk_widget_show (child);
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
+    {
+      GtkTreePath *path;
+
+      path = gtk_tree_model_get_path (tm,
+                                      iter);
+      ctx->rr = gtk_tree_row_reference_new (tm,
+                                            path);
+      gtk_tree_path_free (path);
+    }
+    gtk_tree_model_get (tm,
+                        iter,
+                        AG_PRMC_IS_CHALLENGE,
+                        &is_challenge,
+                        -1);
+    if (! is_challenge)
+    {
+      GtkWidget *child;
+
+      /* only show 'edit' entry for lines that
+         are for an entire policy */
+      child = gtk_menu_item_new_with_label (_ ("_Edit policy..."));
+      g_signal_connect (child,
+                        "activate",
+                        G_CALLBACK (&edit_from_ctx_menu),
+                        ctx);
+      gtk_label_set_use_underline (GTK_LABEL (
+                                     gtk_bin_get_child (GTK_BIN (child))),
+                                   TRUE);
+      gtk_widget_show (child);
+      gtk_menu_shell_append (GTK_MENU_SHELL (menu),
+                             child);
+    }
+    {
+      GtkWidget *child;
+      const char *label;
+
+      if (is_challenge)
+        label = _ ("Delete challenge");
+      else
+        label = _ ("Delete policy");
+      child = gtk_menu_item_new_with_label (label);
+      g_signal_connect (child,
+                        "activate",
+                        G_CALLBACK (is_challenge
+                                    ? &delete_challenge_from_ctx_menu
+                                    : &delete_policy_from_ctx_menu),
+                        ctx);
+      gtk_label_set_use_underline (GTK_LABEL (
+                                     gtk_bin_get_child (GTK_BIN (child))),
+                                   TRUE);
+      gtk_widget_show (child);
+      gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
+    }
+
+    {
+      GtkWidget *child;
+
+      /* Insert a separator */
+      child = gtk_separator_menu_item_new ();
+      gtk_widget_show (child);
+      gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
+    }
   }
 
-  /* check for embedded URIs */
   {
-    child = gtk_menu_item_new_with_label (_ ("_Edit policy"));
+    GtkWidget *child;
+
+    /* only show 'edit' entry for lines that
+       are for an entire policy */
+    child = gtk_menu_item_new_with_label (_ ("_Add policy..."));
     g_signal_connect (child,
                       "activate",
-                      G_CALLBACK (edit_ctx_menu),
+                      G_CALLBACK (&add_from_ctx_menu),
                       ctx);
     gtk_label_set_use_underline (GTK_LABEL (
                                    gtk_bin_get_child (GTK_BIN (child))),
@@ -112,10 +302,11 @@ get_popup (GtkTreeModel *tm,
     gtk_menu_shell_append (GTK_MENU_SHELL (menu),
                            child);
   }
+
   g_signal_connect (menu,
                     "selection-done",
-                    G_CALLBACK (context_popup_selection_done),
-                    spc);
+                    G_CALLBACK (&context_popup_selection_done),
+                    ctx);
   return menu;
 }
 
@@ -131,9 +322,9 @@ get_popup (GtkTreeModel *tm,
  *         TRUE to stop the propagation
  */
 gboolean
-anastasis_gtk_policy_treeview_button_press_event (GtkWidget *widget,
-                                                  GdkEvent *event,
-                                                  gpointer user_data)
+anastasis_gtk_review_policy_treeview_button_press_event_cb (GtkWidget *widget,
+                                                            GdkEvent *event,
+                                                            gpointer user_data)
 {
   GtkTreeView *tv = GTK_TREE_VIEW (widget);
   GdkEventButton *event_button = (GdkEventButton *) event;
@@ -152,18 +343,31 @@ anastasis_gtk_policy_treeview_button_press_event 
(GtkWidget *widget,
                                        NULL,
                                        NULL,
                                        NULL))
-    return FALSE; /* click outside of area with values, ignore */
-  tm = gtk_tree_view_get_model (tv);
-  if (! gtk_tree_model_get_iter (tm,
-                                 &iter,
-                                 path))
-    return FALSE; /* not sure how we got a path but no iter... */
-  gtk_tree_path_free (path);
+  {
+    menu = get_popup (NULL,
+                      NULL);
+  }
+  else
+  {
+    tm = gtk_tree_view_get_model (tv);
+    if (! gtk_tree_model_get_iter (tm,
+                                   &iter,
+                                   path))
+    {
+      /* not sure how we got a path but no iter... */
+      GNUNET_break (0);
+      return FALSE;
+    }
+    gtk_tree_path_free (path);
 
-  menu = get_popup (tm,
-                    &iter);
+    menu = get_popup (tm,
+                      &iter);
+  }
   if (NULL == menu)
+  {
+    GNUNET_break (0);
     return FALSE;
+  }
   gtk_menu_popup_at_pointer (menu,
                              event);
   return FALSE;
diff --git a/src/anastasis/anastasis-gtk_helper.h 
b/src/anastasis/anastasis-gtk_helper.h
index f388874..6381c60 100644
--- a/src/anastasis/anastasis-gtk_helper.h
+++ b/src/anastasis/anastasis-gtk_helper.h
@@ -283,7 +283,22 @@ enum AG_PolicyReviewModelColumns
   /**
    * A gchararray.
    */
-  AG_PRMC_EXPIRATION_TIME_STR = 4
+  AG_PRMC_EXPIRATION_TIME_STR = 4,
+
+  /**
+   * A guint.
+   */
+  AG_PRMC_POLICY_INDEX = 5,
+
+  /**
+   * A gboolean. True on lines representing challenges.
+   */
+  AG_PRMC_IS_CHALLENGE = 6,
+
+  /**
+   * A guint.
+   */
+  AG_PRMC_METHOD_INDEX = 7
 };
 
 
diff --git a/src/anastasis/anastasis-gtk_pe-add-policy.c 
b/src/anastasis/anastasis-gtk_pe-add-policy.c
new file mode 100644
index 0000000..911d0db
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_pe-add-policy.c
@@ -0,0 +1,39 @@
+/*
+     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_pe-add-policy.c
+ * @brief Handle request to interactively add new policy
+ * @author Christian Grothoff
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_action.h"
+#include "anastasis-gtk_helper.h"
+#include "anastasis-gtk_pe.h"
+#include <jansson.h>
+
+
+
+void
+AG_add_policy ()
+{
+  GNUNET_break (0);
+}
diff --git a/src/anastasis/anastasis-gtk_pe-delete-challenge.c 
b/src/anastasis/anastasis-gtk_pe-delete-challenge.c
new file mode 100644
index 0000000..3ff902e
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_pe-delete-challenge.c
@@ -0,0 +1,38 @@
+/*
+     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_pe-delete-challenge.c
+ * @brief Handle request to delete challenge
+ * @author Christian Grothoff
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_action.h"
+#include "anastasis-gtk_helper.h"
+#include <jansson.h>
+
+
+void
+AG_delete_challenge (guint pindex,
+                     guint mindex)
+{
+  GNUNET_break (0);
+}
diff --git a/src/anastasis/anastasis-gtk_pe-delete-policy.c 
b/src/anastasis/anastasis-gtk_pe-delete-policy.c
new file mode 100644
index 0000000..d16b4f1
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_pe-delete-policy.c
@@ -0,0 +1,38 @@
+/*
+     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_pe-delete-policy.c
+ * @brief Handle request to delete policy
+ * @author Christian Grothoff
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_action.h"
+#include "anastasis-gtk_helper.h"
+#include "anastasis-gtk_pe.h"
+#include <jansson.h>
+
+
+void
+AG_delete_policy (guint pindex)
+{
+  GNUNET_break (0);
+}
diff --git a/src/anastasis/anastasis-gtk_pe-edit-policy.c 
b/src/anastasis/anastasis-gtk_pe-edit-policy.c
new file mode 100644
index 0000000..0600dce
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_pe-edit-policy.c
@@ -0,0 +1,38 @@
+/*
+     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_pe-edit-policy.c
+ * @brief Handle request to interactively edit policy
+ * @author Christian Grothoff
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_action.h"
+#include "anastasis-gtk_helper.h"
+#include "anastasis-gtk_pe.h"
+#include <jansson.h>
+
+
+void
+AG_edit_policy (guint pindex)
+{
+  GNUNET_break (0);
+}
diff --git a/src/anastasis/anastasis-gtk_pe.h b/src/anastasis/anastasis-gtk_pe.h
new file mode 100644
index 0000000..ae9292f
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_pe.h
@@ -0,0 +1,66 @@
+/*
+     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_pe.h
+ * @brief Subsystem to handle policy editing
+ * @author Christian Grothoff
+ */
+#ifndef ANASTASIS_GTK_PE_H
+#define ANASTASIS_GTK_PE_H
+
+/**
+ * Delete a challenge at @a mindex in the policy
+ * at @a pindex.
+ *
+ * @param pindex policy to edit
+ * @param mindex challenge index to remove
+ */
+void
+AG_delete_challenge (guint pindex,
+                     guint mindex);
+
+
+/**
+ * Delete a policy at @a pindex.
+ *
+ * @param pindex index of policy to remove
+ */
+void
+AG_delete_policy (guint pindex);
+
+
+/**
+ * Edit policy at @a pindex.
+ *
+ * @param pindex index of policy to edit
+ */
+void
+AG_edit_policy (guint pindex);
+
+
+/**
+ * Add a new policy.
+ */
+void
+AG_add_policy (void);
+
+
+#endif

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