diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-12-05 21:38:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-12-05 21:38:06 +0000 |
commit | 24b87c0c3d84c3d99c6d1154938806efa90025aa (patch) | |
tree | 02d597368d014b262b1bd4c7f5ae60011d875ea0 | |
parent | 4a8c9c70a3cdcfba54c9bf94b278ea42b91f08f2 (diff) | |
download | gnunet-gtk-24b87c0c3d84c3d99c6d1154938806efa90025aa.tar.gz gnunet-gtk-24b87c0c3d84c3d99c6d1154938806efa90025aa.zip |
-visualize active probes
-rw-r--r-- | src/fs/gnunet-fs-gtk_event-handler.c | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c index d5b4a9ad..2f22ffc0 100644 --- a/src/fs/gnunet-fs-gtk_event-handler.c +++ b/src/fs/gnunet-fs-gtk_event-handler.c | |||
@@ -123,7 +123,13 @@ enum SEARCH_TAB_ModelColumns | |||
123 | /** | 123 | /** |
124 | * A GdkPixbuf. | 124 | * A GdkPixbuf. |
125 | */ | 125 | */ |
126 | SEARCH_TAB_MC_STATUS_ICON = 17 | 126 | SEARCH_TAB_MC_STATUS_ICON = 17, |
127 | |||
128 | /** | ||
129 | * A guint. | ||
130 | */ | ||
131 | SEARCH_TAB_MC_UNKNOWN_AVAILABILITY = 18 | ||
132 | |||
127 | 133 | ||
128 | }; | 134 | }; |
129 | 135 | ||
@@ -1437,6 +1443,7 @@ copy_children (GtkTreeModel * src_model, GtkTreeIter * src_iter, | |||
1437 | GdkPixbuf *preview; | 1443 | GdkPixbuf *preview; |
1438 | guint percent_progress; | 1444 | guint percent_progress; |
1439 | guint percent_availability; | 1445 | guint percent_availability; |
1446 | gint unknown_availability; | ||
1440 | gchar *filename; | 1447 | gchar *filename; |
1441 | gchar *uri_as_string; | 1448 | gchar *uri_as_string; |
1442 | gchar *status_colour; | 1449 | gchar *status_colour; |
@@ -1461,6 +1468,8 @@ copy_children (GtkTreeModel * src_model, GtkTreeIter * src_iter, | |||
1461 | SEARCH_TAB_MC_PERCENT_PROGRESS, &percent_progress, | 1468 | SEARCH_TAB_MC_PERCENT_PROGRESS, &percent_progress, |
1462 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, | 1469 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, |
1463 | &percent_availability, | 1470 | &percent_availability, |
1471 | SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, | ||
1472 | &unknown_availability, | ||
1464 | SEARCH_TAB_MC_FILENAME, &filename, | 1473 | SEARCH_TAB_MC_FILENAME, &filename, |
1465 | SEARCH_TAB_MC_URI_AS_STRING, &uri_as_string, | 1474 | SEARCH_TAB_MC_URI_AS_STRING, &uri_as_string, |
1466 | SEARCH_TAB_MC_STATUS_COLOUR, &status_colour, | 1475 | SEARCH_TAB_MC_STATUS_COLOUR, &status_colour, |
@@ -1495,6 +1504,8 @@ copy_children (GtkTreeModel * src_model, GtkTreeIter * src_iter, | |||
1495 | percent_progress, | 1504 | percent_progress, |
1496 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, | 1505 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, |
1497 | percent_availability, | 1506 | percent_availability, |
1507 | SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, | ||
1508 | unknown_availability, | ||
1498 | SEARCH_TAB_MC_FILENAME, filename, | 1509 | SEARCH_TAB_MC_FILENAME, filename, |
1499 | SEARCH_TAB_MC_URI_AS_STRING, | 1510 | SEARCH_TAB_MC_URI_AS_STRING, |
1500 | uri_as_string, | 1511 | uri_as_string, |
@@ -1552,6 +1563,7 @@ download_lost_parent (struct DownloadEntry *de) | |||
1552 | guint64 completed; | 1563 | guint64 completed; |
1553 | guint percent_progress; | 1564 | guint percent_progress; |
1554 | guint percent_availability; | 1565 | guint percent_availability; |
1566 | gint unknown_availability; | ||
1555 | gchar *filename; | 1567 | gchar *filename; |
1556 | gchar *status_colour; | 1568 | gchar *status_colour; |
1557 | guint applicability_rank; | 1569 | guint applicability_rank; |
@@ -1576,6 +1588,7 @@ download_lost_parent (struct DownloadEntry *de) | |||
1576 | SEARCH_TAB_MC_URI, &uri, | 1588 | SEARCH_TAB_MC_URI, &uri, |
1577 | SEARCH_TAB_MC_PERCENT_PROGRESS, &percent_progress, | 1589 | SEARCH_TAB_MC_PERCENT_PROGRESS, &percent_progress, |
1578 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, &percent_availability, | 1590 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, &percent_availability, |
1591 | SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, &unknown_availability, | ||
1579 | SEARCH_TAB_MC_FILENAME, &filename, | 1592 | SEARCH_TAB_MC_FILENAME, &filename, |
1580 | SEARCH_TAB_MC_STATUS_COLOUR, &status_colour, | 1593 | SEARCH_TAB_MC_STATUS_COLOUR, &status_colour, |
1581 | SEARCH_TAB_MC_APPLICABILITY_RANK, &applicability_rank, | 1594 | SEARCH_TAB_MC_APPLICABILITY_RANK, &applicability_rank, |
@@ -1612,6 +1625,7 @@ download_lost_parent (struct DownloadEntry *de) | |||
1612 | gtk_tree_store_set (de->sr->tab->ts, &iter, | 1625 | gtk_tree_store_set (de->sr->tab->ts, &iter, |
1613 | SEARCH_TAB_MC_PERCENT_PROGRESS, percent_progress, | 1626 | SEARCH_TAB_MC_PERCENT_PROGRESS, percent_progress, |
1614 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, percent_availability, | 1627 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, percent_availability, |
1628 | SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, unknown_availability, | ||
1615 | SEARCH_TAB_MC_FILENAME, filename, | 1629 | SEARCH_TAB_MC_FILENAME, filename, |
1616 | SEARCH_TAB_MC_STATUS_COLOUR, status_colour, | 1630 | SEARCH_TAB_MC_STATUS_COLOUR, status_colour, |
1617 | SEARCH_TAB_MC_APPLICABILITY_RANK, applicability_rank, | 1631 | SEARCH_TAB_MC_APPLICABILITY_RANK, applicability_rank, |
@@ -2071,13 +2085,15 @@ get_mimetype_from_metadata (const struct GNUNET_CONTAINER_MetaData *meta) | |||
2071 | * @param availability_rank updated availability information | 2085 | * @param availability_rank updated availability information |
2072 | * @param availability_certainty updated availability certainty | 2086 | * @param availability_certainty updated availability certainty |
2073 | * @param applicability_rank updated applicability information | 2087 | * @param applicability_rank updated applicability information |
2088 | * @param probe_time how long has the search been running | ||
2074 | */ | 2089 | */ |
2075 | static void | 2090 | static void |
2076 | update_search_result (struct SearchResult *sr, | 2091 | update_search_result (struct SearchResult *sr, |
2077 | const struct GNUNET_CONTAINER_MetaData *meta, | 2092 | const struct GNUNET_CONTAINER_MetaData *meta, |
2078 | uint32_t applicability_rank, | 2093 | uint32_t applicability_rank, |
2079 | int32_t availability_rank, | 2094 | int32_t availability_rank, |
2080 | uint32_t availability_certainty) | 2095 | uint32_t availability_certainty, |
2096 | struct GNUNET_TIME_Relative probe_time) | ||
2081 | { | 2097 | { |
2082 | GtkTreeIter iter; | 2098 | GtkTreeIter iter; |
2083 | struct GNUNET_CONTAINER_MetaData *ometa; | 2099 | struct GNUNET_CONTAINER_MetaData *ometa; |
@@ -2119,11 +2135,15 @@ update_search_result (struct SearchResult *sr, | |||
2119 | percent_avail = 50 + (gint) (availability_rank * 50.0 / availability_certainty); | 2135 | percent_avail = 50 + (gint) (availability_rank * 50.0 / availability_certainty); |
2120 | else | 2136 | else |
2121 | percent_avail = 50; | 2137 | percent_avail = 50; |
2138 | fprintf (stderr, "avail-rank: %d, avail-cert: %d => %d\n", (int) availability_rank, | ||
2139 | (unsigned int) availability_certainty, | ||
2140 | (int) percent_avail); | ||
2122 | gtk_tree_store_set (ts, &iter, | 2141 | gtk_tree_store_set (ts, &iter, |
2123 | SEARCH_TAB_MC_METADATA, | 2142 | SEARCH_TAB_MC_METADATA, |
2124 | GNUNET_CONTAINER_meta_data_duplicate (meta), | 2143 | GNUNET_CONTAINER_meta_data_duplicate (meta), |
2125 | SEARCH_TAB_MC_PREVIEW, pixbuf, | 2144 | SEARCH_TAB_MC_PREVIEW, pixbuf, |
2126 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint) percent_avail, | 2145 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint) percent_avail, |
2146 | SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, (0 == availability_certainty) ? (gint) (probe_time.rel_value / GNUNET_FS_PROBE_UPDATE_FREQUENCY.rel_value) : -1, | ||
2127 | SEARCH_TAB_MC_FILENAME, desc, | 2147 | SEARCH_TAB_MC_FILENAME, desc, |
2128 | SEARCH_TAB_MC_MIMETYPE, mime, | 2148 | SEARCH_TAB_MC_MIMETYPE, mime, |
2129 | SEARCH_TAB_MC_APPLICABILITY_RANK, | 2149 | SEARCH_TAB_MC_APPLICABILITY_RANK, |
@@ -2258,7 +2278,9 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab, | |||
2258 | SEARCH_TAB_MC_PREVIEW, pixbuf, | 2278 | SEARCH_TAB_MC_PREVIEW, pixbuf, |
2259 | SEARCH_TAB_MC_PERCENT_PROGRESS, 0, | 2279 | SEARCH_TAB_MC_PERCENT_PROGRESS, 0, |
2260 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, | 2280 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, |
2261 | (fsize == 0) ? 100 : 0, | 2281 | (fsize == 0) ? 100 : 50, |
2282 | SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, | ||
2283 | (fsize == 0) ? -1 : 0, | ||
2262 | SEARCH_TAB_MC_FILENAME, desc, | 2284 | SEARCH_TAB_MC_FILENAME, desc, |
2263 | SEARCH_TAB_MC_URI_AS_STRING, uris, | 2285 | SEARCH_TAB_MC_URI_AS_STRING, uris, |
2264 | SEARCH_TAB_MC_STATUS_COLOUR, status_colour, | 2286 | SEARCH_TAB_MC_STATUS_COLOUR, status_colour, |
@@ -2723,8 +2745,6 @@ mark_download_progress (struct DownloadEntry *de, | |||
2723 | gtk_tree_store_set (de->sr->tab->ts, &iter, | 2745 | gtk_tree_store_set (de->sr->tab->ts, &iter, |
2724 | SEARCH_TAB_MC_PERCENT_PROGRESS, | 2746 | SEARCH_TAB_MC_PERCENT_PROGRESS, |
2725 | (guint) ((size > 0) ? (100 * completed / size) : 100), | 2747 | (guint) ((size > 0) ? (100 * completed / size) : 100), |
2726 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, | ||
2727 | (guint) ((size > 0) ? (100 * completed / size) : 100), | ||
2728 | SEARCH_TAB_MC_COMPLETED, completed, | 2748 | SEARCH_TAB_MC_COMPLETED, completed, |
2729 | -1); | 2749 | -1); |
2730 | if (completed < size) | 2750 | if (completed < size) |
@@ -2833,6 +2853,7 @@ mark_download_completed (struct DownloadEntry *de, uint64_t size) | |||
2833 | gtk_tree_store_set (de->sr->tab->ts, &iter, | 2853 | gtk_tree_store_set (de->sr->tab->ts, &iter, |
2834 | SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) 100, | 2854 | SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) 100, |
2835 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint) 100, | 2855 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint) 100, |
2856 | SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, -1, | ||
2836 | SEARCH_TAB_MC_STATUS_ICON, | 2857 | SEARCH_TAB_MC_STATUS_ICON, |
2837 | GNUNET_GTK_animation_context_get_pixbuf (animation_downloaded), | 2858 | GNUNET_GTK_animation_context_get_pixbuf (animation_downloaded), |
2838 | -1); | 2859 | -1); |
@@ -3704,7 +3725,8 @@ GNUNET_GTK_fs_event_handler (void *cls, | |||
3704 | info->value.search.specifics.resume_result. | 3725 | info->value.search.specifics.resume_result. |
3705 | availability_rank, | 3726 | availability_rank, |
3706 | info->value.search.specifics.resume_result. | 3727 | info->value.search.specifics.resume_result. |
3707 | availability_certainty); | 3728 | availability_certainty, |
3729 | GNUNET_TIME_UNIT_ZERO); | ||
3708 | return ret; | 3730 | return ret; |
3709 | case GNUNET_FS_STATUS_SEARCH_SUSPEND: | 3731 | case GNUNET_FS_STATUS_SEARCH_SUSPEND: |
3710 | close_search_tab (info->value.search.cctx); | 3732 | close_search_tab (info->value.search.cctx); |
@@ -3728,7 +3750,9 @@ GNUNET_GTK_fs_event_handler (void *cls, | |||
3728 | info->value.search.specifics.update. | 3750 | info->value.search.specifics.update. |
3729 | availability_rank, | 3751 | availability_rank, |
3730 | info->value.search.specifics.update. | 3752 | info->value.search.specifics.update. |
3731 | availability_certainty); | 3753 | availability_certainty, |
3754 | info->value.search.specifics.update. | ||
3755 | current_probe_time); | ||
3732 | return info->value.search.specifics.update.cctx; | 3756 | return info->value.search.specifics.update.cctx; |
3733 | case GNUNET_FS_STATUS_SEARCH_ERROR: | 3757 | case GNUNET_FS_STATUS_SEARCH_ERROR: |
3734 | handle_search_error (info->value.search.cctx, | 3758 | handle_search_error (info->value.search.cctx, |