summaryrefslogtreecommitdiff
path: root/repoview.go
blob: 2dfe6c382b4c03423495835471f8a0360106c319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main

import (
	"go.wit.com/lib/gadgets"
	"go.wit.com/lib/gui/gowit"
	"go.wit.com/lib/gui/repolist"
	"go.wit.com/log"

	"go.wit.com/gui"
)

type repoWindow struct {
	win  *gadgets.BasicWindow
	box  *gui.Node
	View *repolist.RepoList
}

func (r *repoWindow) Hidden() bool {
	return r.win.Hidden()
}

func (r *repoWindow) Show() {
	r.win.Show()
}

func (r *repoWindow) Hide() {
	r.win.Hide()
}

func (r *repoWindow) Disable() {
	r.box.Disable()
}

func (r *repoWindow) Enable() {
	r.box.Enable()
}

// you can only have one of these
func makeRepoView() *repoWindow {
	if me.repos != nil {
		return me.repos
	}
	r := new(repoWindow)
	r.win = gadgets.RawBasicWindow("GUI repositories in ~/go/src/")
	r.win.Make()

	r.box = r.win.Box().NewBox("bw vbox", false)
	r.win.Custom = func() {
		log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close")
		log.Warn("Should I do something special here?")
	}

	// reposbox.SetExpand(false)
	group1 := r.box.NewGroup("Run on all repos:")

	hbox := group1.Box()
	// hbox.Horizontal()
	hbox.Vertical()

	box2 := hbox.Box().Vertical()
	box2.NewButton("Dump version file", func() {
		gowit.DumpVersions(me.repos.View)
	})

	r.View = repolist.GuireleaserView(r.box)

	showncount := r.View.MirrorShownCount()
	box2.Append(showncount)
	duration := r.View.MirrorScanDuration()
	box2.Append(duration)
	return r
}