diff --git a/gui-accountPage.go b/gui-accountPage.go index 750b872..0152d48 100644 --- a/gui-accountPage.go +++ b/gui-accountPage.go @@ -7,7 +7,7 @@ import "git.wit.com/wit/gui" func makeCloudInfoBox(gw *gui.GuiWindow) { log.Println("makeCloudInfoBox() START gw =", gw) - gw = gui.InitGuiWindow(gui.Data.Config, "makeCloudInfoBox() Box23", gw) + gw = gui.InitGuiWindow("makeCloudInfoBox() Box23", gw) box := gui.AddGenericBox(gw, "makeCloudInfoBox") log.Println("makeCloudInfoBox() START GW IS NOW: gw =", gw) @@ -15,7 +15,7 @@ func makeCloudInfoBox(gw *gui.GuiWindow) { gui.NewLabel(box, "Hostname:") - tmp := gui.Data.Hostname + " (" + gui.Data.IPv6 + ")" + tmp := config.Hostname + " (" + config.IPv6 + ")" gui.MakeEntryHbox(box, "hostname:", tmp, true, "Hostname") for key, a := range config.Accounts { diff --git a/gui-splashPage.go b/gui-splashPage.go index 398cac9..b7e13e3 100644 --- a/gui-splashPage.go +++ b/gui-splashPage.go @@ -25,7 +25,7 @@ func showSplashBox(gw *gui.GuiWindow) *gui.GuiBox { gui.NewLabel(box, "Version: " + VERSION) - if (config.Debug) { + if (gui.Config.Debug) { gui.NewLabel(box, "git rev-list: " + GITCOMMIT) gui.NewLabel(box, "go build version: " + GOVERSION) gui.NewLabel(box, "build date: " + BUILDTIME) @@ -68,7 +68,7 @@ func splashClick(b *gui.GuiButton) { return } // if there is not an account, then go to 'make account' - gw = gui.InitGuiWindow(config, "splashClick() Box22", gw) + gw = gui.InitGuiWindow("splashClick() Box22", gw) gw.UiTab.Delete(0) log.Println("addSubdomainQuestionBox() START") diff --git a/gui-vmPage.go b/gui-vmPage.go index ac51325..d01c4f2 100644 --- a/gui-vmPage.go +++ b/gui-vmPage.go @@ -88,7 +88,7 @@ func createAddVmBox(b *gui.GuiButton) { // gw.BoxMap["ADD VM" + name] = box txt := "ADD VM " + name - gw = gui.InitGuiWindow(config, txt, gw) + gw = gui.InitGuiWindow(txt, gw) box := gui.AddGenericBox(gw, name) // Add hostname entry box @@ -116,7 +116,7 @@ func createVmBox(gw *gui.GuiWindow, vm *pb.Event_VM) { log.Println("CreateVmBox() gw =", gw) txt := "createVmBox() " + vm.Name - gw = gui.InitGuiWindow(config, txt, gw) + gw = gui.InitGuiWindow(txt, gw) box := gui.AddGenericBox(gw, vm.Name) // Add hostname entry box diff --git a/main.go b/main.go index 7b8af65..1532adf 100644 --- a/main.go +++ b/main.go @@ -3,7 +3,6 @@ package main import "log" import "os" import "time" -import "os/user" // import "reflect" // this is the king of dns libraries @@ -87,8 +86,6 @@ func main() { for key, foo := range config.Accounts { log.Println("FOUND ACCOUNT = ", key, foo) } - // pass a pointer to the config so the gui can access it - gui.Data.Config = config initChannel() go processEvents() @@ -96,36 +93,28 @@ func main() { go gorillaDial("v000185.testing.com.customers.wprod.wit.com:9000") go gui.WatchGUI() - user, err := user.Current() - if err != nil { - onExit(err) - } - // use this to discover what the OS thinks it's hostname is // seems to be cross platform (?) // Windows: WMIC computersystem where caption='current_pc_name' rename new_pc_name hostname := FqdnGet() log.Println("fqdn.Get() = ", hostname) - gui.Data.Hostname = hostname + config.Hostname = hostname // this is a recursive dig for the AAAA record // TODO: check for dns hijacking ipAAAA := lookupAAAA(hostname) - gui.Data.IPv6 = ipAAAA + config.IPv6 = ipAAAA gui.Data.MouseClick = mainMouseClick - gui.Data.HomeDir = user.HomeDir + + gui.Config.Width = int(config.Width) + gui.Config.Height = int(config.Height) // Set output debugging level - gui.Data.Debug = config.Debug - gui.Data.DebugTable = config.Debugtable - log.Println("gui.Data.Debug = ", gui.Data.Debug) - log.Println("gui.Data.DebugTable = ", gui.Data.DebugTable) - - // Current User - log.Println("Hi " + user.Name + " (id: " + user.Uid + ")") - log.Println("Username: " + user.Username) - log.Println("Home Dir: " + user.HomeDir) + gui.Config.Debug = config.Debug + gui.Config.DebugTable = config.Debugtable + log.Println("gui.Config.Debug = ", gui.Config.Debug) + log.Println("gui.Config.DebugTable = ", gui.Config.DebugTable) // Get "Real" User under sudo. // More Info: https://stackoverflow.com/q/29733575/402585 @@ -133,7 +122,7 @@ func main() { // make this the main loop in an attempt to figure out the crashes // do not change this until the GUI is stable - gui.StartNewWindow(config, false, "SPLASH", showSplashBox) + gui.StartNewWindow(false, "SPLASH", showSplashBox) } // @@ -145,7 +134,7 @@ func main() { // In debugging mode, always panic() and never try to recover() // func r() { - if (gui.Data.Debug == false) { + if (gui.Config.Debug == false) { if r := recover(); r != nil { log.Println("recover() SOMETHING IS REALLY BROKEN r =", r) log.Println("recover() SOMETHING IS REALLY BROKEN r =", r)