package main import ( "os" "go.wit.com/log" "go.wit.com/gui" "go.wit.com/lib/gadgets" "go.wit.com/lib/gui/cloudflare" ) // This setups up the dns control panel window func setupControlPanelWindow(title string) { } func makeMainWindow() { if me.window == nil { return } hbox := me.window.Box().NewBox("bw hbox", true) statusGrid(hbox) // some artificial padding to make the last row of buttons look less wierd group := hbox.NewGroup("Under Development") group.NewButton("Debug", func() { me.debug.Toggle() }) me.showErrorsB = group.NewCheckbox("Show Errors").SetChecked(true) me.showErrorsB.Custom = func() { if me.showErrorsB.Checked() { me.problems.Show() } else { me.problems.Hide() } } autofix := group.NewCheckbox("Auto-correct Errors").SetChecked(true) os.Setenv("DNS_AUTOCORRECT", "true") autofix.Custom = func() { if autofix.Checked() { os.Setenv("DNS_AUTOCORRECT", "true") } else { os.Unsetenv("DNS_AUTOCORRECT") } } } func statusGrid(n *gui.Node) { problems := n.NewGroup("status") grid := problems.RawGrid() grid.NewLabel("hostname =") me.hostnameStatus = grid.NewLabel("invalid") grid.NewButton("Linux Status", func() { me.statusOS.Toggle() }) grid.NextRow() me.statusIPv6 = gadgets.NewOneLiner(grid, "DNS Lookup") me.statusIPv6.SetText("known") grid.NewButton("resolver status", func() { if !me.digStatus.Ready() { return } me.digStatus.window.Toggle() }) grid.NextRow() grid.NewLabel("DNS Status") me.DnsStatus = grid.NewLabel("unknown") me.statusDNSbutton = grid.NewButton("hostname status", func() { if !me.statusDNS.Ready() { return } me.statusDNS.window.Toggle() }) grid.NextRow() grid.NewLabel("DNS API") me.DnsAPIstatus = grid.NewLabel("unknown") me.apiButton = grid.NewButton("unknown wit.com", func() { log.Log(CHANGE, "WHAT API ARE YOU USING?") provider := me.statusDNS.GetDNSapi() if provider == "cloudflare" { if me.witcom != nil { me.witcom.Toggle() } else { me.witcom = cloudflare.CreateRR(me.myGui, "wit.com", "3777302ac4a78cd7fa4f6d3f72086d06") } } }) grid.NextRow() } func myDefaultExit(n *gui.Node) { log.Println("You can Do exit() things here") os.Exit(0) }