[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis-gtk] branch master updated: implement handle expiration
From: |
gnunet |
Subject: |
[taler-anastasis-gtk] branch master updated: implement handle expiration change |
Date: |
Sun, 11 Jul 2021 22:21:20 +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 39a902a implement handle expiration change
39a902a is described below
commit 39a902afb212441db7e528d83078322bcd8ed6db
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jul 11 22:21:18 2021 +0200
implement handle expiration change
---
.../anastasis-gtk_handle-core-secret-changed.c | 2 ++
.../anastasis-gtk_handle-expiration-change.c | 36 ++++++++++++++++++++--
.../anastasis-gtk_handle-secret-buttons.c | 6 +++-
3 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/src/anastasis/anastasis-gtk_handle-core-secret-changed.c
b/src/anastasis/anastasis-gtk_handle-core-secret-changed.c
index a082b3d..5634c9f 100644
--- a/src/anastasis/anastasis-gtk_handle-core-secret-changed.c
+++ b/src/anastasis/anastasis-gtk_handle-core-secret-changed.c
@@ -47,6 +47,8 @@ anastasis_gtk_enter_secret_entry_changed_cb (GtkEditable
*entry,
struct GNUNET_TIME_Absolute expiration;
expiration = AG_get_desired_expiration ();
+ if (0 == expiration.abs_value_us)
+ return; /* failured */
arguments = json_pack ("{s:s?,s:{s:s,s:s?},s:o}",
"name",
name,
diff --git a/src/anastasis/anastasis-gtk_handle-expiration-change.c
b/src/anastasis/anastasis-gtk_handle-expiration-change.c
index 2e81779..ebbe167 100644
--- a/src/anastasis/anastasis-gtk_handle-expiration-change.c
+++ b/src/anastasis/anastasis-gtk_handle-expiration-change.c
@@ -35,12 +35,42 @@ AG_get_desired_expiration ()
GtkSpinButton *spin_button;
gint value;
struct GNUNET_TIME_Absolute res;
+ struct GNUNET_TIME_Absolute exp_time;
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_absolute_time ("expiration",
+ &exp_time),
+ GNUNET_JSON_spec_end ()
+ };
+ struct tm tv;
+
+ if (GNUNET_OK !=
+ GNUNET_JSON_parse (AG_redux_state,
+ spec,
+ NULL, NULL))
+ {
+ GNUNET_break (0);
+ AG_error ("State did not parse correctly: lacks expiration");
+ return GNUNET_TIME_UNIT_ZERO_ABS;
+ }
+
+ {
+ time_t t;
+
+ t = exp_time.abs_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us;
+ GNUNET_assert (NULL !=
+ localtime_r (&t,
+ &tv));
+ }
spin_button = GTK_SPIN_BUTTON (GCG_get_main_window_object (
"expiration_year_spin_button"));
value = gtk_spin_button_get_value_as_int (spin_button);
- res.abs_value_us = 42;
- GNUNET_break (0); // FIXME: implement!
+ tv.tm_year = value - 1900;
+ {
+ time_t t = mktime (&tv);
+
+ res.abs_value_us = t * GNUNET_TIME_UNIT_SECONDS.rel_value_us;
+ }
return res;
}
@@ -61,6 +91,8 @@ expiration_year_spin_button_value_changed_cb (
struct GNUNET_TIME_Absolute expiration;
expiration = AG_get_desired_expiration ();
+ if (0 == expiration.abs_value_us)
+ return; /* failured */
arg = json_pack ("s:o",
"expiration",
GNUNET_JSON_from_time_abs (expiration));
diff --git a/src/anastasis/anastasis-gtk_handle-secret-buttons.c
b/src/anastasis/anastasis-gtk_handle-secret-buttons.c
index a181c07..fdc356c 100644
--- a/src/anastasis/anastasis-gtk_handle-secret-buttons.c
+++ b/src/anastasis/anastasis-gtk_handle-secret-buttons.c
@@ -57,7 +57,6 @@ open_secret_dialog_response_cb (GtkDialog *dialog,
const char *mime;
GtkEntry *entry;
const char *name;
- struct GNUNET_TIME_Absolute expiration;
if (GTK_RESPONSE_OK != response_id)
{
@@ -135,6 +134,11 @@ open_secret_dialog_response_cb (GtkDialog *dialog,
struct GNUNET_TIME_Absolute expiration;
expiration = AG_get_desired_expiration ();
+ if (0 == expiration.abs_value_us)
+ {
+ GNUNET_free (data);
+ return; /* failured */
+ }
arguments = json_pack ("{s:s?,s:{s:o,s:s?},s:o}",
"name",
name,
--
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: implement handle expiration change,
gnunet <=