gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r33580 - gnunet-gtk/src/namestore


From: gnunet
Subject: [GNUnet-SVN] r33580 - gnunet-gtk/src/namestore
Date: Sat, 7 Jun 2014 15:32:22 +0200

Author: grothoff
Date: 2014-06-07 15:32:22 +0200 (Sat, 07 Jun 2014)
New Revision: 33580

Modified:
   gnunet-gtk/src/namestore/gnunet-namestore-gtk.c
Log:
-do not add duplicate label upon first record creation

Modified: gnunet-gtk/src/namestore/gnunet-namestore-gtk.c
===================================================================
--- gnunet-gtk/src/namestore/gnunet-namestore-gtk.c     2014-06-07 13:04:46 UTC 
(rev 33579)
+++ gnunet-gtk/src/namestore/gnunet-namestore-gtk.c     2014-06-07 13:32:22 UTC 
(rev 33580)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     (C) 2012, 2013 Christian Grothoff (and other contributing authors)
+     (C) 2012, 2013, 2014 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -1812,6 +1812,7 @@
   char *name;
   struct RecordInfo *ri;
   struct GNUNET_HashCode name_hash;
+  GtkTreePath *tpath;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "New text for `%s' is `%s'\n",
@@ -1853,6 +1854,7 @@
   }
 
   /* change dummy line to new name, then add new dummy */
+  ri = GNUNET_new (struct RecordInfo);
   gtk_tree_store_set (ts, &it,
                      GNS_TREESTORE_COL_NAME, new_text,
                      GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
@@ -1863,6 +1865,18 @@
                      GNS_TREESTORE_COL_TYPE_IS_EDITABLE, TRUE,
                      GNS_TREESTORE_COL_NAME_IS_EDITABLE, FALSE,
                      -1);
+  tpath = gtk_tree_model_get_path (tm,
+                                  &it);
+  ri->rr = gtk_tree_row_reference_new (tm,
+                                       tpath);
+  ri->name = GNUNET_strdup (name);
+  gtk_tree_path_free (tpath);
+  GNUNET_assert (GNUNET_OK ==
+                 GNUNET_CONTAINER_multihashmap_put (n2r,
+                                                    &name_hash,
+                                                    ri,
+                                                    
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+
   /* add a new dummy line */
   gtk_tree_store_insert_with_values (ts, &it,NULL, 0,
                                     GNS_TREESTORE_COL_NAME, _(NEW_NAME_STR),
@@ -2318,17 +2332,19 @@
   else
   {
     ri = GNUNET_new (struct RecordInfo);
-    gtk_tree_store_append (ts, &iter_name, NULL);
-    gtk_tree_store_set (ts, &iter_name,
-                       GNS_TREESTORE_COL_NAME, name,
-                       GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
-                       GNS_TREESTORE_COL_RECORD_TYPE, 
GNUNET_GNSRECORD_TYPE_ANY,
-                       GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, _(NEW_RECORD_STR),
-                       GNS_TREESTORE_COL_IS_RECORD_ROW, TRUE,
-                       GNS_TREESTORE_COL_NOT_DUMMY_ROW, FALSE,
-                       GNS_TREESTORE_COL_TYPE_IS_EDITABLE, TRUE,
-                       GNS_TREESTORE_COL_RECORD_OFFSET, UINT_MAX,
-                       -1);
+    gtk_tree_store_insert_with_values (ts,
+                                       &iter_name,
+                                       NULL,
+                                       -1,
+                                       GNS_TREESTORE_COL_NAME, name,
+                                       GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
+                                       GNS_TREESTORE_COL_RECORD_TYPE, 
GNUNET_GNSRECORD_TYPE_ANY,
+                                       GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, 
_(NEW_RECORD_STR),
+                                       GNS_TREESTORE_COL_IS_RECORD_ROW, TRUE,
+                                       GNS_TREESTORE_COL_NOT_DUMMY_ROW, FALSE,
+                                       GNS_TREESTORE_COL_TYPE_IS_EDITABLE, 
TRUE,
+                                       GNS_TREESTORE_COL_RECORD_OFFSET, 
UINT_MAX,
+                                       -1);
 
     path = gtk_tree_model_get_path (tm,
                                    &iter_name);
@@ -2423,7 +2439,10 @@
       setup_qrcode ();
 #endif
     }
-    gtk_tree_store_insert_with_values (ts, &iter_record , &iter_name, 0,
+    gtk_tree_store_insert_with_values (ts,
+                                       &iter_record ,
+                                       &iter_name,
+                                       -1,
                                       GNS_TREESTORE_COL_NAME, name,
                                       GNS_TREESTORE_COL_NAME_IS_VISIBLE, FALSE,
                                       GNS_TREESTORE_COL_RECORD_TYPE, 
rd[c].record_type,
@@ -2534,7 +2553,10 @@
                        label);
   g_free (label);
   /* Append a top level row and leave it empty */
-  gtk_tree_store_insert_with_values (ts, &toplevel, NULL, 0,
+  gtk_tree_store_insert_with_values (ts,
+                                     &toplevel,
+                                     NULL,
+                                     -1,
                                      GNS_TREESTORE_COL_NAME, _(NEW_NAME_STR),
                                      GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
                                      GNS_TREESTORE_COL_RECORD_TYPE, 
GNUNET_DNSPARSER_TYPE_A,




reply via email to

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