diff options
Diffstat (limited to 'src/setup/gnunet-setup-gns.c')
-rw-r--r-- | src/setup/gnunet-setup-gns.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/setup/gnunet-setup-gns.c b/src/setup/gnunet-setup-gns.c index ebd87389..e25f6609 100644 --- a/src/setup/gnunet-setup-gns.c +++ b/src/setup/gnunet-setup-gns.c | |||
@@ -1074,6 +1074,7 @@ remove_records_by_path (const gchar *path) | |||
1074 | (void**)&rd.data, &rd.data_size); | 1074 | (void**)&rd.data, &rd.data_size); |
1075 | 1075 | ||
1076 | rc = GNUNET_malloc (sizeof (struct RemoveContext)); | 1076 | rc = GNUNET_malloc (sizeof (struct RemoveContext)); |
1077 | GNUNET_CONTAINER_DLL_insert (rc_head, rc_tail, rc); | ||
1077 | rc->path = strdup (path); | 1078 | rc->path = strdup (path); |
1078 | rc->qe = GNUNET_NAMESTORE_record_remove (namestore, pkey, name, &rd, | 1079 | rc->qe = GNUNET_NAMESTORE_record_remove (namestore, pkey, name, &rd, |
1079 | &update_treemodel_after_remove, rc); | 1080 | &update_treemodel_after_remove, rc); |
@@ -1085,6 +1086,7 @@ remove_records_by_path (const gchar *path) | |||
1085 | { | 1086 | { |
1086 | /* Removing the whole name record */ | 1087 | /* Removing the whole name record */ |
1087 | rc = GNUNET_malloc(sizeof (struct RemoveContext)); | 1088 | rc = GNUNET_malloc(sizeof (struct RemoveContext)); |
1089 | GNUNET_CONTAINER_DLL_insert (rc_head, rc_tail, rc); | ||
1088 | rc->path = strdup (path); | 1090 | rc->path = strdup (path); |
1089 | rc->qe = GNUNET_NAMESTORE_record_remove (namestore, pkey, name, NULL, | 1091 | rc->qe = GNUNET_NAMESTORE_record_remove (namestore, pkey, name, NULL, |
1090 | &update_treemodel_after_remove, rc); | 1092 | &update_treemodel_after_remove, rc); |
@@ -1256,6 +1258,8 @@ GNUNET_setup_gns_type_cellrenderercombo_edited_cb (GtkCellRendererCombo *combo, | |||
1256 | guint type; | 1258 | guint type; |
1257 | char *name_str; | 1259 | char *name_str; |
1258 | 1260 | ||
1261 | if (0 == strcmp (new_text, _(NEW_RECORD_STR))) | ||
1262 | return; /* no record type was selected */ | ||
1259 | type = GNUNET_NAMESTORE_typename_to_number (new_text); | 1263 | type = GNUNET_NAMESTORE_typename_to_number (new_text); |
1260 | if (UINT32_MAX == type) | 1264 | if (UINT32_MAX == type) |
1261 | { | 1265 | { |
@@ -1395,8 +1399,9 @@ GNUNET_setup_gns_name_cellrenderertext_edited_cb (GtkCellRendererText *renderer, | |||
1395 | path, new_text); | 1399 | path, new_text); |
1396 | if ((0 == strcmp (new_text, NEW_NAME_STR)) || (0 == strcmp (new_text, ""))) | 1400 | if ((0 == strcmp (new_text, NEW_NAME_STR)) || (0 == strcmp (new_text, ""))) |
1397 | return; | 1401 | return; |
1398 | if (GNUNET_OK != | 1402 | if ( (GNUNET_OK != |
1399 | GNUNET_DNSPARSER_check_label (new_text)) | 1403 | GNUNET_DNSPARSER_check_label (new_text)) && |
1404 | (0 != strcmp (new_text, ROOT_STR)) ) | ||
1400 | { | 1405 | { |
1401 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1406 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1402 | _("Name `%s' invalid for GADS/DNS (too long for a DNS label?)\n"), | 1407 | _("Name `%s' invalid for GADS/DNS (too long for a DNS label?)\n"), |
@@ -1473,6 +1478,7 @@ create_popup_menu () | |||
1473 | GtkTreeIter it; | 1478 | GtkTreeIter it; |
1474 | GtkMenu *popup; | 1479 | GtkMenu *popup; |
1475 | GtkTreeSelection *sel; | 1480 | GtkTreeSelection *sel; |
1481 | gboolean name_vis; | ||
1476 | 1482 | ||
1477 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1483 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1478 | "Considering creating popup menu...\n"); | 1484 | "Considering creating popup menu...\n"); |
@@ -1483,7 +1489,16 @@ create_popup_menu () | |||
1483 | "No row selected\n"); | 1489 | "No row selected\n"); |
1484 | return FALSE; | 1490 | return FALSE; |
1485 | } | 1491 | } |
1486 | popup = GTK_MENU (GNUNET_SETUP_get_object ("GNUNET_setup_gns_delete_popup_menu")); | 1492 | gtk_tree_model_get (tm, &it, |
1493 | GNS_TREESTORE_COL_NAME_IS_VISIBLE, &name_vis, | ||
1494 | -1); | ||
1495 | if (name_vis) | ||
1496 | { | ||
1497 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1498 | "Selected row is not a record row\n"); | ||
1499 | return FALSE; | ||
1500 | } | ||
1501 | popup = GTK_MENU (GNUNET_SETUP_get_object ("GNUNET_setup_gns_edit_popup_menu")); | ||
1487 | gtk_widget_show_all (GTK_WIDGET (popup)); | 1502 | gtk_widget_show_all (GTK_WIDGET (popup)); |
1488 | gtk_menu_popup (popup, NULL, NULL, NULL, NULL, 0, 0); | 1503 | gtk_menu_popup (popup, NULL, NULL, NULL, NULL, 0, 0); |
1489 | return TRUE; | 1504 | return TRUE; |
@@ -1928,9 +1943,13 @@ zone_iteration_proc (void *cls, | |||
1928 | gtk_widget_show (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_zone_selection_hbuttonbox"))); | 1943 | gtk_widget_show (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_zone_selection_hbuttonbox"))); |
1929 | return; | 1944 | return; |
1930 | } | 1945 | } |
1931 | if (GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (name)) | 1946 | if ( (GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (name)) && |
1947 | (0 != strcmp (name, ROOT_STR)) ) | ||
1932 | { | 1948 | { |
1933 | GNUNET_break (0); | 1949 | GNUNET_break (0); |
1950 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1951 | _("Got invalid record name `%s' from namestore\n"), | ||
1952 | name); | ||
1934 | GNUNET_NAMESTORE_zone_iterator_next (zc_ctx->it); | 1953 | GNUNET_NAMESTORE_zone_iterator_next (zc_ctx->it); |
1935 | return; | 1954 | return; |
1936 | } | 1955 | } |
@@ -1946,6 +1965,7 @@ zone_iteration_proc (void *cls, | |||
1946 | GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, _(NEW_RECORD_STR), | 1965 | GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, _(NEW_RECORD_STR), |
1947 | GNS_TREESTORE_COL_IS_RECORD_ROW, TRUE, | 1966 | GNS_TREESTORE_COL_IS_RECORD_ROW, TRUE, |
1948 | GNS_TREESTORE_COL_NOT_DUMMY_ROW, FALSE, | 1967 | GNS_TREESTORE_COL_NOT_DUMMY_ROW, FALSE, |
1968 | GNS_TREESTORE_COL_TYPE_IS_EDITABLE, TRUE, | ||
1949 | -1); | 1969 | -1); |
1950 | 1970 | ||
1951 | /* Append elements for records */ | 1971 | /* Append elements for records */ |
@@ -2069,6 +2089,7 @@ zone_key_loaded_callback (void *cls, | |||
2069 | GNS_TREESTORE_COL_RECORD_TYPE, GNUNET_DNSPARSER_TYPE_A, | 2089 | GNS_TREESTORE_COL_RECORD_TYPE, GNUNET_DNSPARSER_TYPE_A, |
2070 | GNS_TREESTORE_COL_IS_RECORD_ROW, FALSE, | 2090 | GNS_TREESTORE_COL_IS_RECORD_ROW, FALSE, |
2071 | GNS_TREESTORE_COL_NOT_DUMMY_ROW, FALSE, | 2091 | GNS_TREESTORE_COL_NOT_DUMMY_ROW, FALSE, |
2092 | GNS_TREESTORE_COL_TYPE_IS_EDITABLE, TRUE, | ||
2072 | -1); | 2093 | -1); |
2073 | /* Load zone from namestore! */ | 2094 | /* Load zone from namestore! */ |
2074 | zc_ctx->zone = zone; | 2095 | zc_ctx->zone = zone; |