summaryrefslogtreecommitdiff
path: root/stateWindow.go
diff options
context:
space:
mode:
Diffstat (limited to 'stateWindow.go')
-rw-r--r--stateWindow.go33
1 files changed, 14 insertions, 19 deletions
diff --git a/stateWindow.go b/stateWindow.go
index 3fda09d..efe9a8a 100644
--- a/stateWindow.go
+++ b/stateWindow.go
@@ -7,14 +7,11 @@ import (
"os"
"strings"
- "go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
-var apple *gui.Node
-
// This initializes the first window, a group and a button
func makebasicWindow() *gadgets.BasicWindow {
log.Warn("init basicWindow state")
@@ -26,7 +23,7 @@ func makebasicWindow() *gadgets.BasicWindow {
}
box1 := basicWindow.Box()
- control := newControl(box1)
+ cBox = newControl(box1)
vbox := box1.Box().Horizontal()
group1 := vbox.NewGroup("controls").Horizontal() // Vertical()
@@ -36,12 +33,12 @@ func makebasicWindow() *gadgets.BasicWindow {
})
group1.NewButton("read control file", func() {
- control.readControlFile()
+ cBox.readControlFile()
})
group1.NewButton("Make .deb", func() {
basicWindow.Disable()
- if control.buildPackage() {
+ if cBox.buildPackage() {
log.Info("build worked")
} else {
log.Warn("build failed")
@@ -50,20 +47,14 @@ func makebasicWindow() *gadgets.BasicWindow {
})
group1.NewButton("open repo", func() {
+ cBox.status.Update()
+ cBox.status.Toggle()
})
- /*
- group1.NewButton("show apple", func() {
- apple.Show()
- })
- apple = group1.NewButton("apple", func() {
- log.Info("is not a pear")
- })
- */
return basicWindow
}
-func (c *controlFile) buildPackage() bool {
+func (c *controlBox) buildPackage() bool {
if c.readControlFile() == nil {
log.Warn("scan worked")
} else {
@@ -88,8 +79,10 @@ func (c *controlFile) buildPackage() bool {
}
arch := c.Architecture.String()
- version := "0.0.0"
- c.Version.SetText(version)
+ version := c.Version.String()
+ if version == "" {
+ version = "0.0.0"
+ }
debname := filename + "_" + version + "_" + arch + ".deb"
@@ -139,10 +132,12 @@ func (c *controlFile) buildPackage() bool {
log.Warn("build failed")
return false
}
+ shell.Run([]string{"dpkg-deb", "-I", debname})
+ shell.Run([]string{"dpkg-deb", "-c", debname})
return true
}
-func (c *controlFile) writeFiles() bool {
+func (c *controlBox) writeFiles() bool {
cf, err := os.OpenFile("files/DEBIAN/control", os.O_RDWR|os.O_CREATE, 0644)
if err != nil {
log.Info("open control file failed", err)
@@ -157,7 +152,7 @@ func (c *controlFile) writeFiles() bool {
fmt.Fprintln(cf, "Maintainer:", c.Maintainer.String())
desc := c.Description.String()
parts := strings.Split(desc, "\n")
- fmt.Fprintln(cf, "Description:", strings.Join(parts, " \n"))
+ fmt.Fprintln(cf, "Description:", strings.Join(parts, "\n "))
return true
}