diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | .structs.go.swp | bin | 16384 -> 0 bytes | |||
| -rw-r--r-- | gui.go | 6 | ||||
| -rw-r--r-- | mainCloudBox.go | 11 | ||||
| -rw-r--r-- | structs.go | 2 |
5 files changed, 18 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/.structs.go.swp b/.structs.go.swp Binary files differdeleted file mode 100644 index 5f7effd..0000000 --- a/.structs.go.swp +++ /dev/null @@ -142,6 +142,12 @@ func mouseClick(b *ButtonMap) { createVmBox(Data.cloudTab, b.VM) } } + if (b.Action == "WINDOW CLOSE") { + b.W.Hide() + // TODO: fix this (seems to crash? maybe because we are in the button here?) + // b.W.Destroy() + return + } if (b.Action == "ADD") { log.Println("\tgui.mouseClick() SHOULD ADD VM HERE?") } diff --git a/mainCloudBox.go b/mainCloudBox.go index 8109c96..973d510 100644 --- a/mainCloudBox.go +++ b/mainCloudBox.go @@ -239,12 +239,19 @@ func ShowVM() { name := Data.CurrentVM.Name log.Println("ShowVM() START Data.CurrentVM=", Data.CurrentVM) VMwin := ui.NewWindow("VM " + name, 500, 300, false) + + // create a 'fake' button entry for the mouse clicks + var newButtonMap ButtonMap + newButtonMap.Action = "WINDOW CLOSE" + newButtonMap.W = VMwin + Data.AllButtons = append(Data.AllButtons, newButtonMap) + VMwin.OnClosing(func(*ui.Window) bool { + mouseClick(&newButtonMap) return true }) ui.OnShouldQuit(func() bool { - VMwin.Destroy() - VMwin = nil + mouseClick(&newButtonMap) return true }) @@ -101,6 +101,8 @@ type ButtonMap struct { B *ui.Button FB *ui.FontButton A *ui.Area + W *ui.Window + Account *pb.Account VM *pb.Event_VM Action string // what type of button |
