aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/fs/download.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/fs/download.c')
-rw-r--r--src/plugins/fs/download.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c
index 5abbd3ae..ed2de800 100644
--- a/src/plugins/fs/download.c
+++ b/src/plugins/fs/download.c
@@ -413,25 +413,16 @@ void on_clearCompletedDownloadsButton_clicked(void * unused,
413 NULL); 413 NULL);
414} 414}
415 415
416static void * shutdownCode(void * it) { 416struct aDC_closure {
417 GtkTreeModel * model;
418 GtkTreeIter * iter = it;
419 struct ECRS_URI * u; 417 struct ECRS_URI * u;
420 char * fn; 418 char * fn;
419};
421 420
422 model = GTK_TREE_MODEL(summary); 421static void * shutdownCode(void * c) {
423 gtk_tree_model_get(model, 422 struct aDC_closure * cls = c;
424 iter,
425 DOWNLOAD_URI, &u,
426 DOWNLOAD_FILENAME, &fn,
427 -1);
428 FSUI_stopDownload(ctx, 423 FSUI_stopDownload(ctx,
429 u, 424 cls->u,
430 fn); 425 cls->fn);
431 gtk_tree_store_remove(summary,
432 iter);
433 if (u != NULL)
434 ECRS_freeUri(u);
435 return NULL; 426 return NULL;
436} 427}
437 428
@@ -439,9 +430,20 @@ static void abortDownloadCallback(GtkTreeModel * model,
439 GtkTreePath * path, 430 GtkTreePath * path,
440 GtkTreeIter * iter, 431 GtkTreeIter * iter,
441 GtkTreeStore * tree) { 432 GtkTreeStore * tree) {
433 struct aDC_closure cls;
434
442 GNUNET_ASSERT(model == GTK_TREE_MODEL(summary)); 435 GNUNET_ASSERT(model == GTK_TREE_MODEL(summary));
436 gtk_tree_model_get(model,
437 iter,
438 DOWNLOAD_URI, &cls.u,
439 DOWNLOAD_FILENAME, &cls.fn,
440 -1);
441 gtk_tree_store_remove(summary,
442 iter);
443 run_with_save_calls(&shutdownCode, 443 run_with_save_calls(&shutdownCode,
444 iter); 444 &cls);
445 if (cls.u != NULL)
446 ECRS_freeUri(cls.u);
445} 447}
446 448
447void on_abortDownloadButton_clicked(void * unused, 449void on_abortDownloadButton_clicked(void * unused,