package repostatus import ( "go.wit.com/log" ) // reports externally if something has changed // since the last time it was asked about it func (rs *RepoStatus) Changed() (string, bool) { if !rs.Ready() { return "", false } return rs.getChanges(), rs.changed } // keeps a human readable list of things that have // changed. todo: timestampe these? func (rs *RepoStatus) getChanges() string { return rs.changes } func (rs *RepoStatus) NoteChange(s string) { rs.changed = true rs.changes += s + "\n" } func (rs *RepoStatus) Show() { if !rs.Ready() { return } log.Log(CHANGE, "Show() window ready =", rs.ready) rs.window.Show() } func (rs *RepoStatus) Hide() { if !rs.Ready() { return } log.Log(CHANGE, "Hide() window ready =", rs.ready) rs.window.Hide() } func (rs *RepoStatus) Toggle() { if !rs.Ready() { return } log.Log(CHANGE, "Toggle() window ready =", rs.ready) if rs.window.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 }