CLEAN: more code cleanup

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2021-11-03 01:02:05 -05:00
parent eef2c0592f
commit 0dccc86000
2 changed files with 8 additions and 30 deletions

View File

@ -28,16 +28,9 @@ func mainWindow(w *gui.Node) *gui.Node {
tabResets(w)
g1.AddButton("www url's", func (*gui.Node) {
windowAddWWW(nil)
})
windowAddWWW(w)
////////////////////////// TABS ////////////////////////////////
g2 := newTab.AddGroup("Tabs")
g2.AddButton("GO language debuggging", func (*gui.Node) {
golangDebug(w)
})
golangDebug(w)
return newTab
}

View File

@ -1,11 +1,8 @@
package main
import "log"
// import "reflect"
import "git.wit.org/wit/gui"
import "github.com/skratchdot/open-golang/open"
func windowAddWWW(w *gui.Node) {
if (w == nil) {
gui.Config.Title = "webpages"
@ -14,20 +11,20 @@ func windowAddWWW(w *gui.Node) {
w = gui.NewWindow()
}
tab := w.AddTab("start www", nil)
tab := w.AddTab("http", nil)
////////////// connect /////////////////////////
gNode := tab.AddGroup("www")
urlButton(gNode, "git", "https://git.wit.org/")
urlButton(gNode, "mirrors", "https://mirrors.wit.org/")
urlButton(gNode, "ping.wit.com 6", "http://ping.wit.com/")
urlButton(gNode, "pprof localhost", "http://localhost:6060/debug/pprof/")
firefoxButton(gNode, "git", "https://git.wit.org/")
firefoxButton(gNode, "mirrors", "https://mirrors.wit.org/")
firefoxButton(gNode, "IPv6-Only ping", "http://ping.wit.org/")
firefoxButton(gNode, "SyncThing", "http://localhost:8384/")
firefoxButton(gNode, "pprof this GO app", "http://localhost:6060/debug/pprof/")
}
func firefoxButton (n *gui.Node, name string, url string) {
n.AddButton(name, func (*gui.Node) {
log.Println("button clicked: trying to open url")
// cmd := "--new-window http://192.168.100.1/"
var tmp []string
tmp = append(tmp, "nohup")
tmp = append(tmp, firefox...)
@ -36,15 +33,3 @@ func firefoxButton (n *gui.Node, name string, url string) {
})
// bNode.Dump()
}
func urlButton (n *gui.Node, name string, url string) {
if (useFirefox == true) {
firefoxButton(n, name, url)
} else {
bNode := n.AddButton(name, func (*gui.Node) {
log.Println("button clicked: trying to open url =", url)
open.Run(url)
})
bNode.Dump()
}
}