summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.structs.go.swpbin16384 -> 0 bytes
-rw-r--r--gui.go6
-rw-r--r--mainCloudBox.go11
-rw-r--r--structs.go2
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
deleted file mode 100644
index 5f7effd..0000000
--- a/.structs.go.swp
+++ /dev/null
Binary files differ
diff --git a/gui.go b/gui.go
index 36d297e..9199eca 100644
--- a/gui.go
+++ b/gui.go
@@ -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
})
diff --git a/structs.go b/structs.go
index 903034d..b5377ee 100644
--- a/structs.go
+++ b/structs.go
@@ -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