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