From fd082d49659c722776d72b97b9eca9d4aab8b78e Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 21 Feb 2024 10:34:13 -0600 Subject: [PATCH] fixes for GUI API changes Signed-off-by: Jeff Carr --- controlPanelWindow.go | 25 +++++-------------------- digStatusWindow.go | 4 ++-- hostnameStatusWindow.go | 4 ++-- main.go | 32 ++++++++++++++------------------ 4 files changed, 23 insertions(+), 42 deletions(-) diff --git a/controlPanelWindow.go b/controlPanelWindow.go index 3392321..827e6c3 100644 --- a/controlPanelWindow.go +++ b/controlPanelWindow.go @@ -12,26 +12,6 @@ import ( // This setups up the dns control panel window func setupControlPanelWindow(title string) { - log.Info("artificial sleep of:", me.artificialSleep) - log.Sleep(me.artificialSleep) - - // setup the main tab - me.window = gadgets.NewBasicWindow(me.myGui, title) - me.window.Vertical() - me.window.Make() - - makeMainWindow() - - // These are your problems - me.problems = NewErrorBox(me.window.Box(), "Errors", "has problems?") - me.problems.addIPerror(RR, USER, "1:1:1:1") - - me.window.Draw() -} - -func myDefaultExit(n *gui.Node) { - log.Println("You can Do exit() things here") - os.Exit(0) } func makeMainWindow() { @@ -106,3 +86,8 @@ func statusGrid(n *gui.Node) { } }) } + +func myDefaultExit(n *gui.Node) { + log.Println("You can Do exit() things here") + os.Exit(0) +} diff --git a/digStatusWindow.go b/digStatusWindow.go index dce5b71..a0917f5 100644 --- a/digStatusWindow.go +++ b/digStatusWindow.go @@ -55,14 +55,14 @@ type digStatus struct { statusHTTP *gadgets.OneLiner } -func NewDigStatusWindow(p *gui.Node) *digStatus { +func NewDigStatusWindow() *digStatus { var ds *digStatus ds = new(digStatus) ds.ready = false ds.hidden = true - ds.window = gadgets.NewBasicWindow(p, "DNS Resolver Status") + ds.window = gadgets.RawBasicWindow("DNS Resolver Status") ds.window.Make() // ds.window.Draw() // ds.window.Hide() diff --git a/hostnameStatusWindow.go b/hostnameStatusWindow.go index 04f75d4..6a88fae 100644 --- a/hostnameStatusWindow.go +++ b/hostnameStatusWindow.go @@ -56,7 +56,7 @@ type hostnameStatus struct { // dnsAction *gui.Node } -func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus { +func NewHostnameStatusWindow() *hostnameStatus { var hs *hostnameStatus hs = new(hostnameStatus) @@ -64,7 +64,7 @@ func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus { hs.hidden = true // hs.hostname = me.hostname - hs.window = gadgets.NewBasicWindow(p, "fix hostname here"+" Status") + hs.window = gadgets.RawBasicWindow("fix hostname here"+" Status") hs.window.Make() // hs.window.Draw() // hs.window.Hide() diff --git a/main.go b/main.go index c7d9cf5..c220754 100644 --- a/main.go +++ b/main.go @@ -11,9 +11,9 @@ import ( "time" "go.wit.com/gui" - "go.wit.com/lib/debugger" "go.wit.com/log" + "go.wit.com/lib/gadgets" "go.wit.com/lib/gui/linuxstatus" "github.com/miekg/dns" @@ -39,29 +39,25 @@ func main() { me.myGui.InitEmbed(resToolkit) me.myGui.Default() - // setup the main window - setupControlPanelWindow("DNS and IPv6 Control Panel") + // setup the main tab + me.window = gadgets.RawBasicWindow("DNS and IPv6 Control Panel") + me.window.Make() + + makeMainWindow() + + // These are your problems + me.problems = NewErrorBox(me.window.Box(), "Errors", "has problems?") + me.problems.addIPerror(RR, USER, "1:1:1:1") + + me.window.Show() me.debug = debugWindow("Debugging") - // TODO: track this bug down - log.Sleep(1) - me.window.Toggle() - log.Sleep(1) - me.window.Toggle() - - me.digStatus = NewDigStatusWindow(me.myGui) - me.statusDNS = NewHostnameStatusWindow(me.myGui) + me.digStatus = NewDigStatusWindow() + me.statusDNS = NewHostnameStatusWindow() me.statusOS = linuxstatus.NewLinuxStatus(me.myGui) - if debugger.ArgDebug() { - go func() { - log.Sleep(2) - debugger.DebugWindow() - }() - } - digLoop() // TCP & UDP port 53 lookups + DNS over HTTP lookups + os.Exec(dig)