aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk-download.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs-gtk-download.c')
-rw-r--r--src/fs/gnunet-fs-gtk-download.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/fs/gnunet-fs-gtk-download.c b/src/fs/gnunet-fs-gtk-download.c
index dc5b2310..8c4f8ee6 100644
--- a/src/fs/gnunet-fs-gtk-download.c
+++ b/src/fs/gnunet-fs-gtk-download.c
@@ -158,4 +158,67 @@ GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc)
158 gtk_window_present (GTK_WINDOW (ad)); 158 gtk_window_present (GTK_WINDOW (ad));
159} 159}
160 160
161void
162GNUNET_FS_GTK_default_open_download_as_callback (struct DownloadContext *dc)
163{
164 enum GNUNET_FS_DownloadOptions opt;
165 struct GNUNET_FS_Handle *fs;
166 struct DownloadEntry *de;
167 uint64_t len;
168
169 GtkTreeIter iter;
170 GtkTreePath *path;
171
172 fs = GNUNET_FS_GTK_get_fs_handle ();
173 opt = GNUNET_FS_DOWNLOAD_OPTION_NONE;
174 if (dc->is_recursive)
175 opt |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE;
176 len = GNUNET_FS_uri_chk_get_file_size (dc->uri);
177
178 de = GNUNET_malloc (sizeof (struct DownloadEntry));
179 de->uri = dc->uri;
180 dc->uri = NULL;
181 de->meta = dc->meta;
182 dc->meta = NULL;
183 if (dc->rr != NULL)
184 {
185 /* We're going to free "dc" very soon */
186 de->rr = gtk_tree_row_reference_copy (dc->rr);
187 de->ts = GTK_TREE_STORE (gtk_tree_row_reference_get_model (dc->rr));
188
189 path = gtk_tree_row_reference_get_path (de->rr);
190 GNUNET_assert (NULL != path);
191 if (gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), &iter, path))
192 {
193 /* Store filename and anonymity as specified by the user.
194 * These will be re-used when this is a directory, and the user
195 * downloads its children.
196 */
197 gtk_tree_store_set (de->ts, &iter, 15, dc->filename, 16, dc->anonymity, -1);
198 }
199 gtk_tree_path_free (path);
200
201 }
202 if (dc->sr != NULL)
203 {
204 GNUNET_break (NULL !=
205 GNUNET_FS_download_start_from_search (fs, dc->sr,
206 dc->filename,
207 NULL /* tempname */ ,
208 0 /* offset */ ,
209 len, dc->anonymity, opt,
210 de));
211 }
212 else
213 {
214 GNUNET_break (NULL !=
215 GNUNET_FS_download_start (fs, de->uri, NULL /* meta */ ,
216 dc->filename, NULL /* tempname */ ,
217 0 /* offset */ ,
218 len, dc->anonymity, opt, de,
219 NULL /* parent download ctx */ ));
220 }
221 GNUNET_GTK_save_as_dialog_free_download_context (dc);
222}
223
161/* end of gnunet-fs-gtk-download.c */ 224/* end of gnunet-fs-gtk-download.c */