diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-05-30 16:12:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-05-30 16:12:37 +0000 |
commit | 397b94dcff90a976449523ad957f7f38c3b8cadf (patch) | |
tree | 6f7de9fb337978b84b6686243c6436cbd0cef82a | |
parent | 6540bcceae82042ad731c4a507c3b38d8e90005b (diff) | |
download | gnunet-gtk-397b94dcff90a976449523ad957f7f38c3b8cadf.tar.gz gnunet-gtk-397b94dcff90a976449523ad957f7f38c3b8cadf.zip |
-theoretic --- untested --- fix for #2711, probes for entries in directories
-rw-r--r-- | src/fs/gnunet-fs-gtk_event-handler.c | 86 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_event-handler.h | 13 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_open-directory.c | 12 |
3 files changed, 88 insertions, 23 deletions
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c index 04a1c137..cab95366 100644 --- a/src/fs/gnunet-fs-gtk_event-handler.c +++ b/src/fs/gnunet-fs-gtk_event-handler.c | |||
@@ -670,8 +670,9 @@ GNUNET_FS_GTK_search_treeview_cursor_changed (GtkTreeView *tv, | |||
670 | 670 | ||
671 | 671 | ||
672 | /** | 672 | /** |
673 | * save_as - GNUNET_YES to open SaveAs dialog, GNUNET_NO to start downloading. | 673 | * |
674 | * download_directly - GNUNET_YES to make SaveAs dialog initiate the download, | 674 | * @param save_as - GNUNET_YES to open SaveAs dialog, GNUNET_NO to start downloading. |
675 | * @param download_directly - GNUNET_YES to make SaveAs dialog initiate the download, | ||
675 | * GNUNET_NO to only change names on the download panel. | 676 | * GNUNET_NO to only change names on the download panel. |
676 | * Ingored if save_as is GNUNET_NO. | 677 | * Ingored if save_as is GNUNET_NO. |
677 | */ | 678 | */ |
@@ -728,14 +729,14 @@ start_download2 (int save_as, int download_directly) | |||
728 | filename = gtk_entry_get_text (mctx->download_name_entry); | 729 | filename = gtk_entry_get_text (mctx->download_name_entry); |
729 | downloaddir = gtk_file_chooser_get_filename (mctx->download_location_chooser); | 730 | downloaddir = gtk_file_chooser_get_filename (mctx->download_location_chooser); |
730 | 731 | ||
731 | de = GNUNET_malloc (sizeof (struct DownloadEntry)); | 732 | de = GNUNET_new (struct DownloadEntry); |
732 | 733 | ||
733 | if (gtk_tree_model_iter_parent (model, &parent_iter, &iter)) | 734 | if (gtk_tree_model_iter_parent (model, &parent_iter, &iter)) |
734 | { | 735 | { |
735 | struct SearchResult *psr = NULL; | 736 | struct SearchResult *psr = NULL; |
736 | gtk_tree_model_get (model, &parent_iter, | 737 | gtk_tree_model_get (model, &parent_iter, |
737 | SEARCH_TAB_MC_SEARCH_RESULT, &psr, | 738 | SEARCH_TAB_MC_SEARCH_RESULT, &psr, |
738 | -1); | 739 | -1); |
739 | if (psr) | 740 | if (psr) |
740 | de->pde = psr->download; | 741 | de->pde = psr->download; |
741 | } | 742 | } |
@@ -770,6 +771,7 @@ start_download2 (int save_as, int download_directly) | |||
770 | } | 771 | } |
771 | } | 772 | } |
772 | 773 | ||
774 | |||
773 | /** | 775 | /** |
774 | * "Download" was selected in the current search context menu. | 776 | * "Download" was selected in the current search context menu. |
775 | * | 777 | * |
@@ -785,6 +787,7 @@ start_download_ctx_menu_helper (struct SearchListPopupContext *spc, | |||
785 | start_download2 (save_as, GNUNET_YES); | 787 | start_download2 (save_as, GNUNET_YES); |
786 | } | 788 | } |
787 | 789 | ||
790 | |||
788 | /** | 791 | /** |
789 | * This function is called when the user double-clicks on a search | 792 | * This function is called when the user double-clicks on a search |
790 | * result. Begins the download, if necessary by opening the "save as" | 793 | * result. Begins the download, if necessary by opening the "save as" |
@@ -812,8 +815,8 @@ GNUNET_FS_GTK_search_treeview_row_activated (GtkTreeView * tree_view, | |||
812 | * @param user_data the main window context | 815 | * @param user_data the main window context |
813 | */ | 816 | */ |
814 | void | 817 | void |
815 | GNUNET_GTK_search_frame_download_download_button_clicked_cb ( | 818 | GNUNET_GTK_search_frame_download_download_button_clicked_cb (GtkButton *button, |
816 | GtkButton *button, gpointer user_data) | 819 | gpointer user_data) |
817 | { | 820 | { |
818 | start_download2 (GNUNET_NO, GNUNET_NO); | 821 | start_download2 (GNUNET_NO, GNUNET_NO); |
819 | } | 822 | } |
@@ -847,6 +850,7 @@ start_download_ctx_menu (GtkMenuItem *item, gpointer user_data) | |||
847 | start_download_ctx_menu_helper (spc, GNUNET_NO, GNUNET_NO); | 850 | start_download_ctx_menu_helper (spc, GNUNET_NO, GNUNET_NO); |
848 | } | 851 | } |
849 | 852 | ||
853 | |||
850 | /** | 854 | /** |
851 | * "Get root element of associated namespace X" was selected in the current search | 855 | * "Get root element of associated namespace X" was selected in the current search |
852 | * context menu. | 856 | * context menu. |
@@ -1423,8 +1427,10 @@ copy_children (GtkTreeModel * src_model, GtkTreeIter * src_iter, | |||
1423 | &downloaded_anonymity, | 1427 | &downloaded_anonymity, |
1424 | SEARCH_TAB_MC_SHOW_NS_ASSOCIATION, &show_ns_association, | 1428 | SEARCH_TAB_MC_SHOW_NS_ASSOCIATION, &show_ns_association, |
1425 | -1); | 1429 | -1); |
1426 | search_result_new = GNUNET_malloc (sizeof (struct SearchResult)); | 1430 | search_result_new = GNUNET_new (struct SearchResult); |
1427 | search_result_new->tab = dst_tab; | 1431 | search_result_new->tab = dst_tab; |
1432 | search_result_new->probe = search_result_old->probe; | ||
1433 | search_result_old->probe = NULL; | ||
1428 | search_result_new->download = search_result_old->download; | 1434 | search_result_new->download = search_result_old->download; |
1429 | if (NULL != search_result_old->download) | 1435 | if (NULL != search_result_old->download) |
1430 | { | 1436 | { |
@@ -1548,7 +1554,8 @@ download_lost_parent (struct DownloadEntry *de) | |||
1548 | de->sr->download = NULL; | 1554 | de->sr->download = NULL; |
1549 | 1555 | ||
1550 | /* create the target root */ | 1556 | /* create the target root */ |
1551 | de->sr = GNUNET_GTK_add_to_uri_tab (meta, uri); | 1557 | de->sr = GNUNET_GTK_add_to_uri_tab (downloaded_anonymity, |
1558 | meta, uri); | ||
1552 | de->sr->download = de; | 1559 | de->sr->download = de; |
1553 | 1560 | ||
1554 | /* get positions of the 'new' root */ | 1561 | /* get positions of the 'new' root */ |
@@ -1637,6 +1644,7 @@ move_downloads_in_subtree (GtkTreeModel *tm, | |||
1637 | if (NULL != meta) | 1644 | if (NULL != meta) |
1638 | GNUNET_CONTAINER_meta_data_destroy (meta); | 1645 | GNUNET_CONTAINER_meta_data_destroy (meta); |
1639 | gtk_tree_row_reference_free (sr->rr); | 1646 | gtk_tree_row_reference_free (sr->rr); |
1647 | GNUNET_break (NULL == sr->probe); | ||
1640 | GNUNET_free (sr); | 1648 | GNUNET_free (sr); |
1641 | /* get ready for removal of the tree */ | 1649 | /* get ready for removal of the tree */ |
1642 | gtk_tree_store_set (GTK_TREE_STORE (tm), &child, | 1650 | gtk_tree_store_set (GTK_TREE_STORE (tm), &child, |
@@ -1694,6 +1702,8 @@ free_search_result (struct SearchResult *sr) | |||
1694 | if (meta != NULL) | 1702 | if (meta != NULL) |
1695 | GNUNET_CONTAINER_meta_data_destroy (meta); | 1703 | GNUNET_CONTAINER_meta_data_destroy (meta); |
1696 | gtk_tree_row_reference_free (sr->rr); | 1704 | gtk_tree_row_reference_free (sr->rr); |
1705 | if (NULL != sr->probe) | ||
1706 | GNUNET_FS_probe_stop (sr->probe); | ||
1697 | GNUNET_free (sr); | 1707 | GNUNET_free (sr); |
1698 | move_downloads_in_subtree (tm, &iter); | 1708 | move_downloads_in_subtree (tm, &iter); |
1699 | GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (tm), &iter); | 1709 | GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (tm), &iter); |
@@ -2141,12 +2151,14 @@ see_if_there_are_any_sks_uris (void *cls, const struct GNUNET_FS_Uri *sks_uri, | |||
2141 | return GNUNET_SYSERR; | 2151 | return GNUNET_SYSERR; |
2142 | } | 2152 | } |
2143 | 2153 | ||
2154 | |||
2144 | /** | 2155 | /** |
2145 | * Add a search result to the given search tab. This function is called | 2156 | * Add a search result to the given search tab. This function is called |
2146 | * not only for 'normal' search results but also for directories that | 2157 | * not only for 'normal' search results but also for directories that |
2147 | * are being opened and if the user manually enters a URI. | 2158 | * are being opened and if the user manually enters a URI. |
2148 | * | 2159 | * |
2149 | * @param tab search tab to extend, never NULL | 2160 | * @param tab search tab to extend, never NULL |
2161 | * @param anonymity anonymity level to use for probes for this result | ||
2150 | * @param parent_rr reference to parent entry in search tab, NULL for normal | 2162 | * @param parent_rr reference to parent entry in search tab, NULL for normal |
2151 | * search results, | 2163 | * search results, |
2152 | * @param uri uri to add, can be NULL for top-level entry of a directory opened from disk | 2164 | * @param uri uri to add, can be NULL for top-level entry of a directory opened from disk |
@@ -2161,6 +2173,7 @@ see_if_there_are_any_sks_uris (void *cls, const struct GNUNET_FS_Uri *sks_uri, | |||
2161 | */ | 2173 | */ |
2162 | struct SearchResult * | 2174 | struct SearchResult * |
2163 | GNUNET_GTK_add_search_result (struct SearchTab *tab, | 2175 | GNUNET_GTK_add_search_result (struct SearchTab *tab, |
2176 | uint32_t anonymity, | ||
2164 | GtkTreeRowReference *parent_rr, | 2177 | GtkTreeRowReference *parent_rr, |
2165 | const struct GNUNET_FS_Uri *uri, | 2178 | const struct GNUNET_FS_Uri *uri, |
2166 | const struct GNUNET_CONTAINER_MetaData *meta, | 2179 | const struct GNUNET_CONTAINER_MetaData *meta, |
@@ -2220,8 +2233,14 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab, | |||
2220 | 2233 | ||
2221 | find_embedded_sks (meta, see_if_there_are_any_sks_uris, &show_ns_association); | 2234 | find_embedded_sks (meta, see_if_there_are_any_sks_uris, &show_ns_association); |
2222 | 2235 | ||
2223 | sr = GNUNET_malloc (sizeof (struct SearchResult)); | 2236 | sr = GNUNET_new (struct SearchResult); |
2224 | sr->result = result; | 2237 | sr->result = result; |
2238 | if (NULL == result) | ||
2239 | sr->probe = GNUNET_FS_probe (GNUNET_FS_GTK_get_fs_handle (), | ||
2240 | uri, | ||
2241 | meta, | ||
2242 | sr, | ||
2243 | anonymity); | ||
2225 | sr->tab = tab; | 2244 | sr->tab = tab; |
2226 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2245 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2227 | "Allocated a search result SR=%p\n", | 2246 | "Allocated a search result SR=%p\n", |
@@ -2384,6 +2403,7 @@ GNUNET_FS_GTK_set_item_downloaded_name (GtkTreeStore *ts, GtkTreeRowReference *r | |||
2384 | * of the search tab accordingly. | 2403 | * of the search tab accordingly. |
2385 | * | 2404 | * |
2386 | * @param tab the search tab where the new result should be added | 2405 | * @param tab the search tab where the new result should be added |
2406 | * @param anonymity anonymity level to use for probes for this result | ||
2387 | * @param parent parent search result (if this is a namespace update result), or NULL | 2407 | * @param parent parent search result (if this is a namespace update result), or NULL |
2388 | * @param uri URI of the search result | 2408 | * @param uri URI of the search result |
2389 | * @param meta meta data for the result | 2409 | * @param meta meta data for the result |
@@ -2394,6 +2414,7 @@ GNUNET_FS_GTK_set_item_downloaded_name (GtkTreeStore *ts, GtkTreeRowReference *r | |||
2394 | */ | 2414 | */ |
2395 | static struct SearchResult * | 2415 | static struct SearchResult * |
2396 | process_search_result (struct SearchTab *tab, | 2416 | process_search_result (struct SearchTab *tab, |
2417 | uint32_t anonymity, | ||
2397 | struct SearchResult *parent, | 2418 | struct SearchResult *parent, |
2398 | const struct GNUNET_FS_Uri *uri, | 2419 | const struct GNUNET_FS_Uri *uri, |
2399 | const struct GNUNET_CONTAINER_MetaData *meta, | 2420 | const struct GNUNET_CONTAINER_MetaData *meta, |
@@ -2402,7 +2423,8 @@ process_search_result (struct SearchTab *tab, | |||
2402 | { | 2423 | { |
2403 | struct SearchResult *sr; | 2424 | struct SearchResult *sr; |
2404 | 2425 | ||
2405 | sr = GNUNET_GTK_add_search_result (tab, | 2426 | sr = GNUNET_GTK_add_search_result (tab, |
2427 | anonymity, | ||
2406 | (parent != NULL) ? parent->rr : NULL, | 2428 | (parent != NULL) ? parent->rr : NULL, |
2407 | uri, | 2429 | uri, |
2408 | meta, result, applicability_rank); | 2430 | meta, result, applicability_rank); |
@@ -2555,12 +2577,14 @@ setup_inner_search (struct GNUNET_FS_SearchContext *sc, | |||
2555 | * Setup a new top-level entry in the URI/orphan tab. If necessary, create | 2577 | * Setup a new top-level entry in the URI/orphan tab. If necessary, create |
2556 | * the URI tab first. | 2578 | * the URI tab first. |
2557 | * | 2579 | * |
2580 | * @param anonymity anonymity level to use for probes | ||
2558 | * @param meta metadata for the new entry | 2581 | * @param meta metadata for the new entry |
2559 | * @param uri URI for the new entry | 2582 | * @param uri URI for the new entry |
2560 | * @return the search result that was set up | 2583 | * @return the search result that was set up |
2561 | */ | 2584 | */ |
2562 | struct SearchResult * | 2585 | struct SearchResult * |
2563 | GNUNET_GTK_add_to_uri_tab (const struct GNUNET_CONTAINER_MetaData *meta, | 2586 | GNUNET_GTK_add_to_uri_tab (uint32_t anonymity, |
2587 | const struct GNUNET_CONTAINER_MetaData *meta, | ||
2564 | const struct GNUNET_FS_Uri *uri) | 2588 | const struct GNUNET_FS_Uri *uri) |
2565 | { | 2589 | { |
2566 | struct GNUNET_GTK_MainWindowContext *mctx = GNUNET_FS_GTK_get_main_context (); | 2590 | struct GNUNET_GTK_MainWindowContext *mctx = GNUNET_FS_GTK_get_main_context (); |
@@ -2579,7 +2603,9 @@ GNUNET_GTK_add_to_uri_tab (const struct GNUNET_CONTAINER_MetaData *meta, | |||
2579 | gtk_notebook_set_current_page (mctx->notebook, page); | 2603 | gtk_notebook_set_current_page (mctx->notebook, page); |
2580 | break; | 2604 | break; |
2581 | } | 2605 | } |
2582 | return GNUNET_GTK_add_search_result (uri_tab, NULL, uri, meta, NULL, 0); | 2606 | return GNUNET_GTK_add_search_result (uri_tab, |
2607 | anonymity, | ||
2608 | NULL, uri, meta, NULL, 0); | ||
2583 | } | 2609 | } |
2584 | 2610 | ||
2585 | 2611 | ||
@@ -2678,6 +2704,11 @@ struct AddDirectoryEntryContext | |||
2678 | GtkTreeRowReference *prr; | 2704 | GtkTreeRowReference *prr; |
2679 | 2705 | ||
2680 | /** | 2706 | /** |
2707 | * Anonymity level to use for probes in this directory. | ||
2708 | */ | ||
2709 | uint32_t anonymity; | ||
2710 | |||
2711 | /** | ||
2681 | * Do we need to check if the given entry already exists to | 2712 | * Do we need to check if the given entry already exists to |
2682 | * avoid adding it twice? Set to YES if 'add_directory_entry' | 2713 | * avoid adding it twice? Set to YES if 'add_directory_entry' |
2683 | * is called upon directory completion (so we might see all | 2714 | * is called upon directory completion (so we might see all |
@@ -2757,7 +2788,10 @@ add_directory_entry (void *cls, const char *filename, | |||
2757 | while (TRUE == gtk_tree_model_iter_next (tm, &iter)); | 2788 | while (TRUE == gtk_tree_model_iter_next (tm, &iter)); |
2758 | } | 2789 | } |
2759 | } | 2790 | } |
2760 | GNUNET_GTK_add_search_result (ade->tab, ade->prr, uri, meta, NULL, | 2791 | GNUNET_GTK_add_search_result (ade->tab, |
2792 | ade->anonymity, | ||
2793 | ade->prr, | ||
2794 | uri, meta, NULL, | ||
2761 | 0); | 2795 | 0); |
2762 | } | 2796 | } |
2763 | 2797 | ||
@@ -2821,6 +2855,7 @@ mark_download_progress (struct DownloadEntry *de, | |||
2821 | ade.tab = de->sr->tab; | 2855 | ade.tab = de->sr->tab; |
2822 | ade.prr = de->sr->rr; | 2856 | ade.prr = de->sr->rr; |
2823 | ade.check_duplicates = GNUNET_NO; | 2857 | ade.check_duplicates = GNUNET_NO; |
2858 | ade.anonymity = de->anonymity; | ||
2824 | if (GNUNET_SYSERR == | 2859 | if (GNUNET_SYSERR == |
2825 | GNUNET_FS_directory_list_contents ((size_t) block_size, block_data, | 2860 | GNUNET_FS_directory_list_contents ((size_t) block_size, block_data, |
2826 | offset, &add_directory_entry, &ade)) | 2861 | offset, &add_directory_entry, &ade)) |
@@ -2927,6 +2962,7 @@ mark_download_completed (struct DownloadEntry *de, uint64_t size) | |||
2927 | * @param de existing download entry for the download, or NULL (in which case we create a fresh one) | 2962 | * @param de existing download entry for the download, or NULL (in which case we create a fresh one) |
2928 | * @param pde parent download entry, or NULL | 2963 | * @param pde parent download entry, or NULL |
2929 | * @param sr search result, or NULL | 2964 | * @param sr search result, or NULL |
2965 | * @param anonymity anonymity level for the download | ||
2930 | * @param dc download context (for stopping) | 2966 | * @param dc download context (for stopping) |
2931 | * @param uri the URI, must not be NULL | 2967 | * @param uri the URI, must not be NULL |
2932 | * @param filename filename on disk | 2968 | * @param filename filename on disk |
@@ -2937,7 +2973,9 @@ mark_download_completed (struct DownloadEntry *de, uint64_t size) | |||
2937 | */ | 2973 | */ |
2938 | static struct DownloadEntry * | 2974 | static struct DownloadEntry * |
2939 | setup_download (struct DownloadEntry *de, struct DownloadEntry *pde, | 2975 | setup_download (struct DownloadEntry *de, struct DownloadEntry *pde, |
2940 | struct SearchResult *sr, struct GNUNET_FS_DownloadContext *dc, | 2976 | struct SearchResult *sr, |
2977 | uint32_t anonymity, | ||
2978 | struct GNUNET_FS_DownloadContext *dc, | ||
2941 | const struct GNUNET_FS_Uri *uri, const char *filename, | 2979 | const struct GNUNET_FS_Uri *uri, const char *filename, |
2942 | const struct GNUNET_CONTAINER_MetaData *meta, uint64_t size, | 2980 | const struct GNUNET_CONTAINER_MetaData *meta, uint64_t size, |
2943 | uint64_t completed) | 2981 | uint64_t completed) |
@@ -3023,7 +3061,8 @@ setup_download (struct DownloadEntry *de, struct DownloadEntry *pde, | |||
3023 | /* Stand-alone download with no 'row'/search result affiliated | 3061 | /* Stand-alone download with no 'row'/search result affiliated |
3024 | with the download so far; create a fresh entry for this | 3062 | with the download so far; create a fresh entry for this |
3025 | download in the URI tab */ | 3063 | download in the URI tab */ |
3026 | de->sr = GNUNET_GTK_add_to_uri_tab (meta, uri); | 3064 | de->sr = GNUNET_GTK_add_to_uri_tab (anonymity, |
3065 | meta, uri); | ||
3027 | de->sr->download = de; | 3066 | de->sr->download = de; |
3028 | path = gtk_tree_row_reference_get_path (de->sr->rr); | 3067 | path = gtk_tree_row_reference_get_path (de->sr->rr); |
3029 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->sr->tab->ts), &iter, path)) | 3068 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->sr->tab->ts), &iter, path)) |
@@ -3700,7 +3739,9 @@ GNUNET_GTK_fs_event_handler (void *cls, | |||
3700 | return NULL; | 3739 | return NULL; |
3701 | case GNUNET_FS_STATUS_DOWNLOAD_START: | 3740 | case GNUNET_FS_STATUS_DOWNLOAD_START: |
3702 | return setup_download (info->value.download.cctx, info->value.download.pctx, | 3741 | return setup_download (info->value.download.cctx, info->value.download.pctx, |
3703 | info->value.download.sctx, info->value.download.dc, | 3742 | info->value.download.sctx, |
3743 | info->value.download.anonymity, | ||
3744 | info->value.download.dc, | ||
3704 | info->value.download.uri, | 3745 | info->value.download.uri, |
3705 | info->value.download.filename, | 3746 | info->value.download.filename, |
3706 | info->value.download.specifics.start.meta, | 3747 | info->value.download.specifics.start.meta, |
@@ -3709,7 +3750,9 @@ GNUNET_GTK_fs_event_handler (void *cls, | |||
3709 | case GNUNET_FS_STATUS_DOWNLOAD_RESUME: | 3750 | case GNUNET_FS_STATUS_DOWNLOAD_RESUME: |
3710 | ret = | 3751 | ret = |
3711 | setup_download (info->value.download.cctx, info->value.download.pctx, | 3752 | setup_download (info->value.download.cctx, info->value.download.pctx, |
3712 | info->value.download.sctx, info->value.download.dc, | 3753 | info->value.download.sctx, |
3754 | info->value.download.anonymity, | ||
3755 | info->value.download.dc, | ||
3713 | info->value.download.uri, info->value.download.filename, | 3756 | info->value.download.uri, info->value.download.filename, |
3714 | info->value.download.specifics.resume.meta, | 3757 | info->value.download.specifics.resume.meta, |
3715 | info->value.download.size, | 3758 | info->value.download.size, |
@@ -3771,7 +3814,9 @@ GNUNET_GTK_fs_event_handler (void *cls, | |||
3771 | return ret; | 3814 | return ret; |
3772 | case GNUNET_FS_STATUS_SEARCH_RESUME_RESULT: | 3815 | case GNUNET_FS_STATUS_SEARCH_RESUME_RESULT: |
3773 | ret = | 3816 | ret = |
3774 | process_search_result (info->value.search.cctx, info->value.search.pctx, | 3817 | process_search_result (info->value.search.cctx, |
3818 | info->value.search.anonymity, | ||
3819 | info->value.search.pctx, | ||
3775 | info->value.search.specifics.resume_result.uri, | 3820 | info->value.search.specifics.resume_result.uri, |
3776 | info->value.search.specifics.resume_result.meta, | 3821 | info->value.search.specifics.resume_result.meta, |
3777 | info->value.search.specifics.resume_result. | 3822 | info->value.search.specifics.resume_result. |
@@ -3794,6 +3839,7 @@ GNUNET_GTK_fs_event_handler (void *cls, | |||
3794 | return NULL; | 3839 | return NULL; |
3795 | case GNUNET_FS_STATUS_SEARCH_RESULT: | 3840 | case GNUNET_FS_STATUS_SEARCH_RESULT: |
3796 | return process_search_result (info->value.search.cctx, | 3841 | return process_search_result (info->value.search.cctx, |
3842 | info->value.search.anonymity, | ||
3797 | info->value.search.pctx, | 3843 | info->value.search.pctx, |
3798 | info->value.search.specifics.result.uri, | 3844 | info->value.search.specifics.result.uri, |
3799 | info->value.search.specifics.result.meta, | 3845 | info->value.search.specifics.result.meta, |
diff --git a/src/fs/gnunet-fs-gtk_event-handler.h b/src/fs/gnunet-fs-gtk_event-handler.h index b9f9bbcc..53d9fcf0 100644 --- a/src/fs/gnunet-fs-gtk_event-handler.h +++ b/src/fs/gnunet-fs-gtk_event-handler.h | |||
@@ -204,6 +204,13 @@ struct SearchResult | |||
204 | struct GNUNET_FS_SearchResult *result; | 204 | struct GNUNET_FS_SearchResult *result; |
205 | 205 | ||
206 | /** | 206 | /** |
207 | * Associated search result we generated for probing; | ||
208 | * thus, we need to run "GNUNET_FS_probe_cancel" on it | ||
209 | * once we are done. Only used if 'result' is NULL. | ||
210 | */ | ||
211 | struct GNUNET_FS_SearchResult *probe; | ||
212 | |||
213 | /** | ||
207 | * Associated download, or NULL for none. | 214 | * Associated download, or NULL for none. |
208 | */ | 215 | */ |
209 | struct DownloadEntry *download; | 216 | struct DownloadEntry *download; |
@@ -214,12 +221,14 @@ struct SearchResult | |||
214 | * Setup a new top-level entry in the URI/orphan tab. If necessary, create | 221 | * Setup a new top-level entry in the URI/orphan tab. If necessary, create |
215 | * the URI tab first. | 222 | * the URI tab first. |
216 | * | 223 | * |
224 | * @param anonymity anonymity level to use for probes | ||
217 | * @param meta metadata for the new entry | 225 | * @param meta metadata for the new entry |
218 | * @param uri URI for the new entry | 226 | * @param uri URI for the new entry |
219 | * @return the search result that was set up | 227 | * @return the search result that was set up |
220 | */ | 228 | */ |
221 | struct SearchResult * | 229 | struct SearchResult * |
222 | GNUNET_GTK_add_to_uri_tab (const struct GNUNET_CONTAINER_MetaData *meta, | 230 | GNUNET_GTK_add_to_uri_tab (uint32_t anonymity, |
231 | const struct GNUNET_CONTAINER_MetaData *meta, | ||
223 | const struct GNUNET_FS_Uri *uri); | 232 | const struct GNUNET_FS_Uri *uri); |
224 | 233 | ||
225 | 234 | ||
@@ -227,6 +236,7 @@ GNUNET_GTK_add_to_uri_tab (const struct GNUNET_CONTAINER_MetaData *meta, | |||
227 | * Add a search result to the given search tab. | 236 | * Add a search result to the given search tab. |
228 | * | 237 | * |
229 | * @param tab search tab to extend, never NULL | 238 | * @param tab search tab to extend, never NULL |
239 | * @param anonymity anonymity level to use for probes for this result | ||
230 | * @param parent_rr reference to parent entry in search tab, NULL for normal | 240 | * @param parent_rr reference to parent entry in search tab, NULL for normal |
231 | * search results, | 241 | * search results, |
232 | * @param uri uri to add, can be NULL for top-level entry of a directory opened from disk | 242 | * @param uri uri to add, can be NULL for top-level entry of a directory opened from disk |
@@ -241,6 +251,7 @@ GNUNET_GTK_add_to_uri_tab (const struct GNUNET_CONTAINER_MetaData *meta, | |||
241 | */ | 251 | */ |
242 | struct SearchResult * | 252 | struct SearchResult * |
243 | GNUNET_GTK_add_search_result (struct SearchTab *tab, | 253 | GNUNET_GTK_add_search_result (struct SearchTab *tab, |
254 | uint32_t anonymity, | ||
244 | GtkTreeRowReference *parent_rr, | 255 | GtkTreeRowReference *parent_rr, |
245 | const struct GNUNET_FS_Uri *uri, | 256 | const struct GNUNET_FS_Uri *uri, |
246 | const struct GNUNET_CONTAINER_MetaData *meta, | 257 | const struct GNUNET_CONTAINER_MetaData *meta, |
diff --git a/src/fs/gnunet-fs-gtk_open-directory.c b/src/fs/gnunet-fs-gtk_open-directory.c index 9cc2640a..b6bf9759 100644 --- a/src/fs/gnunet-fs-gtk_open-directory.c +++ b/src/fs/gnunet-fs-gtk_open-directory.c | |||
@@ -40,6 +40,11 @@ struct AddChildContext | |||
40 | * Reference to the directorie's search result. | 40 | * Reference to the directorie's search result. |
41 | */ | 41 | */ |
42 | struct SearchResult *sr; | 42 | struct SearchResult *sr; |
43 | |||
44 | /** | ||
45 | * Anonymity level to use for probes in the directory. | ||
46 | */ | ||
47 | uint32_t anonymity; | ||
43 | 48 | ||
44 | }; | 49 | }; |
45 | 50 | ||
@@ -78,7 +83,8 @@ add_child (void *cls, const char *filename, const struct GNUNET_FS_Uri *uri, | |||
78 | EXTRACTOR_METAFORMAT_UTF8, "text/plain", | 83 | EXTRACTOR_METAFORMAT_UTF8, "text/plain", |
79 | acc->filename, | 84 | acc->filename, |
80 | strlen (acc->filename) + 1); | 85 | strlen (acc->filename) + 1); |
81 | acc->sr = GNUNET_GTK_add_to_uri_tab (dmeta, NULL); | 86 | acc->sr = GNUNET_GTK_add_to_uri_tab (acc->anonymity, |
87 | dmeta, NULL); | ||
82 | GNUNET_CONTAINER_meta_data_destroy (dmeta); | 88 | GNUNET_CONTAINER_meta_data_destroy (dmeta); |
83 | return; | 89 | return; |
84 | } | 90 | } |
@@ -89,6 +95,7 @@ add_child (void *cls, const char *filename, const struct GNUNET_FS_Uri *uri, | |||
89 | } | 95 | } |
90 | GNUNET_assert (NULL != | 96 | GNUNET_assert (NULL != |
91 | GNUNET_GTK_add_search_result (acc->sr->tab, | 97 | GNUNET_GTK_add_search_result (acc->sr->tab, |
98 | acc->anonymity, | ||
92 | acc->sr->rr, | 99 | acc->sr->rr, |
93 | uri, | 100 | uri, |
94 | meta, NULL, 0)); | 101 | meta, NULL, 0)); |
@@ -103,7 +110,7 @@ add_child (void *cls, const char *filename, const struct GNUNET_FS_Uri *uri, | |||
103 | * @param user_data the builder of the dialog | 110 | * @param user_data the builder of the dialog |
104 | */ | 111 | */ |
105 | void | 112 | void |
106 | GNUNET_GTK_open_directory_dialog_response_cb (GtkDialog * dialog, | 113 | GNUNET_GTK_open_directory_dialog_response_cb (GtkDialog *dialog, |
107 | gint response_id, | 114 | gint response_id, |
108 | gpointer user_data) | 115 | gpointer user_data) |
109 | { | 116 | { |
@@ -122,6 +129,7 @@ GNUNET_GTK_open_directory_dialog_response_cb (GtkDialog * dialog, | |||
122 | g_object_unref (G_OBJECT (builder)); | 129 | g_object_unref (G_OBJECT (builder)); |
123 | acc.filename = filename; | 130 | acc.filename = filename; |
124 | acc.sr = NULL; | 131 | acc.sr = NULL; |
132 | acc.anonymity = 1; // FIXME, might want to add this to dialog to allow user to set it. | ||
125 | GNUNET_FS_GTK_mmap_and_scan (filename, &add_child, &acc); | 133 | GNUNET_FS_GTK_mmap_and_scan (filename, &add_child, &acc); |
126 | GNUNET_free (filename); | 134 | GNUNET_free (filename); |
127 | } | 135 | } |