diff --git a/core/src/main/groovy/com/muwire/core/download/Downloader.groovy b/core/src/main/groovy/com/muwire/core/download/Downloader.groovy index 3a823f22..eefae21a 100644 --- a/core/src/main/groovy/com/muwire/core/download/Downloader.groovy +++ b/core/src/main/groovy/com/muwire/core/download/Downloader.groovy @@ -145,6 +145,15 @@ public class Downloader { } } + public int activeWorkers() { + int active = 0 + activeWorkers.values().each { + if (it.currentState != WorkerState.FINISHED) + active++ + } + active + } + public void resume() { downloadManager.resume(this) } diff --git a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy index a922fbc7..5b47ee88 100644 --- a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy @@ -105,7 +105,7 @@ class MainFrameView { int done = row.downloader.donePieces() "$done/$pieces pieces" }) - closureColumn(header: "Sources", preferredWidth : 10, type: Integer, read : {row -> row.downloader.activeWorkers.size()}) + closureColumn(header: "Sources", preferredWidth : 10, type: Integer, read : {row -> row.downloader.activeWorkers()}) closureColumn(header: "Speed", preferredWidth: 50, type:String, read :{row -> DataHelper.formatSize2Decimal(row.downloader.speed(), false) + "B/sec" })