aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/fs/search.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/fs/search.c')
-rw-r--r--src/plugins/fs/search.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/src/plugins/fs/search.c b/src/plugins/fs/search.c
index 9628a6bb..1b33b5af 100644
--- a/src/plugins/fs/search.c
+++ b/src/plugins/fs/search.c
@@ -172,7 +172,7 @@ fs_search_result_received (SearchList * searchContext,
172 (GNUNET_YES == GNUNET_GC_get_configuration_value_yesno (cfg, 172 (GNUNET_YES == GNUNET_GC_get_configuration_value_yesno (cfg,
173 "GNUNET-GTK", 173 "GNUNET-GTK",
174 "DISABLE-OWN", 174 "DISABLE-OWN",
175 GNUNET_YES))) 175 GNUNET_NO)))
176 return; 176 return;
177 model = GTK_TREE_STORE (gtk_tree_view_get_model (searchContext->treeview)); 177 model = GTK_TREE_STORE (gtk_tree_view_get_model (searchContext->treeview));
178 /* Check that the entry does not already exist (for resume!) */ 178 /* Check that the entry does not already exist (for resume!) */
@@ -205,9 +205,39 @@ fs_search_result_received (SearchList * searchContext,
205void fs_search_update (SearchList * searchContext, 205void fs_search_update (SearchList * searchContext,
206 const GNUNET_ECRS_FileInfo * info, 206 const GNUNET_ECRS_FileInfo * info,
207 int availability_rank, 207 int availability_rank,
208 unsigned int availability_certainty,
208 unsigned int applicability_rank) 209 unsigned int applicability_rank)
209{ 210{
210 /* FIXME */ 211 GtkTreeStore *model;
212 GtkTreeIter iter;
213 struct GNUNET_ECRS_URI *have;
214
215 model = GTK_TREE_STORE (gtk_tree_view_get_model (searchContext->treeview));
216 /* find existing entry */
217 if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter))
218 {
219 do
220 {
221 have = NULL;
222 gtk_tree_model_get (GTK_TREE_MODEL (model),
223 &iter, SEARCH_URI, &have, -1);
224 if ( (have != NULL) &&
225 (GNUNET_ECRS_uri_test_equal (have, info->uri)) )
226 {
227 /* gotcha! */
228 gtk_tree_store_set(searchContext->tree,
229 &iter,
230 SEARCH_AVAILABILITY_RANK, availability_rank,
231 SEARCH_AVAILABILITY_CERTAINTY, availability_certainty,
232 SEARCH_APPLICABILITY_RANK, applicability_rank,
233 -1);
234 return; /* done! */
235 }
236 }
237 while (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
238 }
239 /* not found!? */
240 GNUNET_GE_BREAK(NULL, 0);
211} 241}
212 242
213 243
@@ -466,7 +496,8 @@ fs_search_started (struct GNUNET_FSUI_SearchList * fsui_list,
466 g_signal_connect_swapped (list->treeview, 496 g_signal_connect_swapped (list->treeview,
467 "button-press-event", 497 "button-press-event",
468 G_CALLBACK (search_click_handler), list); 498 G_CALLBACK (search_click_handler), list);
469 list->tree = gtk_tree_store_new (SEARCH_NUM, G_TYPE_STRING, /* name */ 499 list->tree = gtk_tree_store_new (SEARCH_NUM,
500 G_TYPE_STRING, /* name */
470 G_TYPE_UINT64, /* size */ 501 G_TYPE_UINT64, /* size */
471 G_TYPE_STRING, /* human-readable size */ 502 G_TYPE_STRING, /* human-readable size */
472 G_TYPE_STRING, /* mime-type */ 503 G_TYPE_STRING, /* mime-type */
@@ -478,7 +509,11 @@ fs_search_started (struct GNUNET_FSUI_SearchList * fsui_list,
478 G_TYPE_STRING, /* fg-color */ 509 G_TYPE_STRING, /* fg-color */
479 G_TYPE_POINTER, /* internal: search list */ 510 G_TYPE_POINTER, /* internal: search list */
480 G_TYPE_POINTER, /* internal: download parent list */ 511 G_TYPE_POINTER, /* internal: download parent list */
481 G_TYPE_STRING); /* status */ 512 G_TYPE_STRING, /* status */
513 G_TYPE_INT, /* availability rank */
514 G_TYPE_UINT, /* availability certainty */
515 G_TYPE_UINT /* applicability rank */
516 );
482 517
483 gtk_tree_view_set_model (list->treeview, GTK_TREE_MODEL (list->tree)); 518 gtk_tree_view_set_model (list->treeview, GTK_TREE_MODEL (list->tree));
484 gtk_tree_selection_set_mode (gtk_tree_view_get_selection (list->treeview), 519 gtk_tree_selection_set_mode (gtk_tree_view_get_selection (list->treeview),