aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs-gtk_common.c')
-rw-r--r--src/fs/gnunet-fs-gtk_common.c65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/fs/gnunet-fs-gtk_common.c b/src/fs/gnunet-fs-gtk_common.c
index b7d0c6d1..1d4262e9 100644
--- a/src/fs/gnunet-fs-gtk_common.c
+++ b/src/fs/gnunet-fs-gtk_common.c
@@ -433,71 +433,6 @@ GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri,
433} 433}
434 434
435 435
436/* Largest rating value among all namespaces. INT_MIN means "undefined" */
437static int largest_namespace_rating = INT_MIN;
438
439
440/**
441 * Helper function for finding the largest namespace rating.
442 *
443 * @param cls closure
444 * @param pseudonym pseudonym hash
445 * @param md metadata container
446 * @param rating rating
447 * @return GNUNET_OK to keep iterating
448 */
449static int
450find_largest_namespace_rating_iterator (void *cls,
451 const struct GNUNET_CRYPTO_EccPublicKey *pseudonym,
452 const char *name,
453 const char *unique_name,
454 const struct GNUNET_CONTAINER_MetaData *md,
455 int32_t rating)
456{
457 int *largest = cls;
458
459 if (*largest < rating)
460 *largest = rating;
461 return GNUNET_OK;
462}
463
464
465/**
466 * Finds largest namespace rating.
467 * Used to calculate a rating for newly discovered namespaces.
468 * Returns from cache, if possible.
469 *
470 * @return largest namespace rating. Might be negative and even. INT_MIN means
471 * that no namespaces are known.
472 */
473int
474GNUNET_GTK_find_largest_namespace_rating ()
475{
476 if (largest_namespace_rating != INT_MIN)
477 return largest_namespace_rating;
478 (void) GNUNET_FS_pseudonym_list_all (GNUNET_FS_GTK_get_configuration (),
479 &find_largest_namespace_rating_iterator,
480 &largest_namespace_rating);
481 return largest_namespace_rating;
482}
483
484
485/**
486 * Sets largest namespace rating.
487 * Used to change cached largest namespace rating, when namespace list
488 * was changed in a way that is easy to track.
489 * If namespace list was changed in a way that makes it difficult to
490 * decide upon the new value, set new value to INT_MIN.
491 *
492 * @param new_value new value for the rating.
493 */
494void
495GNUNET_GTK_set_largest_namespace_rating (int new_value)
496{
497 largest_namespace_rating = new_value;
498}
499
500
501/** 436/**
502 * Converts a GtkTreeRowReference to a GtkTreeIter. 437 * Converts a GtkTreeRowReference to a GtkTreeIter.
503 * 438 *