summaryrefslogtreecommitdiff
path: root/digitalocean/mainWindow.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-12-30 12:20:20 -0600
committerJeff Carr <[email protected]>2023-12-30 12:20:20 -0600
commita117923b327d0d5a74ef64b51082e2ec4bcd9cfd (patch)
treedc8987c5f9e4cd51063951618df686f000716ec8 /digitalocean/mainWindow.go
parent7532fb5ff5d0178bb9b1cf0a1cd6ba7c30bb7c2b (diff)
show droplets
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'digitalocean/mainWindow.go')
-rw-r--r--digitalocean/mainWindow.go65
1 files changed, 0 insertions, 65 deletions
diff --git a/digitalocean/mainWindow.go b/digitalocean/mainWindow.go
deleted file mode 100644
index 6bffaf5..0000000
--- a/digitalocean/mainWindow.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package digitalocean
-
-import (
- "os"
- "go.wit.com/log"
- "go.wit.com/gui"
-)
-
-var myDo *DigitalOcean
-
-// This is initializes the main DO object
-// You can only have one of these
-func New(p *gui.Node) *DigitalOcean {
- if myDo != nil {return myDo}
- myDo = new(DigitalOcean)
- myDo.parent = p
-
- myDo.ready = false
-
- // Your personal API token from DigitalOcean.
- myDo.token = os.Getenv("DIGITALOCEAN_TOKEN")
-
- myDo.window = p.NewWindow("DigitalOcean Control Panel")
-
- // make a group label and a grid
- myDo.group = myDo.window.NewGroup("data").Pad()
- myDo.grid = myDo.group.NewGrid("grid", 2, 1).Pad()
-
- myDo.ready = true
- return myDo
-}
-
-// Returns true if the status is valid
-func (d *DigitalOcean) Ready() bool {
- if d == nil {return false}
- return d.ready
-}
-
-func (d *DigitalOcean) Show() {
- if ! d.Ready() {return}
- log.Info("digitalocean.Show() window")
- if d.hidden {
- d.window.Show()
- }
- d.hidden = false
-}
-
-func (d *DigitalOcean) Hide() {
- if ! d.Ready() {return}
- log.Info("digitalocean.Hide() window")
- if ! d.hidden {
- d.window.Hide()
- }
- d.hidden = true
-}
-
-func (d *DigitalOcean) Update() bool {
- if ! d.Ready() {return false}
- err := ListDroplets(d.token)
- if err != nil {
- log.Error(err, "Error listing droplets")
- return false
- }
- return true
-}