diff --git a/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy b/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy index e48e710e..772c4795 100644 --- a/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy +++ b/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy @@ -478,7 +478,6 @@ class MainFrameController { core.eventBus.publish(new FileUnsharedEvent(unsharedFile : sf)) } - core.eventBus.publish(new RefreshLibraryEvent()) } @ControllerAction diff --git a/gui/griffon-app/models/com/muwire/gui/MainFrameModel.groovy b/gui/griffon-app/models/com/muwire/gui/MainFrameModel.groovy index 31d1ea97..1ad67329 100644 --- a/gui/griffon-app/models/com/muwire/gui/MainFrameModel.groovy +++ b/gui/griffon-app/models/com/muwire/gui/MainFrameModel.groovy @@ -104,7 +104,7 @@ class MainFrameModel { volatile String filter volatile Filterer filterer boolean treeVisible = true - private final List allSharedFiles = Collections.synchronizedList(new ArrayList<>()) + private final Set allSharedFiles = Collections.synchronizedSet(new LinkedHashSet<>()) def shared TreeModel sharedTree DefaultMutableTreeNode allFilesTreeRoot, treeRoot @@ -299,7 +299,6 @@ class MainFrameModel { core.eventBus.register(UIMessageReadEvent.class, this) core.eventBus.register(MessageSentEvent.class, this) core.eventBus.register(MessageFolderLoadingEvent.class, this) - core.eventBus.register(RefreshLibraryEvent.class, this) core.muOptions.watchedKeywords.each { @@ -563,7 +562,14 @@ class MainFrameModel { throw new IllegalStateException() otherNode = next } - otherNode.removeFromParent() + while(true) { + def parent = otherNode.getParent() + otherNode.removeFromParent() + if (parent.getChildCount() == 0) { + otherNode = parent + } else + break + } } List unshared = new ArrayList<>() @@ -585,16 +591,10 @@ class MainFrameModel { File unsharedRoot = unshared.get( unshared.size() -1 ) core.eventBus.publish(new DirectoryUnsharedEvent(directory : unsharedRoot)) } - } + } } } - void onRefreshLibraryEvent(RefreshLibraryEvent e) { - runInsideUIAsync { - view.refreshSharedFiles() - } - } - void onUploadEvent(UploadEvent e) { runInsideUIAsync { UploaderWrapper wrapper = null diff --git a/gui/src/main/groovy/com/muwire/gui/RefreshLibraryEvent.groovy b/gui/src/main/groovy/com/muwire/gui/RefreshLibraryEvent.groovy deleted file mode 100644 index 39ce48e6..00000000 --- a/gui/src/main/groovy/com/muwire/gui/RefreshLibraryEvent.groovy +++ /dev/null @@ -1,6 +0,0 @@ -package com.muwire.gui - -import com.muwire.core.Event - -class RefreshLibraryEvent extends Event { -}