mirror of https://github.com/zlatinb/muwire
get rid of UI-side watching of directories on AllFilesLoadedEvent
parent
11e320ef53
commit
f0c8c11094
|
@ -28,7 +28,6 @@ class FilesModel {
|
||||||
core.eventBus.register(FileLoadedEvent.class, this)
|
core.eventBus.register(FileLoadedEvent.class, this)
|
||||||
core.eventBus.register(FileUnsharedEvent.class, this)
|
core.eventBus.register(FileUnsharedEvent.class, this)
|
||||||
core.eventBus.register(FileHashedEvent.class, this)
|
core.eventBus.register(FileHashedEvent.class, this)
|
||||||
core.eventBus.register(AllFilesLoadedEvent.class, this)
|
|
||||||
|
|
||||||
Runnable refreshModel = {refreshModel()}
|
Runnable refreshModel = {refreshModel()}
|
||||||
Timer timer = new Timer(true)
|
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) {
|
void onFileLoadedEvent(FileLoadedEvent e) {
|
||||||
guiThread.invokeLater {
|
guiThread.invokeLater {
|
||||||
sharedFiles.add(e.loadedFile)
|
sharedFiles.add(e.loadedFile)
|
||||||
|
|
|
@ -294,8 +294,6 @@ class MainFrameModel {
|
||||||
|
|
||||||
void onAllFilesLoadedEvent(AllFilesLoadedEvent e) {
|
void onAllFilesLoadedEvent(AllFilesLoadedEvent e) {
|
||||||
runInsideUIAsync {
|
runInsideUIAsync {
|
||||||
core.muOptions.watchedDirectories.each { core.eventBus.publish(new FileSharedEvent(file : new File(it))) }
|
|
||||||
|
|
||||||
core.muOptions.trustSubscriptions.each {
|
core.muOptions.trustSubscriptions.each {
|
||||||
core.eventBus.publish(new TrustSubscriptionEvent(persona : it, subscribe : true))
|
core.eventBus.publish(new TrustSubscriptionEvent(persona : it, subscribe : true))
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,12 +193,6 @@ public class MuWireClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onAllFilesLoadedEvent(AllFilesLoadedEvent e) {
|
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 -> {
|
core.getMuOptions().getTrustSubscriptions().forEach( p -> {
|
||||||
TrustSubscriptionEvent event = new TrustSubscriptionEvent();
|
TrustSubscriptionEvent event = new TrustSubscriptionEvent();
|
||||||
|
|
Loading…
Reference in New Issue