Fix regression that prevented pinned items to update while window is open
This commit is contained in:
26
main.go
26
main.go
@@ -101,7 +101,7 @@ var (
|
|||||||
status string
|
status string
|
||||||
ignore string
|
ignore string
|
||||||
desktopTrigger bool
|
desktopTrigger bool
|
||||||
pinnedTrigger bool
|
pinnedItemsChanged chan interface{} = make(chan interface{}, 1)
|
||||||
)
|
)
|
||||||
|
|
||||||
func defaultStringIfBlank(s, fallback string) string {
|
func defaultStringIfBlank(s, fallback string) string {
|
||||||
@@ -494,9 +494,9 @@ func main() {
|
|||||||
// Check if showing the window has been requested (SIGUSR1)
|
// Check if showing the window has been requested (SIGUSR1)
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
<-showWindowChannel
|
select {
|
||||||
|
case <-showWindowChannel:
|
||||||
log.Debug("SHOW WINDOW")
|
log.Debug("Showing window")
|
||||||
glib.TimeoutAdd(0, func() bool {
|
glib.TimeoutAdd(0, func() bool {
|
||||||
if win != nil && !win.IsVisible() {
|
if win != nil && !win.IsVisible() {
|
||||||
|
|
||||||
@@ -510,14 +510,6 @@ func main() {
|
|||||||
desktopTrigger = false
|
desktopTrigger = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// pinned file changed
|
|
||||||
if pinnedTrigger {
|
|
||||||
log.Debug("pinned file changed")
|
|
||||||
pinnedTrigger = false
|
|
||||||
pinned, _ = loadTextFile(pinnedFile)
|
|
||||||
pinnedFlowBox = setUpPinnedFlowBox()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show window and focus the search box
|
// Show window and focus the search box
|
||||||
win.ShowAll()
|
win.ShowAll()
|
||||||
if fileSearchResultWrapper != nil {
|
if fileSearchResultWrapper != nil {
|
||||||
@@ -535,6 +527,16 @@ func main() {
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
case <-pinnedItemsChanged:
|
||||||
|
glib.TimeoutAdd(0, func() bool {
|
||||||
|
log.Debug("pinned file changed")
|
||||||
|
pinned, _ = loadTextFile(pinnedFile)
|
||||||
|
pinnedFlowBox = setUpPinnedFlowBox()
|
||||||
|
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ func watchFiles() {
|
|||||||
event.Op.String() == "RENAME") {
|
event.Op.String() == "RENAME") {
|
||||||
desktopTrigger = true
|
desktopTrigger = true
|
||||||
} else if event.Name == pinnedFile {
|
} else if event.Name == pinnedFile {
|
||||||
pinnedTrigger = true
|
// TODO: This can be used to propagate information about the changed file to the
|
||||||
|
// GUI to avoid recreating everything
|
||||||
|
pinnedItemsChanged <- struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
case err := <-watcher.Errors:
|
case err := <-watcher.Errors:
|
||||||
|
|||||||
Reference in New Issue
Block a user