diff options
author | Christian Grothoff <christian@grothoff.org> | 2006-11-05 23:59:55 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2006-11-05 23:59:55 +0000 |
commit | 8ff822d17c22a6e1df80c34e046ab6520de48d34 (patch) | |
tree | 7e957ba8b89f24d21f54c045cf628d256d0ca364 | |
parent | ea387a07ccb425633a4bae12802c020a09b84ba5 (diff) | |
download | gnunet-gtk-8ff822d17c22a6e1df80c34e046ab6520de48d34.tar.gz gnunet-gtk-8ff822d17c22a6e1df80c34e046ab6520de48d34.zip |
bugfixes
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | src/plugins/fs/download.c | 64 |
2 files changed, 54 insertions, 11 deletions
@@ -2,6 +2,7 @@ | |||
2 | - support new FSUI apis: [pre0] | 2 | - support new FSUI apis: [pre0] |
3 | * insert 21.pdf, search 21, search application/pdf, stop insert, abort search (summary), stop search (search), exit => crash | 3 | * insert 21.pdf, search 21, search application/pdf, stop insert, abort search (summary), stop search (search), exit => crash |
4 | * (inserted 21.pdf), search application/pdf, download => no progress! | 4 | * (inserted 21.pdf), search application/pdf, download => no progress! |
5 | => related to existing bug in GNUnet with recursive download??? | ||
5 | * test, test, test! | 6 | * test, test, test! |
6 | - disable inactive buttons (if no search/download | 7 | - disable inactive buttons (if no search/download |
7 | is selected to operate on) [ medium ] [pre1] | 8 | is selected to operate on) [ medium ] [pre1] |
diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c index ff3f361c..19b2f73a 100644 --- a/src/plugins/fs/download.c +++ b/src/plugins/fs/download.c | |||
@@ -383,6 +383,41 @@ void fs_download_stopped(DownloadList * list) { | |||
383 | /* **************** user download events ******************** */ | 383 | /* **************** user download events ******************** */ |
384 | 384 | ||
385 | /** | 385 | /** |
386 | * Check if a download for the given filename is | ||
387 | * already running. | ||
388 | * | ||
389 | * @return OK if no download is pending, SYSERR if | ||
390 | * such a download is already active. | ||
391 | */ | ||
392 | static int | ||
393 | check_pending(const char * filename, | ||
394 | GtkTreeIter * parent) { | ||
395 | GtkTreeModel * model; | ||
396 | GtkTreeIter iter; | ||
397 | const char * name; | ||
398 | |||
399 | model = GTK_TREE_MODEL(download_summary); | ||
400 | if (gtk_tree_model_iter_children(model, | ||
401 | &iter, | ||
402 | parent)) { | ||
403 | do { | ||
404 | gtk_tree_model_get(model, | ||
405 | &iter, | ||
406 | DOWNLOAD_FILENAME, &name, | ||
407 | -1); | ||
408 | if ( (name != NULL) && | ||
409 | (0 == strcmp(name, filename)) ) | ||
410 | return SYSERR; | ||
411 | if (SYSERR == check_pending(filename, | ||
412 | &iter)) | ||
413 | return SYSERR; | ||
414 | } while (gtk_tree_model_iter_next(model, | ||
415 | &iter)); | ||
416 | } | ||
417 | return OK; | ||
418 | } | ||
419 | |||
420 | /** | ||
386 | * The user clicked the download button. | 421 | * The user clicked the download button. |
387 | * Start the download of the selected entry. | 422 | * Start the download of the selected entry. |
388 | */ | 423 | */ |
@@ -544,17 +579,24 @@ initiateDownload(GtkTreeModel * model, | |||
544 | - strlen(GNUNET_DIRECTORY_EXT)], | 579 | - strlen(GNUNET_DIRECTORY_EXT)], |
545 | GNUNET_DIRECTORY_EXT)) ) ) | 580 | GNUNET_DIRECTORY_EXT)) ) ) |
546 | strcat(idc_final_download_destination, GNUNET_DIRECTORY_EXT); | 581 | strcat(idc_final_download_destination, GNUNET_DIRECTORY_EXT); |
547 | 582 | ||
548 | addLogEntry(_("Downloading `%s'"), idc_name); | 583 | /* FIXME: check that there is no pending download |
549 | FSUI_startDownload(ctx, | 584 | for idc_name! */ |
550 | getSpinButtonValue(searchContext->searchXML, | 585 | if (OK == check_pending(idc_name, |
551 | "downloadAnonymitySpinButton"), | 586 | NULL)) { |
552 | NO, /* FIXME: isRecursive */ | 587 | addLogEntry(_("Downloading `%s'"), idc_name); |
553 | idc_uri, | 588 | FSUI_startDownload(ctx, |
554 | idc_meta, | 589 | getSpinButtonValue(searchContext->searchXML, |
555 | idc_final_download_destination, | 590 | "downloadAnonymitySpinButton"), |
556 | searchContext->fsui_list, | 591 | NO, /* FIXME: isRecursive */ |
557 | (parentContext != NULL) ? parentContext->fsui_list : NULL); | 592 | idc_uri, |
593 | idc_meta, | ||
594 | idc_final_download_destination, | ||
595 | searchContext->fsui_list, | ||
596 | (parentContext != NULL) ? parentContext->fsui_list : NULL); | ||
597 | } else { | ||
598 | addLogEntry(_("ERROR: already downloading `%s'"), idc_name); | ||
599 | } | ||
558 | FREE(uri_name); | 600 | FREE(uri_name); |
559 | FREE(dirPath); | 601 | FREE(dirPath); |
560 | FREENONNULL(final_download_dir); | 602 | FREENONNULL(final_download_dir); |