diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-07-11 11:18:59 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-07-11 11:18:59 +0000 |
commit | 07d90cc0d0fc9b23bc2015ae6ed63334d9650717 (patch) | |
tree | b328ede93bcc0823d927466e2882107e5d41b6ce | |
parent | e7dfcfe11b625ec091c70fba37629fd784227b7f (diff) | |
download | gnunet-gtk-07d90cc0d0fc9b23bc2015ae6ed63334d9650717.tar.gz gnunet-gtk-07d90cc0d0fc9b23bc2015ae6ed63334d9650717.zip |
-handle user adding same name twice
-rw-r--r-- | src/setup/gnunet-setup-gns.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/setup/gnunet-setup-gns.c b/src/setup/gnunet-setup-gns.c index f2b673e1..13a089c7 100644 --- a/src/setup/gnunet-setup-gns.c +++ b/src/setup/gnunet-setup-gns.c | |||
@@ -1282,6 +1282,8 @@ GNUNET_setup_gns_name_cellrenderertext_edited_cb (GtkCellRendererText *renderer, | |||
1282 | GtkTreeIter it; | 1282 | GtkTreeIter it; |
1283 | gboolean not_dummy; | 1283 | gboolean not_dummy; |
1284 | char *name; | 1284 | char *name; |
1285 | struct RecordInfo *ri; | ||
1286 | struct GNUNET_HashCode name_hash; | ||
1285 | 1287 | ||
1286 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1288 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1287 | "New text for `%s' is `%s'\n", | 1289 | "New text for `%s' is `%s'\n", |
@@ -1306,6 +1308,21 @@ GNUNET_setup_gns_name_cellrenderertext_edited_cb (GtkCellRendererText *renderer, | |||
1306 | GNUNET_break (! not_dummy); | 1308 | GNUNET_break (! not_dummy); |
1307 | GNUNET_break (0 == strcmp (name, _(NEW_NAME_STR))); | 1309 | GNUNET_break (0 == strcmp (name, _(NEW_NAME_STR))); |
1308 | g_free (name); | 1310 | g_free (name); |
1311 | |||
1312 | GNUNET_CRYPTO_hash (new_text, strlen (new_text), &name_hash); | ||
1313 | ri = GNUNET_CONTAINER_multihashmap_get (n2r, | ||
1314 | &name_hash); | ||
1315 | if (NULL != ri) | ||
1316 | { | ||
1317 | GtkTreeSelection *sel; | ||
1318 | GtkTreePath *sel_path; | ||
1319 | |||
1320 | sel_path = gtk_tree_row_reference_get_path (ri->rr); | ||
1321 | sel = gtk_tree_view_get_selection(tv); | ||
1322 | gtk_tree_selection_select_path (sel, sel_path); | ||
1323 | gtk_tree_path_free (sel_path); | ||
1324 | return; | ||
1325 | } | ||
1309 | 1326 | ||
1310 | /* change dummy line to new name, then add new dummy */ | 1327 | /* change dummy line to new name, then add new dummy */ |
1311 | gtk_tree_store_set (ts, &it, | 1328 | gtk_tree_store_set (ts, &it, |