[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6903 - gnunet-gtk/src/plugins/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6903 - gnunet-gtk/src/plugins/fs |
Date: |
Mon, 26 May 2008 20:22:14 -0600 (MDT) |
Author: grothoff
Date: 2008-05-26 20:22:14 -0600 (Mon, 26 May 2008)
New Revision: 6903
Modified:
gnunet-gtk/src/plugins/fs/search.c
Log:
fixing warning; towards visualizing rankings
Modified: gnunet-gtk/src/plugins/fs/search.c
===================================================================
--- gnunet-gtk/src/plugins/fs/search.c 2008-05-27 02:19:33 UTC (rev 6902)
+++ gnunet-gtk/src/plugins/fs/search.c 2008-05-27 02:22:14 UTC (rev 6903)
@@ -235,9 +235,18 @@
(GNUNET_ECRS_uri_test_equal (have, info->uri)) )
{
/* gotcha, create pixbuf and rank info! */
- rank = (applicability_rank << 30) + (availability_rank *
availability_certainty);
-#define P_HEIGHT 11
-#define P_WIDTH 10
+ if (availability_rank < 0)
+ rank = applicability_rank - (((-availability_rank) *
availability_certainty) << 16);
+ else
+ rank = applicability_rank + ((availability_rank *
availability_certainty) << 16);
+ if (rank > 1000000)
+ fprintf(stderr,
+ "RANK: %llu from %d %u %u\n", rank,
+ applicability_rank,
+ availability_rank,
+ availability_certainty);
+#define P_HEIGHT 21
+#define P_WIDTH 100
pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
TRUE, /* alpha */
8, /* bits per sample */
@@ -255,31 +264,26 @@
#define PX_GREEN 1
#define PX_BLUE 2
#define PX_ALPHA 3
+ pixel[PX_RED] = 0;
+ pixel[PX_GREEN] = 0;
+ pixel[PX_BLUE] = 0;
+ pixel[PX_ALPHA] = 0;
if (y < P_HEIGHT / 2)
{
/* applicability */
if (x * kwords < applicability_rank * P_WIDTH)
{
pixel[PX_RED] = 0;
- pixel[PX_GREEN] = 255;
- pixel[PX_BLUE] = 0;
- pixel[PX_ALPHA] = 0;
- }
- else
- {
- pixel[PX_RED] = 0;
pixel[PX_GREEN] = 0;
- pixel[PX_BLUE] = 0;
+ pixel[PX_BLUE] = 255;
pixel[PX_ALPHA] = 255;
}
}
- else if (y > P_HEIGHT / 2)
+ else if ( (y > P_HEIGHT / 2) &&
+ ( (y-P_HEIGHT/2) * GNUNET_FSUI_MAX_PROBES
+ < availability_certainty * P_HEIGHT / 2) )
{
/* availability */
- pixel[PX_RED] = 0;
- pixel[PX_GREEN] = 0;
- pixel[PX_BLUE] = 0;
- pixel[PX_ALPHA] = 255;
if (availability_rank < 0)
{
if ( (x * GNUNET_FSUI_MAX_PROBES >
-availability_rank * P_WIDTH/2) &&
@@ -288,18 +292,18 @@
pixel[PX_RED] = 255;
pixel[PX_GREEN] = 0;
pixel[PX_BLUE] = 0;
- pixel[PX_ALPHA] = 0;
+ pixel[PX_ALPHA] = 255;
}
}
else if (availability_rank > 0)
- {
- if ( (x - (P_WIDTH/2) * GNUNET_FSUI_MAX_PROBES <
availability_rank * P_WIDTH/2) &&
- (x >= P_WIDTH/2) )
+ {
+ if ( (x >= P_WIDTH/2) &&
+ ( (x - (P_WIDTH/2)) * GNUNET_FSUI_MAX_PROBES <
availability_rank * P_WIDTH/2) )
{
pixel[PX_RED] = 0;
pixel[PX_GREEN] = 255;
pixel[PX_BLUE] = 0;
- pixel[PX_ALPHA] = 0;
+ pixel[PX_ALPHA] = 255;
}
}
else
@@ -310,18 +314,10 @@
pixel[PX_RED] = 255;
pixel[PX_GREEN] = 255;
pixel[PX_BLUE] = 0;
- pixel[PX_ALPHA] = 0;
+ pixel[PX_ALPHA] = 255;
}
}
}
- else
- {
- /* 1px separator bar */
- pixel[PX_RED] = 0;
- pixel[PX_GREEN] = 0;
- pixel[PX_BLUE] = 0;
- pixel[PX_ALPHA] = 255;
- }
}
gtk_tree_store_set(searchContext->tree,
@@ -692,6 +688,37 @@
gtk_tree_view_column_set_sort_column_id (column, SEARCH_MIME);
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_insert_column_with_attributes (list->treeview,
+ -1,
+ _("Availability"),
+ renderer,
+ "text", SEARCH_AVAILABILITY_RANK,
+ NULL);
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_insert_column_with_attributes (list->treeview,
+ -1,
+ _("Certainty"),
+ renderer,
+ "text",
SEARCH_AVAILABILITY_CERTAINTY,
+ NULL);
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_insert_column_with_attributes (list->treeview,
+ -1,
+ _("Applicability"),
+ renderer,
+ "text",
SEARCH_APPLICABILITY_RANK,
+ NULL);
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_insert_column_with_attributes (list->treeview,
+ -1,
+ _("Sort"),
+ renderer,
+ "text", SEARCH_RANK_SORT,
+ NULL);
+
+
renderer = gtk_cell_renderer_pixbuf_new ();
col = gtk_tree_view_insert_column_with_attributes (list->treeview,
-1,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6903 - gnunet-gtk/src/plugins/fs,
gnunet <=