64 lines
1.0 KiB
Go
64 lines
1.0 KiB
Go
// This creates a simple hello world window
|
|
package linuxstatus
|
|
|
|
import (
|
|
"go.wit.com/log"
|
|
)
|
|
|
|
// reports externally if something has changed
|
|
// since the last time it was asked about it
|
|
func (ls *LinuxStatus) Changed() bool {
|
|
if !ls.Ready() {
|
|
return false
|
|
}
|
|
if ls.changed {
|
|
ls.changed = false
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (ls *LinuxStatus) Show() {
|
|
if !ls.Ready() {
|
|
return
|
|
}
|
|
log.Log(CHANGE, "Show() window ready =", ls.ready)
|
|
ls.window.Show()
|
|
ls.hidden = false
|
|
}
|
|
|
|
func (ls *LinuxStatus) Hide() {
|
|
if !ls.Ready() {
|
|
return
|
|
}
|
|
log.Log(CHANGE, "Hide() window ready =", ls.ready)
|
|
ls.window.Hide()
|
|
ls.hidden = true
|
|
}
|
|
|
|
func (ls *LinuxStatus) Toggle() {
|
|
if !ls.Ready() {
|
|
return
|
|
}
|
|
log.Log(CHANGE, "Toggle() window ready =", ls.ready)
|
|
if ls.hidden {
|
|
ls.Show()
|
|
} else {
|
|
ls.Hide()
|
|
}
|
|
}
|
|
|
|
func (ls *LinuxStatus) Ready() bool {
|
|
log.Log(SPEW, "Ready() maybe not ready? ls =", ls)
|
|
if me == nil {
|
|
return false
|
|
}
|
|
if ls == nil {
|
|
return false
|
|
}
|
|
if ls.window == nil {
|
|
return false
|
|
}
|
|
return me.ready
|
|
}
|