repostatus/new.go

56 lines
1.1 KiB
Go
Raw Normal View History

2024-01-09 15:34:53 -06:00
package repostatus
import (
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/log"
2024-01-09 15:34:53 -06:00
)
var windowMap map[string]*RepoStatus
func ListAll() {
for path, rs := range windowMap {
log.Warn(rs.GetMasterVersion(), path)
}
}
func NewRepoStatusWindow(path string) *RepoStatus {
if windowMap[path] == nil {
log.Warn("This doesn't exist yet for path", path)
} else {
log.Warn("This already exists yet for path", path)
log.Warn("should return windowMap[path] here")
}
rs := New(gui.TreeRoot(), path)
windowMap[path] = rs
// todo check if a window already exists for this path
return rs
}
2024-01-09 15:34:53 -06:00
func New(p *gui.Node, path string) *RepoStatus {
rs := &RepoStatus{
hidden: true,
ready: false,
parent: p,
2024-01-09 15:34:53 -06:00
repopath: path,
}
rs.tags = make(map[string]string)
rs.window = gadgets.NewBasicWindow(p, "GO Repo Details "+path)
rs.window.Horizontal()
rs.window.Make()
2024-01-09 15:34:53 -06:00
rs.ready = true
rs.draw()
rs.window.Custom = func() {
// rs.hidden = true
rs.Hide()
log.Warn("repostatus user closed the window()")
}
windowMap[path] = rs
return rs
2024-01-09 15:34:53 -06:00
}
func init() {
windowMap = make(map[string]*RepoStatus)
}