aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-12-03 20:03:37 +0000
committerChristian Grothoff <christian@grothoff.org>2012-12-03 20:03:37 +0000
commit4492fdf9820781ae85182e9612d3b95d6ac9f5f4 (patch)
tree3215e4101bd5a73a6bddc598ed9aeeaa7b470500
parenteadeda6055fb31b4740dbd933cff1560c7297893 (diff)
downloadgnunet-gtk-4492fdf9820781ae85182e9612d3b95d6ac9f5f4.tar.gz
gnunet-gtk-4492fdf9820781ae85182e9612d3b95d6ac9f5f4.zip
-simplify expiration editing for now
-rw-r--r--src/setup/gnunet-setup-gns-edit.c4
-rw-r--r--src/setup/gnunet-setup-gns.c37
2 files changed, 40 insertions, 1 deletions
diff --git a/src/setup/gnunet-setup-gns-edit.c b/src/setup/gnunet-setup-gns-edit.c
index cc3f14f2..a0d983df 100644
--- a/src/setup/gnunet-setup-gns-edit.c
+++ b/src/setup/gnunet-setup-gns-edit.c
@@ -260,6 +260,8 @@ edit_dialog_setup_common_elements (struct EditDialogContext *edc)
260 (double) ymd->tm_sec); 260 (double) ymd->tm_sec);
261 } 261 }
262 } 262 }
263
264 /* FIXME: set source zone! */
263} 265}
264 266
265 267
@@ -330,6 +332,8 @@ edit_dialog_putes_common_elements (struct EditDialogContext *edc)
330 /* FIXME: implement! */ 332 /* FIXME: implement! */
331 GNUNET_break (0); 333 GNUNET_break (0);
332 } 334 }
335
336 /* FIXME: extract target zone! */
333} 337}
334 338
335 339
diff --git a/src/setup/gnunet-setup-gns.c b/src/setup/gnunet-setup-gns.c
index 9b7115ad..99152a90 100644
--- a/src/setup/gnunet-setup-gns.c
+++ b/src/setup/gnunet-setup-gns.c
@@ -860,7 +860,8 @@ check_name_validity_and_commit (GtkTreeIter *it,
860 GNS_TREESTORE_COL_VAL_AS_STR, &n_value, 860 GNS_TREESTORE_COL_VAL_AS_STR, &n_value,
861 -1); 861 -1);
862 if ( (NULL == n_name) || 862 if ( (NULL == n_name) ||
863 (GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (n_name)) || 863 ( (GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (n_name)) &&
864 (0 != strcmp (n_name, GNUNET_GNS_MASTERZONE_STR)) ) ||
864 (0 == n_type) || 865 (0 == n_type) ||
865 (0 == n_exp_time) || 866 (0 == n_exp_time) ||
866 (NULL == n_value) || 867 (NULL == n_value) ||
@@ -1092,6 +1093,34 @@ remove_records_by_path (const gchar *path)
1092 1093
1093 1094
1094/** 1095/**
1096 * Convert an expiration time to a string for display.
1097 *
1098 * @param is_relative is the given time relative?
1099 * @param exp_val expiration value
1100 * @return string representing the value
1101 */
1102static char *
1103exp_time_to_string (gboolean is_relative,
1104 uint64_t exp_val)
1105{
1106 if (is_relative)
1107 {
1108 struct GNUNET_TIME_Relative rel_time;
1109
1110 rel_time.rel_value = exp_val;
1111 return GNUNET_strdup (GNUNET_STRINGS_relative_time_to_string (rel_time, GNUNET_NO));
1112 }
1113 else
1114 {
1115 struct GNUNET_TIME_Absolute exp_abs;
1116
1117 exp_abs.abs_value = exp_val;
1118 return GNUNET_strdup (GNUNET_STRINGS_absolute_time_to_string (exp_abs));
1119 }
1120}
1121
1122
1123/**
1095 * The edit dialog completed; update the namestore and the 1124 * The edit dialog completed; update the namestore and the
1096 * view based on the new values in 'edc'. 1125 * view based on the new values in 'edc'.
1097 * 1126 *
@@ -1103,6 +1132,7 @@ edit_dialog_continuation (struct EditDialogContext *edc,
1103 GtkResponseType ret) 1132 GtkResponseType ret)
1104{ 1133{
1105 char *path; 1134 char *path;
1135 char *estr;
1106 1136
1107 /* FIXME: logic to move records between zones is missing here! 1137 /* FIXME: logic to move records between zones is missing here!
1108 (#2473) */ 1138 (#2473) */
@@ -1140,15 +1170,19 @@ edit_dialog_continuation (struct EditDialogContext *edc,
1140 break; 1170 break;
1141 case GTK_RESPONSE_OK: 1171 case GTK_RESPONSE_OK:
1142 /* update model */ 1172 /* update model */
1173 estr = exp_time_to_string (edc->n_is_relative,
1174 edc->n_exp_time);
1143 gtk_tree_store_set (ts, &edc->it, 1175 gtk_tree_store_set (ts, &edc->it,
1144 GNS_TREESTORE_COL_NAME, edc->n_name, 1176 GNS_TREESTORE_COL_NAME, edc->n_name,
1145 GNS_TREESTORE_COL_IS_PUBLIC, edc->n_public, 1177 GNS_TREESTORE_COL_IS_PUBLIC, edc->n_public,
1146 GNS_TREESTORE_COL_EXP_TIME, edc->n_exp_time, 1178 GNS_TREESTORE_COL_EXP_TIME, edc->n_exp_time,
1147 GNS_TREESTORE_COL_EXP_TIME_IS_REL, edc->n_is_relative, 1179 GNS_TREESTORE_COL_EXP_TIME_IS_REL, edc->n_is_relative,
1180 GNS_TREESTORE_COL_EXP_TIME_AS_STR, estr,
1148 GNS_TREESTORE_COL_IS_SHADOW, edc->n_is_shadow, 1181 GNS_TREESTORE_COL_IS_SHADOW, edc->n_is_shadow,
1149 GNS_TREESTORE_COL_VAL_AS_STR, edc->n_value, 1182 GNS_TREESTORE_COL_VAL_AS_STR, edc->n_value,
1150 GNS_TREESTORE_COL_VAL_COLOR, NULL, 1183 GNS_TREESTORE_COL_VAL_COLOR, NULL,
1151 -1); 1184 -1);
1185 GNUNET_free (estr);
1152 if (GNUNET_YES == edc->old_record_in_namestore) 1186 if (GNUNET_YES == edc->old_record_in_namestore)
1153 { 1187 {
1154 /* replace record in database with that from model */ 1188 /* replace record in database with that from model */
@@ -1977,6 +2011,7 @@ zone_iteration_proc (void *cls,
1977 public = ((rd[c].flags & GNUNET_NAMESTORE_RF_PRIVATE) != GNUNET_NAMESTORE_RF_PRIVATE); 2011 public = ((rd[c].flags & GNUNET_NAMESTORE_RF_PRIVATE) != GNUNET_NAMESTORE_RF_PRIVATE);
1978 /* Expiration time */ 2012 /* Expiration time */
1979 time_is_relative = (0 != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); 2013 time_is_relative = (0 != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION));
2014
1980 if (time_is_relative) 2015 if (time_is_relative)
1981 { 2016 {
1982 struct GNUNET_TIME_Relative rel_time; 2017 struct GNUNET_TIME_Relative rel_time;