[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r12492 - gnunet-gtk/src
From: |
gnunet |
Subject: |
[GNUnet-SVN] r12492 - gnunet-gtk/src |
Date: |
Sat, 7 Aug 2010 21:14:09 +0200 |
Author: grothoff
Date: 2010-08-07 21:14:08 +0200 (Sat, 07 Aug 2010)
New Revision: 12492
Modified:
gnunet-gtk/src/main_window_file_publish.c
Log:
towards proper update implementation
Modified: gnunet-gtk/src/main_window_file_publish.c
===================================================================
--- gnunet-gtk/src/main_window_file_publish.c 2010-08-07 16:55:16 UTC (rev
12491)
+++ gnunet-gtk/src/main_window_file_publish.c 2010-08-07 19:14:08 UTC (rev
12492)
@@ -1129,15 +1129,47 @@
}
+/**
+ * Closure for 'add_updateable_to_ts'.
+ */
struct UpdateableContext
{
+ /**
+ * Parent of current insertion.
+ */
GtkTreeIter parent;
+
+ /**
+ * Tree store we are modifying.
+ */
GtkTreeStore *ts;
+
+ /**
+ * Name of the namespace.
+ */
const char *namespace_name;
+
+ /**
+ * Handle to the namespace.
+ */
struct GNUNET_FS_Namespace *ns;
+
+ /**
+ * Hash codes of identifiers already added to tree store.
+ */
+ struct GNUNET_CONTAINER_MultiHashMap *seen;
};
+/**
+ * Add updateable entries to the tree view.
+ *
+ * @param cls closure
+ * @param last_id ID to add
+ * @param last_uri associated URI
+ * @param last_meta associate meta data
+ * @param next_id ID for future updates
+ */
static void
add_updateable_to_ts (void *cls,
const char *last_id,
@@ -1151,6 +1183,7 @@
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,
@@ -1169,6 +1202,14 @@
}
+/**
+ * Add all updateable entries of the current namespace to the
+ * tree store.
+ *
+ * @param cls the 'GtkTreeStore' to update
+ * @param name name of the namespace to add
+ * @param id identity of the namespace to add
+ */
static void
add_namespace_to_ts (void *cls,
const char *name,
@@ -1194,9 +1235,10 @@
7, TRUE /* current editable */,
8, TRUE /* update editable */,
-1);
- /* FIXME: maybe we want to build the real tree here?
- => FS API should be different... */
- GNUNET_FS_namespace_list_updateable (uc.ns, &add_updateable_to_ts, &uc);
+ uc.seen = GNUNET_CONTAINER_multihashmap_create (128);
+ GNUNET_FS_namespace_list_updateable (uc.ns, NULL,
+ &add_updateable_to_ts, &uc);
+ GNUNET_CONTAINER_multihashmap_destroy (uc.seen);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r12492 - gnunet-gtk/src,
gnunet <=