repostatus/common.go

76 lines
1.2 KiB
Go

package repostatus
import (
"go.wit.com/log"
// "go.wit.com/gui/gui"
)
// 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
}
func (rs *RepoStatus) Draw() {
if !rs.Ready() {
return
}
log.Log(CHANGE, "Draw() window ready =", rs.ready)
rs.window.TestDraw()
// rs.window.Draw()
rs.ready = true
}
func (rs *RepoStatus) Show() {
if !rs.Ready() {
return
}
log.Log(CHANGE, "Show() window ready =", rs.ready)
rs.window.Show()
rs.hidden = false
}
func (rs *RepoStatus) Hide() {
if !rs.Ready() {
return
}
log.Log(CHANGE, "Hide() window ready =", rs.ready)
rs.window.Hide()
rs.hidden = true
}
func (rs *RepoStatus) Toggle() {
if !rs.Ready() {
return
}
log.Log(CHANGE, "Toggle() window ready =", rs.ready)
if rs.hidden {
rs.Show()
} else {
rs.Hide()
}
}
func (rs *RepoStatus) Ready() bool {
if rs == nil {
return false
}
if rs.window == nil {
return false
}
return rs.ready
}
/*
func (rs *RepoStatus) Initialized() bool {
log.Log(CHANGE, "checking Initialized()")
if rs == nil {return false}
if rs.parent == nil {return false}
return true
}
*/