repostatus/common.go

72 lines
1.1 KiB
Go
Raw Normal View History

2024-01-09 15:34:53 -06:00
package repostatus
import (
2024-01-09 15:34:53 -06:00
"go.wit.com/log"
// "go.wit.com/gui/gui"
2024-01-09 15:34:53 -06:00
)
// reports externally if something has changed
// since the last time it was asked about it
func (rs *RepoStatus) Changed() bool {
if !rs.Ready() {
return false
}
return rs.changed
2024-01-09 15:34:53 -06:00
}
func (rs *RepoStatus) Draw() {
if !rs.Ready() {
return
}
log.Log(CHANGE, "Draw() window ready =", rs.ready)
rs.window.TestDraw()
2024-01-09 15:34:53 -06:00
}
2024-01-13 20:30:33 -06:00
func (rs *RepoStatus) Show() {
if !rs.Ready() {
return
}
log.Log(CHANGE, "Show() window ready =", rs.ready)
rs.window.Show()
2024-01-09 15:34:53 -06:00
}
func (rs *RepoStatus) Hide() {
if !rs.Ready() {
return
}
log.Log(CHANGE, "Hide() window ready =", rs.ready)
rs.window.Hide()
2024-01-09 15:34:53 -06:00
}
func (rs *RepoStatus) Toggle() {
if !rs.Ready() {
return
}
log.Log(CHANGE, "Toggle() window ready =", rs.ready)
if rs.window.Hidden() {
rs.Show()
2024-01-09 15:34:53 -06:00
} else {
rs.Hide()
2024-01-09 15:34:53 -06:00
}
}
func (rs *RepoStatus) Ready() bool {
if rs == nil {
return false
}
if rs.window == nil {
return false
}
return rs.ready
2024-01-09 15:34:53 -06:00
}
/*
func (rs *RepoStatus) Initialized() bool {
2024-01-09 15:34:53 -06:00
log.Log(CHANGE, "checking Initialized()")
if rs == nil {return false}
if rs.parent == nil {return false}
2024-01-09 15:34:53 -06:00
return true
}
*/