gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r25208 - gnunet-gtk/src/setup


From: gnunet
Subject: [GNUnet-SVN] r25208 - gnunet-gtk/src/setup
Date: Mon, 3 Dec 2012 21:03:37 +0100

Author: grothoff
Date: 2012-12-03 21:03:37 +0100 (Mon, 03 Dec 2012)
New Revision: 25208

Modified:
   gnunet-gtk/src/setup/gnunet-setup-gns-edit.c
   gnunet-gtk/src/setup/gnunet-setup-gns.c
Log:
-simplify expiration editing for now

Modified: gnunet-gtk/src/setup/gnunet-setup-gns-edit.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-gns-edit.c        2012-12-03 19:54:53 UTC 
(rev 25207)
+++ gnunet-gtk/src/setup/gnunet-setup-gns-edit.c        2012-12-03 20:03:37 UTC 
(rev 25208)
@@ -260,6 +260,8 @@
                                 (double) ymd->tm_sec);
     }
   }
+
+  /* FIXME: set source zone! */
 }
 
 
@@ -330,6 +332,8 @@
     /* FIXME: implement! */
     GNUNET_break (0);
   }
+
+  /* FIXME: extract target zone! */
 }
 
 

Modified: gnunet-gtk/src/setup/gnunet-setup-gns.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-gns.c     2012-12-03 19:54:53 UTC (rev 
25207)
+++ gnunet-gtk/src/setup/gnunet-setup-gns.c     2012-12-03 20:03:37 UTC (rev 
25208)
@@ -860,7 +860,8 @@
                        GNS_TREESTORE_COL_VAL_AS_STR, &n_value,
                        -1);
     if ( (NULL == n_name) ||
-        (GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (n_name)) ||
+        ( (GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (n_name)) &&
+          (0 != strcmp (n_name, GNUNET_GNS_MASTERZONE_STR)) ) ||
         (0 == n_type) ||
         (0 == n_exp_time) ||
         (NULL == n_value) ||
@@ -1092,6 +1093,34 @@
 
 
 /**
+ * Convert an expiration time to a string for display.
+ *
+ * @param is_relative is the given time relative?
+ * @param exp_val expiration value
+ * @return string representing the value
+ */
+static char *
+exp_time_to_string (gboolean is_relative,
+                   uint64_t exp_val)
+{
+  if (is_relative)
+  {
+    struct GNUNET_TIME_Relative rel_time;
+    
+    rel_time.rel_value = exp_val;
+    return GNUNET_strdup (GNUNET_STRINGS_relative_time_to_string (rel_time, 
GNUNET_NO));
+  }
+  else
+  {
+    struct GNUNET_TIME_Absolute exp_abs;
+
+    exp_abs.abs_value = exp_val;
+    return GNUNET_strdup (GNUNET_STRINGS_absolute_time_to_string (exp_abs));
+  }
+}
+
+
+/**
  * The edit dialog completed; update the namestore and the 
  * view based on the new values in 'edc'.
  *
@@ -1103,6 +1132,7 @@
                          GtkResponseType ret)
 {
   char *path;
+  char *estr;
 
   /* FIXME: logic to move records between zones is missing here!
      (#2473) */
@@ -1140,15 +1170,19 @@
     break;
   case GTK_RESPONSE_OK:
     /* update model */
+    estr = exp_time_to_string (edc->n_is_relative,
+                              edc->n_exp_time);
     gtk_tree_store_set (ts, &edc->it,
                        GNS_TREESTORE_COL_NAME, edc->n_name,
                        GNS_TREESTORE_COL_IS_PUBLIC, edc->n_public,
                        GNS_TREESTORE_COL_EXP_TIME, edc->n_exp_time,
                        GNS_TREESTORE_COL_EXP_TIME_IS_REL, edc->n_is_relative,
+                       GNS_TREESTORE_COL_EXP_TIME_AS_STR, estr,
                        GNS_TREESTORE_COL_IS_SHADOW, edc->n_is_shadow,
                        GNS_TREESTORE_COL_VAL_AS_STR, edc->n_value,
                        GNS_TREESTORE_COL_VAL_COLOR, NULL,
                        -1);    
+    GNUNET_free (estr);
     if (GNUNET_YES == edc->old_record_in_namestore)
     {
       /* replace record in database with that from model */
@@ -1977,6 +2011,7 @@
     public = ((rd[c].flags & GNUNET_NAMESTORE_RF_PRIVATE) != 
GNUNET_NAMESTORE_RF_PRIVATE);
     /* Expiration time */
     time_is_relative = (0 != (rd[c].flags & 
GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION));
+    
     if (time_is_relative)
     {
       struct GNUNET_TIME_Relative rel_time;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]