summaryrefslogtreecommitdiff
path: root/doGui.go
diff options
context:
space:
mode:
Diffstat (limited to 'doGui.go')
-rw-r--r--doGui.go52
1 files changed, 49 insertions, 3 deletions
diff --git a/doGui.go b/doGui.go
index 1a4d043..1d8e04c 100644
--- a/doGui.go
+++ b/doGui.go
@@ -203,8 +203,16 @@ func drawWindow(win *gadgets.BasicWindow) {
})
+ var writeWin *GenericWindow
me.repoWritableB = grid.NewButton("writable", func() {
- me.found = new(gitpb.Repos)
+ // if the window exists, just toggle it open or closed
+ if writeWin != nil {
+ writeWin.Toggle()
+ return
+ }
+
+ // make the window for the first time
+ found := new(gitpb.Repos)
all := me.forge.Repos.SortByFullPath()
for all.Scan() {
repo := all.Next()
@@ -212,10 +220,13 @@ func drawWindow(win *gadgets.BasicWindow) {
continue
}
- me.found.AppendByGoPath(repo)
+ found.AppendByGoPath(repo)
}
- makeStandardReposWindow("Repos that you have write access to", me.found)
+ writeWin, _ = makeWritableWindow(found)
+ writeWin.Win.Custom = func() {
+ log.Info("closing window. could do somethine here")
+ }
})
me.repoAllB = grid.NewButton("All", func() {
@@ -384,6 +395,41 @@ func makeStandardReposWindow(title string, pb *gitpb.Repos) (*gitpb.ReposTable,
return t, box
}
+func makeWritableWindow(pb *gitpb.Repos) (*GenericWindow, *gitpb.ReposTable) {
+ win := NewGenericWindow("Repos You have write access to", "Configure")
+ t := pb.NewTable("testForgeRepos")
+ t.NewUuid()
+
+ grid := win.Group.RawGrid()
+ grid.NewButton("git pull", func() {
+ log.Info("todo: run git pull on each repo")
+ })
+
+ grid.NewButton("do repos.ReScan()", func() {
+ t.Update()
+ })
+
+ tbox := win.Bottom.Box()
+ t.SetParent(tbox)
+
+ sf := t.AddStringFunc("repo", func(r *gitpb.Repo) string {
+ return r.GetGoPath()
+ })
+ sf.Custom = func(r *gitpb.Repo) {
+ log.Info("do button click on", r.GetGoPath())
+ }
+ t.AddTimeFunc("age", func(repo *gitpb.Repo) time.Time {
+ return repo.NewestTime()
+ })
+ t.AddMasterVersion()
+ t.AddDevelVersion()
+ t.AddUserVersion()
+ t.AddCurrentBranchName()
+ t.AddState()
+ t.ShowTable()
+ return win, t
+}
+
func findMergeToDevel() *gitpb.Repos {
found := gitpb.NewRepos()