only update library UI if the tab is visible. GitHub issue #84

auto-update
Zlatin Balevsky 2021-10-14 15:06:44 +01:00
parent 6c7a9e3309
commit 93428e1ec6
No known key found for this signature in database
GPG Key ID: A72832072D525E41
2 changed files with 14 additions and 0 deletions

View File

@ -106,6 +106,7 @@ class MainFrameModel {
private final Set<SharedFile> allSharedFiles = Collections.synchronizedSet(new LinkedHashSet<>())
List<SharedFile> shared
private boolean libraryDirty
boolean libraryTabVisible
private final javax.swing.Timer libraryTimer = new javax.swing.Timer(1000, {refreshLibrary()})
TreeModel sharedTree
DefaultMutableTreeNode allFilesTreeRoot, treeRoot
@ -367,6 +368,8 @@ class MainFrameModel {
void onAllFilesLoadedEvent(AllFilesLoadedEvent e) {
runInsideUIAsync {
view.refreshSharedFiles()
libraryDirty = false
view.magicTreeExpansion()
filteringEnabled = true
core.muOptions.trustSubscriptions.each {
@ -1018,6 +1021,8 @@ class MainFrameModel {
}
private void refreshLibrary() {
if (!libraryTabVisible)
return
if (libraryDirty) {
libraryDirty = false
view.refreshSharedFiles()

View File

@ -1720,6 +1720,7 @@ class MainFrameView {
model.chatPaneButtonEnabled = true
chatNotificator.mainWindowDeactivated()
resultsTabListener.markSelectedVisible()
model.libraryTabVisible = false
}
def showDownloadsWindow = {
@ -1736,6 +1737,7 @@ class MainFrameView {
model.chatPaneButtonEnabled = true
chatNotificator.mainWindowDeactivated()
resultsTabListener.markAllTabsInvisible()
model.libraryTabVisible = false
}
def showUploadsWindow = {
@ -1752,6 +1754,7 @@ class MainFrameView {
model.chatPaneButtonEnabled = true
chatNotificator.mainWindowDeactivated()
resultsTabListener.markAllTabsInvisible()
model.libraryTabVisible = true
}
def showCollectionsWindow = {
@ -1768,6 +1771,7 @@ class MainFrameView {
model.chatPaneButtonEnabled = true
chatNotificator.mainWindowDeactivated()
resultsTabListener.markAllTabsInvisible()
model.libraryTabVisible = false
}
def showMonitorWindow = {
@ -1784,6 +1788,7 @@ class MainFrameView {
model.chatPaneButtonEnabled = true
chatNotificator.mainWindowDeactivated()
resultsTabListener.markAllTabsInvisible()
model.libraryTabVisible = false
}
def showFeedsWindow = {
@ -1800,6 +1805,7 @@ class MainFrameView {
model.chatPaneButtonEnabled = true
chatNotificator.mainWindowDeactivated()
resultsTabListener.markAllTabsInvisible()
model.libraryTabVisible = false
}
def showTrustWindow = {
@ -1816,6 +1822,7 @@ class MainFrameView {
model.chatPaneButtonEnabled = true
chatNotificator.mainWindowDeactivated()
resultsTabListener.markAllTabsInvisible()
model.libraryTabVisible = false
}
def showMessagesWindow = {
@ -1832,6 +1839,7 @@ class MainFrameView {
model.chatPaneButtonEnabled = true
chatNotificator.mainWindowDeactivated()
resultsTabListener.markAllTabsInvisible()
model.libraryTabVisible = false
}
def showChatWindow = {
@ -1848,6 +1856,7 @@ class MainFrameView {
model.chatPaneButtonEnabled = false
chatNotificator.mainWindowActivated()
resultsTabListener.markAllTabsInvisible()
model.libraryTabVisible = false
}
def showSharedFilesTable = {