fix GTK warnings on pinned cache not found #6

This commit is contained in:
piotr 2021-07-12 23:23:52 +02:00
parent 27718a9f1b
commit eb358b24cd
2 changed files with 8 additions and 6 deletions

View File

@ -172,6 +172,7 @@ func main() {
if err != nil {
pinned = nil
}
println(fmt.Sprintf("Found %v pinned items", len(pinned)))
cssFile := filepath.Join(configDirectory, *cssFileName)

View File

@ -17,7 +17,7 @@ func setUpPinnedFlowBox() *gtk.FlowBox {
flowBox, _ := gtk.FlowBoxNew()
if uint(len(pinned)) >= *columnsNumber {
flowBox.SetMaxChildrenPerLine(*columnsNumber)
} else {
} else if len(pinned) > 0 {
flowBox.SetMaxChildrenPerLine(uint(len(pinned)))
}
@ -78,16 +78,17 @@ func setUpPinnedFlowBox() *gtk.FlowBox {
})
flowBox.Add(btn)
}
pinnedFlowBoxWrapper.PackStart(flowBox, true, false, 0)
//While moving focus with arrow keys we want buttons to get focus directly
flowBox.GetChildren().Foreach(func(item interface{}) {
item.(*gtk.Widget).SetCanFocus(false)
})
}
flowBox.Connect("enter-notify-event", func() {
cancelClose()
})
pinnedFlowBoxWrapper.PackStart(flowBox, true, false, 0)
//While moving focus with arrow keys we want buttons to get focus directly
flowBox.GetChildren().Foreach(func(item interface{}) {
item.(*gtk.Widget).SetCanFocus(false)
})
flowBox.ShowAll()
return flowBox