-nocats to disable filtering by categories

This commit is contained in:
piotr
2021-08-16 22:41:13 +02:00
parent 83caef28f6
commit f9e9608dfc
2 changed files with 11 additions and 5 deletions

Binary file not shown.

View File

@@ -90,6 +90,7 @@ var (
fileSearchResultWrapper *gtk.Box fileSearchResultWrapper *gtk.Box
pinnedFlowBox *gtk.FlowBox pinnedFlowBox *gtk.FlowBox
pinnedFlowBoxWrapper *gtk.Box pinnedFlowBoxWrapper *gtk.Box
categoriesWrapper *gtk.Box
catButtons []*gtk.Button catButtons []*gtk.Button
statusLabel *gtk.Label statusLabel *gtk.Label
status string status string
@@ -109,6 +110,7 @@ var lang = flag.String("lang", "", "force lang, e.g. \"en\", \"pl\"")
var fileManager = flag.String("fm", "thunar", "File Manager") var fileManager = flag.String("fm", "thunar", "File Manager")
var term = flag.String("term", "alacritty", "Terminal emulator") var term = flag.String("term", "alacritty", "Terminal emulator")
var nameLimit = flag.Int("fslen", 80, "File Search name length Limit") var nameLimit = flag.Int("fslen", 80, "File Search name length Limit")
var noCats = flag.Bool("nocats", false, "Disable filtering by category")
func main() { func main() {
timeStart := time.Now() timeStart := time.Now()
@@ -299,10 +301,12 @@ func main() {
searchEntry.SetMaxWidthChars(30) searchEntry.SetMaxWidthChars(30)
searchBoxWrapper.PackStart(searchEntry, true, false, 0) searchBoxWrapper.PackStart(searchEntry, true, false, 0)
categoriesWrapper, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0) if !*noCats {
categoriesWrapper, _ = gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0)
categoriesButtonBox := setUpCategoriesButtonBox() categoriesButtonBox := setUpCategoriesButtonBox()
categoriesWrapper.PackStart(categoriesButtonBox, true, false, 0) categoriesWrapper.PackStart(categoriesButtonBox, true, false, 0)
outerVBox.PackStart(categoriesWrapper, false, false, 0) outerVBox.PackStart(categoriesWrapper, false, false, 0)
}
pinnedWrapper, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0) pinnedWrapper, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0)
outerVBox.PackStart(pinnedWrapper, false, false, 0) outerVBox.PackStart(pinnedWrapper, false, false, 0)
@@ -355,7 +359,9 @@ func main() {
win.ShowAll() win.ShowAll()
fileSearchResultWrapper.SetSizeRequest(appFlowBox.GetAllocatedWidth(), 1) fileSearchResultWrapper.SetSizeRequest(appFlowBox.GetAllocatedWidth(), 1)
if !*noCats {
categoriesWrapper.SetSizeRequest(1, categoriesWrapper.GetAllocatedHeight()*2) categoriesWrapper.SetSizeRequest(1, categoriesWrapper.GetAllocatedHeight()*2)
}
fileSearchResultWrapper.Hide() fileSearchResultWrapper.Hide()
t := time.Now() t := time.Now()