gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r12494 - gnunet gnunet-gtk/src


From: gnunet
Subject: [GNUnet-SVN] r12494 - gnunet gnunet-gtk/src
Date: Sat, 7 Aug 2010 23:12:46 +0200

Author: grothoff
Date: 2010-08-07 23:12:46 +0200 (Sat, 07 Aug 2010)
New Revision: 12494

Modified:
   gnunet-gtk/src/main_window_file_publish.c
   gnunet/TODO
Log:
done

Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-08-07 19:34:06 UTC (rev 12493)
+++ gnunet/TODO 2010-08-07 21:12:46 UTC (rev 12494)
@@ -19,8 +19,6 @@
   - W32 port
 * GNUNET-GTK: [CG]
   - namespaces:
-    + namespace publishing
-      / fill tree store with full implementation of 'list_updateable'
     + namespace search
       / fill namespace list in dialog, use if selected
       / NS list in search dialog should use colors to offset our own 
namespaces from the others

Modified: gnunet-gtk/src/main_window_file_publish.c
===================================================================
--- gnunet-gtk/src/main_window_file_publish.c   2010-08-07 19:34:06 UTC (rev 
12493)
+++ gnunet-gtk/src/main_window_file_publish.c   2010-08-07 21:12:46 UTC (rev 
12494)
@@ -1137,7 +1137,7 @@
   /**
    * Parent of current insertion.
    */ 
-  GtkTreeIter parent;
+  GtkTreeIter *parent;
 
   /**
    * Tree store we are modifying.
@@ -1158,6 +1158,11 @@
    * Hash codes of identifiers already added to tree store.
    */
   struct GNUNET_CONTAINER_MultiHashMap *seen;
+
+  /**
+   * Did the iterator get called?
+   */
+  int update_called;
 };
 
 
@@ -1178,15 +1183,29 @@
                      const char *next_id)
 {
   struct UpdateableContext *uc = cls;
+  struct UpdateableContext sc;
   GtkTreeIter iter;
+  GtkTreeIter titer;
   char *desc;
+  GNUNET_HashCode hc;
 
+  uc->update_called = GNUNET_YES;
+  GNUNET_CRYPTO_hash (last_id,
+                     strlen (last_id),
+                     &hc);
+  if (NULL !=
+      GNUNET_CONTAINER_multihashmap_get (uc->seen,
+                                        &hc))
+    return;
+  GNUNET_CONTAINER_multihashmap_put (uc->seen,
+                                    &hc,
+                                    "dummy",
+                                    
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);  
   desc = GNUNET_CONTAINER_meta_data_get_by_type (last_meta,
                                                 
EXTRACTOR_METATYPE_DESCRIPTION);
-  /* FIXME: do recursive tree traversal here! */
   gtk_tree_store_insert_with_values (uc->ts, 
                                     &iter,
-                                    &uc->parent,
+                                    uc->parent,
                                     G_MAXINT,
                                     0, uc->namespace_name,
                                     1, uc->ns,
@@ -1199,6 +1218,34 @@
                                     8, TRUE /* update editable (always) */,
                                     -1);  
   GNUNET_free_non_null (desc);
+  sc.parent = &iter;
+  sc.ts = uc->ts;
+  sc.namespace_name = uc->namespace_name;
+  sc.ns = uc->ns;
+  sc.seen = uc->seen;
+  sc.update_called = GNUNET_NO;
+  GNUNET_FS_namespace_list_updateable (uc->ns, 
+                                      next_id,
+                                      &add_updateable_to_ts, 
+                                      &sc);
+  if (sc.update_called == GNUNET_NO)
+    {
+      /* add leaf */
+      gtk_tree_store_insert_with_values (uc->ts, 
+                                        &titer,
+                                        &iter,
+                                        G_MAXINT,
+                                        0, uc->namespace_name,
+                                        1, uc->ns,
+                                        2, next_id,
+                                        3, NULL,
+                                        4, NULL,
+                                        5, "",
+                                        6, "",
+                                        7, FALSE /* current not editable (only 
for top-level) */,
+                                        8, TRUE /* update editable (always) */,
+                                        -1);  
+    }  
 }
 
 
@@ -1217,12 +1264,15 @@
 {
   GtkTreeStore *ts = cls;
   struct UpdateableContext uc;
+  GtkTreeIter iter;
 
+  uc.parent = &iter;
   uc.namespace_name = name;
   uc.ts = ts;
   uc.ns = GNUNET_FS_namespace_create (GNUNET_GTK_get_fs_handle (),
                                      name);
-  gtk_tree_store_insert_with_values (ts, &uc.parent,
+  uc.update_called = GNUNET_NO;
+  gtk_tree_store_insert_with_values (ts, &iter,
                                     NULL,
                                     G_MAXINT,
                                     0, name,




reply via email to

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