63 lines
1.4 KiB
Go
63 lines
1.4 KiB
Go
package repowindow
|
|
|
|
import (
|
|
"go.wit.com/gui"
|
|
"go.wit.com/lib/gui/repolist"
|
|
"go.wit.com/log"
|
|
)
|
|
|
|
func hideFunction(r *repolist.Repo) {
|
|
if r.Status.IsDirty() {
|
|
r.Show()
|
|
return
|
|
}
|
|
if me.autoHideReadOnly.Checked() {
|
|
if r.Status.ReadOnly() {
|
|
r.Hide()
|
|
return
|
|
}
|
|
}
|
|
if me.autoHidePerfect.Checked() {
|
|
if r.IsPerfect() {
|
|
r.Hide()
|
|
return
|
|
}
|
|
}
|
|
r.Show()
|
|
}
|
|
|
|
func globalDisplayOptions(vbox *gui.Node) {
|
|
group1 := vbox.NewGroup("Global Display Options")
|
|
|
|
group1.NewButton("Show Repository Window", func() {
|
|
// globalDisplaySetRepoState()
|
|
if me.repos.Hidden() {
|
|
me.repos.Show()
|
|
} else {
|
|
me.repos.Hide()
|
|
}
|
|
})
|
|
|
|
me.autoHideReadOnly = group1.NewCheckbox("Hide read-only repos").SetChecked(true)
|
|
me.autoHideReadOnly.Custom = func() {
|
|
me.repos.View.RegisterHideFunction(hideFunction)
|
|
me.repos.View.ScanRepositories()
|
|
}
|
|
|
|
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
|
|
me.autoHidePerfect.Custom = func() {
|
|
me.repos.View.RegisterHideFunction(hideFunction)
|
|
me.repos.View.ScanRepositories()
|
|
}
|
|
scanbox := group1.Box().Horizontal()
|
|
me.autoScanReposCB = scanbox.NewCheckbox("auto scan").SetChecked(true)
|
|
me.autoScanReposCB.Custom = func() {
|
|
me.repos.View.SetAutoScan(me.autoScanReposCB.Checked())
|
|
}
|
|
scanbox.NewButton("scan now", func() {
|
|
log.Info("re-scanning repos now")
|
|
i, s := me.repos.View.ScanRepositories()
|
|
log.Info("re-scanning repos done", i, s)
|
|
})
|
|
}
|