diff options
Diffstat (limited to 'doGui.go')
| -rw-r--r-- | doGui.go | 38 |
1 files changed, 22 insertions, 16 deletions
@@ -7,10 +7,12 @@ package main import ( "os" + "strings" "time" "go.wit.com/gui" "go.wit.com/lib/gadgets" + "go.wit.com/lib/gui/shell" "go.wit.com/log" ) @@ -41,31 +43,35 @@ func doGui() { func drawWindow(win *gadgets.GenericWindow) { grid := win.Group.RawGrid() - grid.NewLabel("Drives:") - me.dd = grid.NewDropdown() - me.dd.AddText("/dev/blah") + // me.dd.AddText("/dev/blah") me.dd.Custom = func() { - log.Info("todo: changed drive") + fields := strings.Fields(me.dd.String()) + log.Info("changed to", fields) + if len(fields) < 1 { + return + } + me.currentDev = fields[0] + me.parted.SetText("Partition " + me.currentDev) } grid.NextRow() - grid.NewButton("doDrives()", func() { - doDrives() - }) - - grid.NewButton("doDrives2()", func() { - doDrives2() - }) - - grid.NewButton("partition drives", func() { - log.Info("something") + // a button to format or blank a drive + me.parted = grid.NewButton("select drive", func() { + if me.currentDev == "" { + log.Info("You must select a drive first") + return + } + log.Info("check if", me.currentDev, "is in use") + shell.RunVerbose([]string{"parted", me.currentDev, "print"}) }) grid.NextRow() - grid.NewButton("ConfigSave()", func() { - log.Info("todo: make code for this") + grid.NewButton("doDrives()", func() { + doDrives() }) + doDrives2() + } |
