better names with Init() vs New()
This commit is contained in:
parent
fd082d4965
commit
7b4eb41de7
|
@ -11,6 +11,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var args struct {
|
var args struct {
|
||||||
|
Daemon bool `arg:"--daemon" help:"run without a gui"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
|
@ -46,13 +46,14 @@ func makeMainWindow() {
|
||||||
func statusGrid(n *gui.Node) {
|
func statusGrid(n *gui.Node) {
|
||||||
problems := n.NewGroup("status")
|
problems := n.NewGroup("status")
|
||||||
|
|
||||||
grid := problems.NewGrid("nuts", 3, 1)
|
grid := problems.RawGrid()
|
||||||
|
|
||||||
grid.NewLabel("hostname =")
|
grid.NewLabel("hostname =")
|
||||||
me.hostnameStatus = grid.NewLabel("invalid")
|
me.hostnameStatus = grid.NewLabel("invalid")
|
||||||
grid.NewButton("Linux Status", func() {
|
grid.NewButton("Linux Status", func() {
|
||||||
me.statusOS.Toggle()
|
me.statusOS.Toggle()
|
||||||
})
|
})
|
||||||
|
grid.NextRow()
|
||||||
|
|
||||||
me.statusIPv6 = gadgets.NewOneLiner(grid, "DNS Lookup")
|
me.statusIPv6 = gadgets.NewOneLiner(grid, "DNS Lookup")
|
||||||
me.statusIPv6.SetText("known")
|
me.statusIPv6.SetText("known")
|
||||||
|
@ -62,6 +63,7 @@ func statusGrid(n *gui.Node) {
|
||||||
}
|
}
|
||||||
me.digStatus.window.Toggle()
|
me.digStatus.window.Toggle()
|
||||||
})
|
})
|
||||||
|
grid.NextRow()
|
||||||
|
|
||||||
grid.NewLabel("DNS Status")
|
grid.NewLabel("DNS Status")
|
||||||
me.DnsStatus = grid.NewLabel("unknown")
|
me.DnsStatus = grid.NewLabel("unknown")
|
||||||
|
@ -71,6 +73,7 @@ func statusGrid(n *gui.Node) {
|
||||||
}
|
}
|
||||||
me.statusDNS.window.Toggle()
|
me.statusDNS.window.Toggle()
|
||||||
})
|
})
|
||||||
|
grid.NextRow()
|
||||||
|
|
||||||
grid.NewLabel("DNS API")
|
grid.NewLabel("DNS API")
|
||||||
me.DnsAPIstatus = grid.NewLabel("unknown")
|
me.DnsAPIstatus = grid.NewLabel("unknown")
|
||||||
|
@ -85,6 +88,7 @@ func statusGrid(n *gui.Node) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
grid.NextRow()
|
||||||
}
|
}
|
||||||
|
|
||||||
func myDefaultExit(n *gui.Node) {
|
func myDefaultExit(n *gui.Node) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ type digStatus struct {
|
||||||
statusHTTP *gadgets.OneLiner
|
statusHTTP *gadgets.OneLiner
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDigStatusWindow() *digStatus {
|
func InitDigStatus() *digStatus {
|
||||||
var ds *digStatus
|
var ds *digStatus
|
||||||
ds = new(digStatus)
|
ds = new(digStatus)
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ type anError struct {
|
||||||
problem *Problem
|
problem *Problem
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewErrorBox(p *gui.Node, name string, ip string) *errorBox {
|
func InitErrorBox(p *gui.Node, name string, ip string) *errorBox {
|
||||||
var eb *errorBox
|
var eb *errorBox
|
||||||
eb = new(errorBox)
|
eb = new(errorBox)
|
||||||
eb.parent = p
|
eb.parent = p
|
||||||
|
|
|
@ -56,7 +56,7 @@ type hostnameStatus struct {
|
||||||
// dnsAction *gui.Node
|
// dnsAction *gui.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHostnameStatusWindow() *hostnameStatus {
|
func InitHostnameStatus() *hostnameStatus {
|
||||||
var hs *hostnameStatus
|
var hs *hostnameStatus
|
||||||
hs = new(hostnameStatus)
|
hs = new(hostnameStatus)
|
||||||
|
|
||||||
|
|
10
main.go
10
main.go
|
@ -46,17 +46,17 @@ func main() {
|
||||||
makeMainWindow()
|
makeMainWindow()
|
||||||
|
|
||||||
// These are your problems
|
// These are your problems
|
||||||
me.problems = NewErrorBox(me.window.Box(), "Errors", "has problems?")
|
me.problems = InitErrorBox(me.window.Box(), "Errors", "has problems?")
|
||||||
me.problems.addIPerror(RR, USER, "1:1:1:1")
|
me.problems.addIPerror(RR, USER, "1:1:1:1")
|
||||||
|
|
||||||
me.window.Show()
|
me.window.Show()
|
||||||
|
|
||||||
me.debug = debugWindow("Debugging")
|
me.debug = debugWindow("Debugging")
|
||||||
|
|
||||||
me.digStatus = NewDigStatusWindow()
|
// 3 external windows that should be seperate go packages
|
||||||
me.statusDNS = NewHostnameStatusWindow()
|
me.digStatus = InitDigStatus()
|
||||||
|
me.statusDNS = InitHostnameStatus()
|
||||||
me.statusOS = linuxstatus.NewLinuxStatus(me.myGui)
|
me.statusOS = linuxstatus.InitLinuxStatus()
|
||||||
|
|
||||||
digLoop()
|
digLoop()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue