From f0c8c11094b74cabcce0a42c42aca256626f2c93 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Thu, 26 Mar 2020 05:31:05 +0000 Subject: [PATCH] get rid of UI-side watching of directories on AllFilesLoadedEvent --- .../groovy/com/muwire/clilanterna/FilesModel.groovy | 10 ---------- .../models/com/muwire/gui/MainFrameModel.groovy | 2 -- webui/src/main/java/com/muwire/webui/MuWireClient.java | 6 ------ 3 files changed, 18 deletions(-) diff --git a/cli-lanterna/src/main/groovy/com/muwire/clilanterna/FilesModel.groovy b/cli-lanterna/src/main/groovy/com/muwire/clilanterna/FilesModel.groovy index 4bc671a4..84133668 100644 --- a/cli-lanterna/src/main/groovy/com/muwire/clilanterna/FilesModel.groovy +++ b/cli-lanterna/src/main/groovy/com/muwire/clilanterna/FilesModel.groovy @@ -28,7 +28,6 @@ class FilesModel { core.eventBus.register(FileLoadedEvent.class, this) core.eventBus.register(FileUnsharedEvent.class, this) core.eventBus.register(FileHashedEvent.class, this) - core.eventBus.register(AllFilesLoadedEvent.class, this) Runnable refreshModel = {refreshModel()} Timer timer = new Timer(true) @@ -38,15 +37,6 @@ class FilesModel { } - void onAllFilesLoadedEvent(AllFilesLoadedEvent e) { - def eventBus = core.eventBus - guiThread.invokeLater { - core.muOptions.watchedDirectories.each { - eventBus.publish(new FileSharedEvent(file: new File(it))) - } - } - } - void onFileLoadedEvent(FileLoadedEvent e) { guiThread.invokeLater { sharedFiles.add(e.loadedFile) diff --git a/gui/griffon-app/models/com/muwire/gui/MainFrameModel.groovy b/gui/griffon-app/models/com/muwire/gui/MainFrameModel.groovy index 68057ab0..2077a456 100644 --- a/gui/griffon-app/models/com/muwire/gui/MainFrameModel.groovy +++ b/gui/griffon-app/models/com/muwire/gui/MainFrameModel.groovy @@ -294,8 +294,6 @@ class MainFrameModel { void onAllFilesLoadedEvent(AllFilesLoadedEvent e) { runInsideUIAsync { - core.muOptions.watchedDirectories.each { core.eventBus.publish(new FileSharedEvent(file : new File(it))) } - core.muOptions.trustSubscriptions.each { core.eventBus.publish(new TrustSubscriptionEvent(persona : it, subscribe : true)) } diff --git a/webui/src/main/java/com/muwire/webui/MuWireClient.java b/webui/src/main/java/com/muwire/webui/MuWireClient.java index 1ea4c350..91b010a9 100644 --- a/webui/src/main/java/com/muwire/webui/MuWireClient.java +++ b/webui/src/main/java/com/muwire/webui/MuWireClient.java @@ -193,12 +193,6 @@ public class MuWireClient { } public void onAllFilesLoadedEvent(AllFilesLoadedEvent e) { - core.getMuOptions().getWatchedDirectories().stream().map(File::new). - forEach(f -> { - FileSharedEvent event = new FileSharedEvent(); - event.setFile(f); - core.getEventBus().publish(event); - }); core.getMuOptions().getTrustSubscriptions().forEach( p -> { TrustSubscriptionEvent event = new TrustSubscriptionEvent();