wit-debian-gui/window-ssh-generic.go

67 lines
1.4 KiB
Go

package main
import "log"
import "os/user"
// import "reflect"
import "git.wit.org/wit/gui"
var userNode *gui.Node
func sshGenericWindow(w *gui.Node) {
if (w == nil) {
gui.Config.Title = "sshWindow"
gui.Config.Width = 101
gui.Config.Height = 131
gui.Config.Exit = customExit
w = gui.NewWindow()
}
tab := w.AddTab("sshWindow()", nil)
// populateNEW(tab, "new")
////////////// username /////////////////////////
gNode := tab.AddGroup("username")
userNode = gNode.AddComboBox("username",
"root",
"jcarr",
"hugo")
userNode.OnChanged = func () {
username = userNode.GetText()
log.Println("SETTING: username=", username)
userNode.Dump()
// panic("blah")
}
tmp, _ := user.Current()
username = tmp.Username
userNode.SetText(username)
userNode.Dump()
// panic("blah")
////////////// hostname /////////////////////////
gNode = tab.AddGroup("homename")
hostNode := gNode.AddComboBox("hostname",
"www",
"mirrors",
"git")
hostNode.OnChanged = func () {
log.Println("STARTED HOSTNAME")
hostname = hostNode.GetText()
log.Println("ENDED GetText() HOSTNAME")
}
hostname = "mirrors"
hostNode.SetText("mirrors")
////////////// connect /////////////////////////
gNode = tab.AddGroup("connect")
gNode.AddButton("connect", func (*gui.Node) {
cmd := "ssh -v " + username + "@" + hostname
log.Println("xterm cmd=", cmd)
xterm(cmd)
})
}