package repostatus import ( "go.wit.com/gui" "go.wit.com/lib/gadgets" "go.wit.com/log" ) 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 } func New(p *gui.Node, path string) *RepoStatus { rs := &RepoStatus{ hidden: true, ready: false, parent: p, repopath: path, } rs.tags = make(map[string]string) rs.window = gadgets.NewBasicWindow(p, "GO Repo Details "+path) rs.window.Horizontal() rs.window.Make() 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 } func init() { windowMap = make(map[string]*RepoStatus) }