summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui.go12
-rw-r--r--hostnameStatus.go2
-rw-r--r--linuxstatus/hostname.go45
3 files changed, 37 insertions, 22 deletions
diff --git a/gui.go b/gui.go
index 3f7fd10..c988ab4 100644
--- a/gui.go
+++ b/gui.go
@@ -44,7 +44,7 @@ func detailsTab(title string) {
// me.domainname = grid.NewLabel("domainname")
grid.NewLabel("hostname -s =")
- me.hostshort = grid.NewLabel("hostname -s")
+ grid.NewLabel("DEPRECATED")
grid.NewLabel("NS records =")
me.NSrr = grid.NewLabel("NS RR's")
@@ -227,17 +227,17 @@ func mainWindow(title string) {
me.details.Toggle()
})
gr.NewButton("linuxstatus.New()", func () {
- me.statusOS = linuxstatus.New()
+ if (me.statusOS == nil) {
+ me.statusOS = linuxstatus.New()
+ }
me.statusOS.SetParent(me.myGui)
me.statusOS.InitWindow()
+ me.statusOS.Make()
+ me.statusOS.Draw2()
})
gr.NewButton("statusOS.Ready()", func () {
me.statusOS.Ready()
})
- gr.NewButton("statusOS.Make()", func () {
- me.statusOS.Make()
- me.statusOS.Draw2()
- })
gr.NewButton("statusOS.Draw()", func () {
me.statusOS.Draw()
me.statusOS.Draw2()
diff --git a/hostnameStatus.go b/hostnameStatus.go
index bc13f6a..87347db 100644
--- a/hostnameStatus.go
+++ b/hostnameStatus.go
@@ -296,7 +296,7 @@ func (hs *hostnameStatus) updateStatus() {
var vals []string
log.Log(STATUS, "updateStatus() START")
- hs.hostShort.Set(me.hostshort.S)
+ hs.hostShort.Set(me.statusOS.GetHostShort())
hs.domainname.Set(me.statusOS.GetDomainName())
if hs.ValidHostname() {
diff --git a/linuxstatus/hostname.go b/linuxstatus/hostname.go
index 6853ba6..08c7971 100644
--- a/linuxstatus/hostname.go
+++ b/linuxstatus/hostname.go
@@ -22,21 +22,8 @@ func (ls *LinuxStatus) GetDomainName() string {
return me.domainname.Get()
}
-func (ls *LinuxStatus) setDomainName(dn string) {
+func (ls *LinuxStatus) setDomainName() {
if ! me.Ready() {return}
- me.domainname.Set(dn)
-}
-
-func lookupHostname() {
- if ! me.Ready() {return}
- var err error
- var s string = "gui.Label == nil"
- s, err = fqdn.FqdnHostname()
- if (err != nil) {
- log.Error(err, "FQDN hostname error")
- return
- }
- log.Error(errors.New("full hostname should be: " + s))
dn := run("domainname")
if me.window == nil {
@@ -47,16 +34,44 @@ func lookupHostname() {
}
if (me.domainname.Get() != dn) {
log.Log(CHANGE, "domainname has changed from", me.GetDomainName(), "to", dn)
- me.setDomainName(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() {
+ if ! me.Ready() {return}
+ var err error
+ var s string = "gui.Label == nil"
+ s, err = fqdn.FqdnHostname()
+ if (err != nil) {
+ log.Error(err, "FQDN hostname error")
+ return
+ }
+ log.Error(errors.New("full hostname should be: " + s))
+
+ me.setDomainName()
+
/*
var test string