summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dnsLookupStatus.go1
-rw-r--r--gui.go69
-rw-r--r--hostnameStatus.go17
3 files changed, 10 insertions, 77 deletions
diff --git a/dnsLookupStatus.go b/dnsLookupStatus.go
index 6c366ff..79b51c9 100644
--- a/dnsLookupStatus.go
+++ b/dnsLookupStatus.go
@@ -93,7 +93,6 @@ func NewDigStatusWindow(p *gui.Node) *digStatus {
ds.hidden = true
ds.window = gadgets.NewBasicWindow(p, "DNS Resolver Status")
-
ds.window.Hide()
// summary of the current state of things
diff --git a/gui.go b/gui.go
index 8911ea3..8273a76 100644
--- a/gui.go
+++ b/gui.go
@@ -202,74 +202,11 @@ func mainWindow(title string) {
grid.NewLabel("DNS A =")
me.DnsA = grid.NewLabel("?")
- me.fix = me.mainStatus.NewButton("Fix", func () {
- if (goodHostname(me.hostname)) {
- log.Info("hostname is good:", me.hostname)
- } else {
- log.Warn("FIX: you need to fix your hostname here", me.hostname)
- return
- }
- // check to see if the cloudflare window exists
- /*
- if (me.cloudflareW != nil) {
- newRR.NameNode.SetText(me.hostname)
- newRR.TypeNode.SetText("AAAA")
- for s, t := range me.ipmap {
- if (t.IsReal()) {
- if (t.ipv6) {
- newRR.ValueNode.SetText(s)
- cloudflare.CreateCurlRR()
- return
- }
- }
- }
- cloudflare.CreateCurlRR()
- return
- } else {
- // nsupdate()
- // me.fixProc.Disable()
- }
- */
- })
- me.fix.Disable()
-
me.digStatus = NewDigStatusWindow(me.myGui)
+ me.hostnameStatus = NewHostnameStatusWindow(me.myGui)
- /*
- me.digStatusButton = me.mainStatus.NewButton("Resolver Status", func () {
- if (me.digStatus == nil) {
- log.Info("drawing the digStatus window START")
- me.digStatus = NewDigStatusWindow(me.myGui)
- log.Info("drawing the digStatus window END")
- me.digStatusButton.SetText("Hide DNS Lookup Status")
- me.digStatus.Update()
- return
- }
- if me.digStatus.hidden {
- me.digStatusButton.SetText("Hide Resolver Status")
- me.digStatus.Show()
- me.digStatus.Update()
- } else {
- me.digStatusButton.SetText("Resolver Status")
- me.digStatus.Hide()
- }
- })
- */
- me.hostnameStatusButton = me.mainStatus.NewButton("Show hostname DNS Status", func () {
- if (me.hostnameStatus == nil) {
- me.hostnameStatus = NewHostnameStatusWindow(me.myGui)
- me.hostnameStatusButton.SetText("Hide " + me.hostname + " DNS Status")
- me.hostnameStatus.Update()
- return
- }
- if me.hostnameStatus.hidden {
- me.hostnameStatusButton.SetText("Hide " + me.hostname + " DNS Status")
- me.hostnameStatus.Show()
- me.hostnameStatus.Update()
- } else {
- me.hostnameStatusButton.SetText("Show " + me.hostname + " DNS Status")
- me.hostnameStatus.Hide()
- }
+ me.hostnameStatusButton = me.mainStatus.NewButton("Fix hostname DNS", func () {
+ me.hostnameStatus.window.Toggle()
})
grid.Margin()
diff --git a/hostnameStatus.go b/hostnameStatus.go
index f396ba5..434411e 100644
--- a/hostnameStatus.go
+++ b/hostnameStatus.go
@@ -25,7 +25,7 @@ type hostnameStatus struct {
hostname string // my hostname. Example: "test.wit.com"
- window *gui.Node
+ window *gadgets.BasicWindow
// Primary Directives
status *gadgets.OneLiner
@@ -62,13 +62,10 @@ func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus {
hs.hidden = true
hs.hostname = me.hostname
- hs.window = p.NewWindow( hs.hostname + " Status")
- hs.window.Custom = func () {
- hs.hidden = true
- hs.window.Hide()
- }
- box := hs.window.NewBox("hBox", true)
- group := box.NewGroup("Summary")
+ hs.window = gadgets.NewBasicWindow(p, hs.hostname + " Status")
+ hs.window.Hide()
+
+ group := hs.window.Box().NewGroup("Summary")
grid := group.NewGrid("LookupStatus", 2, 2)
hs.status = gadgets.NewOneLiner(grid, "status").Set("unknown")
@@ -78,7 +75,7 @@ func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus {
group.Pad()
grid.Pad()
- group = box.NewGroup("Details")
+ group = hs.window.Box().NewGroup("Details")
grid = group.NewGrid("LookupDetails", 2, 2)
hs.hostShort = gadgets.NewOneLiner(grid, "hostname -s")
@@ -96,7 +93,7 @@ func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus {
group.Pad()
grid.Pad()
- group = box.NewGroup("Actions")
+ group = hs.window.Box().NewGroup("Actions")
grid = group.NewGrid("LookupDetails", 2, 2)
hs.dnsValue = grid.NewLabel("3.4.5.6")