[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis-gtk] branch master updated: towards updating progress
From: |
gnunet |
Subject: |
[taler-anastasis-gtk] branch master updated: towards updating progress |
Date: |
Sat, 03 Jul 2021 15:10:24 +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 7bd6460 towards updating progress
7bd6460 is described below
commit 7bd6460485070f8d536f242b82b27e2f2b08e744
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Sat Jul 3 15:10:22 2021 +0200
towards updating progress
---
contrib/anastasis_gtk_main_window.glade | 4 +-
src/anastasis/Makefile.am | 2 +-
src/anastasis/anastasis-gtk_progress.c | 83 ++++++++++++++++++++++
...sis-gtk_progress.c => anastasis-gtk_progress.h} | 37 +++-------
4 files changed, 94 insertions(+), 32 deletions(-)
diff --git a/contrib/anastasis_gtk_main_window.glade
b/contrib/anastasis_gtk_main_window.glade
index e4fda55..e8c3cd9 100644
--- a/contrib/anastasis_gtk_main_window.glade
+++ b/contrib/anastasis_gtk_main_window.glade
@@ -400,7 +400,7 @@ Author: Christian Grothoff, Dennis Neufeld
<property name="tooltip_column">2</property>
<signal name="button-press-event"
handler="anastasis_gtk_backup_progress_treeview_button_press_event_cb"
swapped="no"/>
<child internal-child="selection">
- <object class="GtkTreeSelection"/>
+ <object class="GtkTreeSelection"
id="anastasis_gtk_backup_progress_tree_selection"/>
</child>
<child>
<object class="GtkTreeViewColumn"
id="anastasis_gtk_backup_progress_description_column">
@@ -444,7 +444,7 @@ Author: Christian Grothoff, Dennis Neufeld
<property name="tooltip_column">2</property>
<signal name="button-press-event"
handler="anastasis_gtk_recovery_progress_treeview_button_press_event_cb"
swapped="no"/>
<child internal-child="selection">
- <object class="GtkTreeSelection"/>
+ <object class="GtkTreeSelection"
id="anastasis_gtk_recovery_progress_tree_selection"/>
</child>
<child>
<object class="GtkTreeViewColumn"
id="anastasis_gtk_recovery_progress_description_colum">
diff --git a/src/anastasis/Makefile.am b/src/anastasis/Makefile.am
index 469d904..3f71102 100644
--- a/src/anastasis/Makefile.am
+++ b/src/anastasis/Makefile.am
@@ -50,7 +50,7 @@ anastasis_gtk_SOURCES = \
anastasis-gtk_pe-delete-challenge.c \
anastasis-gtk_pe-delete-policy.c \
anastasis-gtk_pe-edit-policy.c \
- anastasis-gtk_progress.c \
+ anastasis-gtk_progress.c anastasis-gtk_progress.h \
os_installation.c
anastasis_gtk_LDADD = \
diff --git a/src/anastasis/anastasis-gtk_progress.c
b/src/anastasis/anastasis-gtk_progress.c
index 9b22a72..1dfc545 100644
--- a/src/anastasis/anastasis-gtk_progress.c
+++ b/src/anastasis/anastasis-gtk_progress.c
@@ -55,3 +55,86 @@
anastasis_gtk_recovery_progress_treeview_button_press_event_cb (GtkWidget *widge
}
+/**
+ * Function to validate an input by regular expression ("validation-regex").
+ *
+ * @param input text to validate
+ * @param regexp regular expression to validate form
+ * @return true if validation passed, else false
+ */
+static bool
+validate_regex (const char *input,
+ const char *regexp)
+{
+ regex_t regex;
+
+ if (0 != regcomp (®ex,
+ regexp,
+ REG_EXTENDED))
+ {
+ GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to compile regular expression `%s'.",
+ regexp);
+ return true;
+ }
+ /* check if input has correct form */
+ if (0 != regexec (®ex,
+ input,
+ 0,
+ NULL,
+ 0))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Input `%s' does not match regex `%s'\n",
+ input,
+ regexp);
+ regfree (®ex);
+ return false;
+ }
+ regfree (®ex);
+ return true;
+}
+
+
+void
+AG_progress_update (void)
+{
+ GtkTreeSelection *ts;
+ GtkTreeModel *tm;
+ GtkTreeIter iter;
+ const char *state;
+
+ state = json_string_value (json_object_get (state,
+ "backup_state"));
+ if (NULL == state)
+ {
+ state = json_string_value (json_object_get (state,
+ "recovery_state"));
+ ts = GTK_TREE_SELECTION (GCG_get_main_window_object
("anastasis_gtk_recovery_progress_tree_selection"));
+ }
+ else
+ {
+ ts = GTK_TREE_SELECTION (GCG_get_main_window_object
("anastasis_gtk_backup_progress_tree_selection"));
+ }
+ gtk_tree_selection_get_selected (ts,
+ &tm,
+ &iter);
+ if (! gtk_tree_model_get_iter_first (tm,
+ &iter))
+ {
+ GNUNET_break (0);
+ return;
+ }
+ do {
+ char *regex;
+
+ gtk_tree_model_get (tm,
+ &iter,
+ 1, ®ex, // FIXME: symbolic names...
+ -1);
+
+ } while (gtk_tree_model_iter_next (tm,
+ &iter));
+
+}
diff --git a/src/anastasis/anastasis-gtk_progress.c
b/src/anastasis/anastasis-gtk_progress.h
similarity index 52%
copy from src/anastasis/anastasis-gtk_progress.c
copy to src/anastasis/anastasis-gtk_progress.h
index 9b22a72..2b5a7eb 100644
--- a/src/anastasis/anastasis-gtk_progress.c
+++ b/src/anastasis/anastasis-gtk_progress.h
@@ -18,40 +18,19 @@
Boston, MA 02110-1301, USA.
*/
/**
- * @file src/anastasis/anastasis-gtk_progress.c
- * @brief Functions dealing with the tree views used to show the user where we
are in the process
+ * @file src/anastasis/anastasis-gtk_progress.h
+ * @brief Generic progress state indication updates
* @author Christian Grothoff
*/
-#include <gnunet/platform.h>
-#include <gnunet/gnunet_util_lib.h>
-#include "anastasis-gtk_helper.h"
-#include <gdk-pixbuf/gdk-pixbuf.h>
+#ifndef ANASTASIS_GTK_PROGRESS_H
+#define ANASTASIS_GTK_PROGRESS_H
/**
- * Ensure signals are ignored where the user
- * clicks in the widget.
+ * Update progress indicators.
*/
-gboolean
-anastasis_gtk_backup_progress_treeview_button_press_event_cb (GtkWidget
*widget,
- GdkEvent *event,
- gpointer user_data)
-{
- return TRUE;
-}
-
-
-
-/**
- * Ensure signals are ignored where the user
- * clicks in the widget.
- */
-gboolean
-anastasis_gtk_recovery_progress_treeview_button_press_event_cb (GtkWidget
*widget,
- GdkEvent *event,
- gpointer user_data)
-{
- return TRUE;
-}
+void
+AG_progress_update (void)
+#endif
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis-gtk] branch master updated: towards updating progress,
gnunet <=