diff options
Diffstat (limited to 'src/fs/gnunet-fs-gtk-event_handler.c')
-rw-r--r-- | src/fs/gnunet-fs-gtk-event_handler.c | 67 |
1 files changed, 2 insertions, 65 deletions
diff --git a/src/fs/gnunet-fs-gtk-event_handler.c b/src/fs/gnunet-fs-gtk-event_handler.c index 32852aef..607e5813 100644 --- a/src/fs/gnunet-fs-gtk-event_handler.c +++ b/src/fs/gnunet-fs-gtk-event_handler.c | |||
@@ -909,69 +909,6 @@ get_suggested_filename_anonymity (GtkTreeModel *tm, GtkTreeIter *iter, int top, | |||
909 | return NULL; | 909 | return NULL; |
910 | } | 910 | } |
911 | 911 | ||
912 | static void | ||
913 | open_download_as_callback (struct DownloadContext *dc) | ||
914 | { | ||
915 | enum GNUNET_FS_DownloadOptions opt; | ||
916 | struct GNUNET_FS_Handle *fs; | ||
917 | struct DownloadEntry *de; | ||
918 | uint64_t len; | ||
919 | |||
920 | GtkTreeIter iter; | ||
921 | GtkTreePath *path; | ||
922 | |||
923 | fs = GNUNET_FS_GTK_get_fs_handle (); | ||
924 | opt = GNUNET_FS_DOWNLOAD_OPTION_NONE; | ||
925 | if (dc->is_recursive) | ||
926 | opt |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE; | ||
927 | len = GNUNET_FS_uri_chk_get_file_size (dc->uri); | ||
928 | |||
929 | de = GNUNET_malloc (sizeof (struct DownloadEntry)); | ||
930 | de->uri = dc->uri; | ||
931 | dc->uri = NULL; | ||
932 | de->meta = dc->meta; | ||
933 | dc->meta = NULL; | ||
934 | if (dc->rr != NULL) | ||
935 | { | ||
936 | /* We're going to free "dc" very soon */ | ||
937 | de->rr = gtk_tree_row_reference_copy (dc->rr); | ||
938 | de->ts = GTK_TREE_STORE (gtk_tree_row_reference_get_model (dc->rr)); | ||
939 | |||
940 | path = gtk_tree_row_reference_get_path (de->rr); | ||
941 | GNUNET_assert (NULL != path); | ||
942 | if (gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), &iter, path)) | ||
943 | { | ||
944 | /* Store filename and anonymity as specified by the user. | ||
945 | * These will be re-used when this is a directory, and the user | ||
946 | * downloads its children. | ||
947 | */ | ||
948 | gtk_tree_store_set (de->ts, &iter, 15, dc->filename, 16, dc->anonymity, -1); | ||
949 | } | ||
950 | gtk_tree_path_free (path); | ||
951 | |||
952 | } | ||
953 | if (dc->sr != NULL) | ||
954 | { | ||
955 | GNUNET_break (NULL != | ||
956 | GNUNET_FS_download_start_from_search (fs, dc->sr, | ||
957 | dc->filename, | ||
958 | NULL /* tempname */ , | ||
959 | 0 /* offset */ , | ||
960 | len, dc->anonymity, opt, | ||
961 | de)); | ||
962 | } | ||
963 | else | ||
964 | { | ||
965 | GNUNET_break (NULL != | ||
966 | GNUNET_FS_download_start (fs, de->uri, NULL /* meta */ , | ||
967 | dc->filename, NULL /* tempname */ , | ||
968 | 0 /* offset */ , | ||
969 | len, dc->anonymity, opt, de, | ||
970 | NULL /* parent download ctx */ )); | ||
971 | } | ||
972 | GNUNET_GTK_save_as_dialog_free_download_context (dc); | ||
973 | } | ||
974 | |||
975 | /** | 912 | /** |
976 | * Tell FS to start a download. Begins by opening the | 913 | * Tell FS to start a download. Begins by opening the |
977 | * "save as" window. | 914 | * "save as" window. |
@@ -1086,10 +1023,10 @@ start_download (GtkTreeView * tree_view, GtkTreePath * path, | |||
1086 | dc->anonymity = anonymity; | 1023 | dc->anonymity = anonymity; |
1087 | dc->is_recursive = sdc->recursive; | 1024 | dc->is_recursive = sdc->recursive; |
1088 | dc->tab = tab; | 1025 | dc->tab = tab; |
1089 | dc->cb = &open_download_as_callback; | 1026 | dc->cb = &GNUNET_FS_GTK_default_open_download_as_callback; |
1090 | if (local_parents && have_a_suggestion) | 1027 | if (local_parents && have_a_suggestion) |
1091 | /* Skip the dialog, call directly */ | 1028 | /* Skip the dialog, call directly */ |
1092 | open_download_as_callback (dc); | 1029 | GNUNET_FS_GTK_default_open_download_as_callback (dc); |
1093 | else | 1030 | else |
1094 | GNUNET_FS_GTK_open_download_as_dialog (dc); | 1031 | GNUNET_FS_GTK_open_download_as_dialog (dc); |
1095 | } | 1032 | } |