summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doGui.go73
1 files changed, 63 insertions, 10 deletions
diff --git a/doGui.go b/doGui.go
index 277c9fe..8ff3d1f 100644
--- a/doGui.go
+++ b/doGui.go
@@ -183,9 +183,33 @@ func drawWindow(win *gadgets.BasicWindow) {
log.Info("todo: move releaser here")
log.Info("for now, run guireleaser")
})
+ me.modeReleaseW.Disable()
+
+ // the Devel / Patch mode window
+ var patchWin *patchesWindow
me.modePatchW = gridM.NewButton("Patch Window", func() {
+ if patchWin != nil {
+ patchWin.Toggle()
+ return
+ }
+ patchWin = new(patchesWindow)
+ patchWin.initWindow()
+ patchWin.Show()
})
+ me.modePatchW.Disable()
+
+ // the user mode "hack Window"
+ var hackWin *GenericWindow
me.modeUserW = gridM.NewButton("Hack Window", func() {
+ if hackWin != nil {
+ hackWin.Toggle()
+ return
+ }
+ hackWin := NewGenericWindow("Hack / User Mode Window", "Things that might be wrong")
+ grid := hackWin.Group.RawGrid()
+ grid.NewButton("git pull", func() {
+ log.Info("todo: run git pull on each repo")
+ })
})
grid.NextRow()
@@ -348,17 +372,19 @@ func drawWindow(win *gadgets.BasicWindow) {
debugger.DebugWindow()
})
- var patchWin *patchesWindow
+ /*
+ var patchWin *patchesWindow
- grid.NewButton("Patches Window", func() {
- if patchWin != nil {
- patchWin.Toggle()
- return
- }
- patchWin = new(patchesWindow)
- patchWin.initWindow()
- patchWin.Show()
- })
+ grid.NewButton("Patches Window", func() {
+ if patchWin != nil {
+ patchWin.Toggle()
+ return
+ }
+ patchWin = new(patchesWindow)
+ patchWin.initWindow()
+ patchWin.Show()
+ })
+ */
}
// sets the text in the labels in the window
@@ -399,10 +425,37 @@ func forgeSwitchMode(newMode forgepb.ForgeMode) {
me.modeUserW.Enable()
}
+ if me.forge.Config.Mode != forgepb.ForgeMode_USER {
+ doDisableUserW()
+ }
+
me.forge.SetConfigSave(true)
me.forge.ConfigSave()
}
+func doDisableUserW() {
+ me.argvCheckoutUser = false
+ me.modeUserW.Disable()
+
+ var count int
+ all := me.forge.Repos.SortByFullPath()
+ for all.Scan() {
+ repo := all.Next()
+ if !repo.IsLocalBranch(repo.GetUserBranchName()) {
+ // log.Info("repo doesn't have user branch", repo.GetGoPath())
+ continue
+ }
+ count += 1
+ }
+
+ if count > 0 {
+ s := fmt.Sprintf("git delete %d user branches", count)
+ me.modeUserW.SetLabel(s)
+ me.modeUserW.Enable()
+ return
+ }
+}
+
// this is the magic that generates a window directly from the protocol buffer
func makeStandardReposGrid(pb *gitpb.Repos) *gitpb.ReposTable {
t := pb.NewTable("testDirty")