more isolation of Update() pieces
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
398d9fe3c4
commit
ba3d5a3cb2
10
gui.go
10
gui.go
|
@ -44,7 +44,7 @@ func detailsTab(title string) {
|
||||||
// me.domainname = grid.NewLabel("domainname")
|
// me.domainname = grid.NewLabel("domainname")
|
||||||
|
|
||||||
grid.NewLabel("hostname -s =")
|
grid.NewLabel("hostname -s =")
|
||||||
me.hostshort = grid.NewLabel("hostname -s")
|
grid.NewLabel("DEPRECATED")
|
||||||
|
|
||||||
grid.NewLabel("NS records =")
|
grid.NewLabel("NS records =")
|
||||||
me.NSrr = grid.NewLabel("NS RR's")
|
me.NSrr = grid.NewLabel("NS RR's")
|
||||||
|
@ -227,17 +227,17 @@ func mainWindow(title string) {
|
||||||
me.details.Toggle()
|
me.details.Toggle()
|
||||||
})
|
})
|
||||||
gr.NewButton("linuxstatus.New()", func () {
|
gr.NewButton("linuxstatus.New()", func () {
|
||||||
|
if (me.statusOS == nil) {
|
||||||
me.statusOS = linuxstatus.New()
|
me.statusOS = linuxstatus.New()
|
||||||
|
}
|
||||||
me.statusOS.SetParent(me.myGui)
|
me.statusOS.SetParent(me.myGui)
|
||||||
me.statusOS.InitWindow()
|
me.statusOS.InitWindow()
|
||||||
|
me.statusOS.Make()
|
||||||
|
me.statusOS.Draw2()
|
||||||
})
|
})
|
||||||
gr.NewButton("statusOS.Ready()", func () {
|
gr.NewButton("statusOS.Ready()", func () {
|
||||||
me.statusOS.Ready()
|
me.statusOS.Ready()
|
||||||
})
|
})
|
||||||
gr.NewButton("statusOS.Make()", func () {
|
|
||||||
me.statusOS.Make()
|
|
||||||
me.statusOS.Draw2()
|
|
||||||
})
|
|
||||||
gr.NewButton("statusOS.Draw()", func () {
|
gr.NewButton("statusOS.Draw()", func () {
|
||||||
me.statusOS.Draw()
|
me.statusOS.Draw()
|
||||||
me.statusOS.Draw2()
|
me.statusOS.Draw2()
|
||||||
|
|
|
@ -296,7 +296,7 @@ func (hs *hostnameStatus) updateStatus() {
|
||||||
var vals []string
|
var vals []string
|
||||||
log.Log(STATUS, "updateStatus() START")
|
log.Log(STATUS, "updateStatus() START")
|
||||||
|
|
||||||
hs.hostShort.Set(me.hostshort.S)
|
hs.hostShort.Set(me.statusOS.GetHostShort())
|
||||||
hs.domainname.Set(me.statusOS.GetDomainName())
|
hs.domainname.Set(me.statusOS.GetDomainName())
|
||||||
|
|
||||||
if hs.ValidHostname() {
|
if hs.ValidHostname() {
|
||||||
|
|
|
@ -22,9 +22,41 @@ func (ls *LinuxStatus) GetDomainName() string {
|
||||||
return me.domainname.Get()
|
return me.domainname.Get()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ls *LinuxStatus) setDomainName(dn string) {
|
func (ls *LinuxStatus) setDomainName() {
|
||||||
if ! me.Ready() {return}
|
if ! me.Ready() {return}
|
||||||
|
|
||||||
|
dn := run("domainname")
|
||||||
|
if me.window == nil {
|
||||||
|
log.Log(NOW, "me.window == nil")
|
||||||
|
} else {
|
||||||
|
log.Log(NOW, "me.window exists, but has not been drawn")
|
||||||
|
log.Log(NOW, "me.window.Draw() =")
|
||||||
|
}
|
||||||
|
if (me.domainname.Get() != dn) {
|
||||||
|
log.Log(CHANGE, "domainname has changed from", me.GetDomainName(), "to", dn)
|
||||||
me.domainname.Set(dn)
|
me.domainname.Set(dn)
|
||||||
|
me.changed = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ls *LinuxStatus) GetHostShort() string {
|
||||||
|
if ! me.Ready() {return ""}
|
||||||
|
if me.window == nil {
|
||||||
|
log.Log(NOW, "me.window == nil")
|
||||||
|
} else {
|
||||||
|
log.Log(NOW, "me.window exists, but has not been drawn")
|
||||||
|
}
|
||||||
|
return me.hostshort.Get()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ls *LinuxStatus) setHostShort() {
|
||||||
|
if ! me.Ready() {return ""}
|
||||||
|
hshort := run("hostname -s")
|
||||||
|
if (me.hostshort.Get() != hshort) {
|
||||||
|
log.Log(CHANGE, "hostname -s has changed from", me.hostshort.Get(), "to", hshort)
|
||||||
|
me.hostshort.Set(hshort)
|
||||||
|
me.changed = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func lookupHostname() {
|
func lookupHostname() {
|
||||||
|
@ -38,25 +70,8 @@ func lookupHostname() {
|
||||||
}
|
}
|
||||||
log.Error(errors.New("full hostname should be: " + s))
|
log.Error(errors.New("full hostname should be: " + s))
|
||||||
|
|
||||||
dn := run("domainname")
|
me.setDomainName()
|
||||||
if me.window == nil {
|
|
||||||
log.Log(NOW, "me.window == nil")
|
|
||||||
} else {
|
|
||||||
log.Log(NOW, "me.window exists, but has not been drawn")
|
|
||||||
log.Log(NOW, "me.window.Draw() =")
|
|
||||||
}
|
|
||||||
if (me.domainname.Get() != dn) {
|
|
||||||
log.Log(CHANGE, "domainname has changed from", me.GetDomainName(), "to", dn)
|
|
||||||
me.setDomainName(dn)
|
|
||||||
me.changed = true
|
|
||||||
}
|
|
||||||
|
|
||||||
hshort := run("hostname -s")
|
|
||||||
if (me.hostshort.Get() != hshort) {
|
|
||||||
log.Log(CHANGE, "hostname -s has changed from", me.hostshort.Get(), "to", hshort)
|
|
||||||
me.hostshort.Set(hshort)
|
|
||||||
me.changed = true
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
var test string
|
var test string
|
||||||
|
|
Loading…
Reference in New Issue