mirror of https://github.com/zlatinb/muwire
only update library UI if the tab is visible. GitHub issue #84
parent
6c7a9e3309
commit
93428e1ec6
|
@ -106,6 +106,7 @@ class MainFrameModel {
|
||||||
private final Set<SharedFile> allSharedFiles = Collections.synchronizedSet(new LinkedHashSet<>())
|
private final Set<SharedFile> allSharedFiles = Collections.synchronizedSet(new LinkedHashSet<>())
|
||||||
List<SharedFile> shared
|
List<SharedFile> shared
|
||||||
private boolean libraryDirty
|
private boolean libraryDirty
|
||||||
|
boolean libraryTabVisible
|
||||||
private final javax.swing.Timer libraryTimer = new javax.swing.Timer(1000, {refreshLibrary()})
|
private final javax.swing.Timer libraryTimer = new javax.swing.Timer(1000, {refreshLibrary()})
|
||||||
TreeModel sharedTree
|
TreeModel sharedTree
|
||||||
DefaultMutableTreeNode allFilesTreeRoot, treeRoot
|
DefaultMutableTreeNode allFilesTreeRoot, treeRoot
|
||||||
|
@ -367,6 +368,8 @@ class MainFrameModel {
|
||||||
|
|
||||||
void onAllFilesLoadedEvent(AllFilesLoadedEvent e) {
|
void onAllFilesLoadedEvent(AllFilesLoadedEvent e) {
|
||||||
runInsideUIAsync {
|
runInsideUIAsync {
|
||||||
|
view.refreshSharedFiles()
|
||||||
|
libraryDirty = false
|
||||||
view.magicTreeExpansion()
|
view.magicTreeExpansion()
|
||||||
filteringEnabled = true
|
filteringEnabled = true
|
||||||
core.muOptions.trustSubscriptions.each {
|
core.muOptions.trustSubscriptions.each {
|
||||||
|
@ -1018,6 +1021,8 @@ class MainFrameModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshLibrary() {
|
private void refreshLibrary() {
|
||||||
|
if (!libraryTabVisible)
|
||||||
|
return
|
||||||
if (libraryDirty) {
|
if (libraryDirty) {
|
||||||
libraryDirty = false
|
libraryDirty = false
|
||||||
view.refreshSharedFiles()
|
view.refreshSharedFiles()
|
||||||
|
|
|
@ -1720,6 +1720,7 @@ class MainFrameView {
|
||||||
model.chatPaneButtonEnabled = true
|
model.chatPaneButtonEnabled = true
|
||||||
chatNotificator.mainWindowDeactivated()
|
chatNotificator.mainWindowDeactivated()
|
||||||
resultsTabListener.markSelectedVisible()
|
resultsTabListener.markSelectedVisible()
|
||||||
|
model.libraryTabVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
def showDownloadsWindow = {
|
def showDownloadsWindow = {
|
||||||
|
@ -1736,6 +1737,7 @@ class MainFrameView {
|
||||||
model.chatPaneButtonEnabled = true
|
model.chatPaneButtonEnabled = true
|
||||||
chatNotificator.mainWindowDeactivated()
|
chatNotificator.mainWindowDeactivated()
|
||||||
resultsTabListener.markAllTabsInvisible()
|
resultsTabListener.markAllTabsInvisible()
|
||||||
|
model.libraryTabVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
def showUploadsWindow = {
|
def showUploadsWindow = {
|
||||||
|
@ -1752,6 +1754,7 @@ class MainFrameView {
|
||||||
model.chatPaneButtonEnabled = true
|
model.chatPaneButtonEnabled = true
|
||||||
chatNotificator.mainWindowDeactivated()
|
chatNotificator.mainWindowDeactivated()
|
||||||
resultsTabListener.markAllTabsInvisible()
|
resultsTabListener.markAllTabsInvisible()
|
||||||
|
model.libraryTabVisible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
def showCollectionsWindow = {
|
def showCollectionsWindow = {
|
||||||
|
@ -1768,6 +1771,7 @@ class MainFrameView {
|
||||||
model.chatPaneButtonEnabled = true
|
model.chatPaneButtonEnabled = true
|
||||||
chatNotificator.mainWindowDeactivated()
|
chatNotificator.mainWindowDeactivated()
|
||||||
resultsTabListener.markAllTabsInvisible()
|
resultsTabListener.markAllTabsInvisible()
|
||||||
|
model.libraryTabVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
def showMonitorWindow = {
|
def showMonitorWindow = {
|
||||||
|
@ -1784,6 +1788,7 @@ class MainFrameView {
|
||||||
model.chatPaneButtonEnabled = true
|
model.chatPaneButtonEnabled = true
|
||||||
chatNotificator.mainWindowDeactivated()
|
chatNotificator.mainWindowDeactivated()
|
||||||
resultsTabListener.markAllTabsInvisible()
|
resultsTabListener.markAllTabsInvisible()
|
||||||
|
model.libraryTabVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
def showFeedsWindow = {
|
def showFeedsWindow = {
|
||||||
|
@ -1800,6 +1805,7 @@ class MainFrameView {
|
||||||
model.chatPaneButtonEnabled = true
|
model.chatPaneButtonEnabled = true
|
||||||
chatNotificator.mainWindowDeactivated()
|
chatNotificator.mainWindowDeactivated()
|
||||||
resultsTabListener.markAllTabsInvisible()
|
resultsTabListener.markAllTabsInvisible()
|
||||||
|
model.libraryTabVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
def showTrustWindow = {
|
def showTrustWindow = {
|
||||||
|
@ -1816,6 +1822,7 @@ class MainFrameView {
|
||||||
model.chatPaneButtonEnabled = true
|
model.chatPaneButtonEnabled = true
|
||||||
chatNotificator.mainWindowDeactivated()
|
chatNotificator.mainWindowDeactivated()
|
||||||
resultsTabListener.markAllTabsInvisible()
|
resultsTabListener.markAllTabsInvisible()
|
||||||
|
model.libraryTabVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
def showMessagesWindow = {
|
def showMessagesWindow = {
|
||||||
|
@ -1832,6 +1839,7 @@ class MainFrameView {
|
||||||
model.chatPaneButtonEnabled = true
|
model.chatPaneButtonEnabled = true
|
||||||
chatNotificator.mainWindowDeactivated()
|
chatNotificator.mainWindowDeactivated()
|
||||||
resultsTabListener.markAllTabsInvisible()
|
resultsTabListener.markAllTabsInvisible()
|
||||||
|
model.libraryTabVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
def showChatWindow = {
|
def showChatWindow = {
|
||||||
|
@ -1848,6 +1856,7 @@ class MainFrameView {
|
||||||
model.chatPaneButtonEnabled = false
|
model.chatPaneButtonEnabled = false
|
||||||
chatNotificator.mainWindowActivated()
|
chatNotificator.mainWindowActivated()
|
||||||
resultsTabListener.markAllTabsInvisible()
|
resultsTabListener.markAllTabsInvisible()
|
||||||
|
model.libraryTabVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
def showSharedFilesTable = {
|
def showSharedFilesTable = {
|
||||||
|
|
Loading…
Reference in New Issue