remove the 'mode' concept

This commit is contained in:
Jeff Carr 2025-03-12 07:53:44 -05:00
parent ee52199402
commit 4fd06bc159
2 changed files with 25 additions and 35 deletions

View File

@ -185,7 +185,7 @@ func drawWindow(win *gadgets.GenericWindow) {
gridM := groupM.RawGrid()
var releaseWin *gadgets.GenericWindow
me.modeReleaseW = gridM.NewButton("Release Window", func() {
gridM.NewButton("Release Window", func() {
log.Info("todo: move releaser here")
log.Info("for now, run guireleaser")
if releaseWin != nil {
@ -194,24 +194,32 @@ func drawWindow(win *gadgets.GenericWindow) {
}
releaseWin = makeModeMasterWin()
})
me.modeReleaseW.Disable()
// the Devel / Patch mode window
var patchWin *patchesWindow
me.modePatchW = gridM.NewButton("Patch Window", func() {
if patchWin != nil {
patchWin.Toggle()
/*
// the Devel / Patch mode window
var patchWin *patchesWindow
gridM.NewButton("Patch Window", func() {
if patchWin != nil {
patchWin.Toggle()
return
}
patchWin = new(patchesWindow)
patchWin.initWindow()
patchWin.Show()
})
*/
var patches *stdPatchsetTableWin
gridM.NewButton("Patch Window", func() {
if patches != nil {
patches.Toggle()
return
}
patchWin = new(patchesWindow)
patchWin.initWindow()
patchWin.Show()
patches = makePatchsetsWin()
})
me.modePatchW.Disable()
// the user mode "hack Window"
var hackWin *gadgets.GenericWindow
me.modeUserW = gridM.NewButton("Hack Window", func() {
gridM.NewButton("Hack Window", func() {
if hackWin != nil {
hackWin.Toggle()
return
@ -228,15 +236,6 @@ func drawWindow(win *gadgets.GenericWindow) {
reposWin = makeReposWin()
})
var patches *stdPatchsetTableWin
gridM.NewButton("New Patch Window", func() {
if patches != nil {
patches.Toggle()
return
}
patches = makePatchsetsWin()
})
// set the initial button state based on the last
// forge mode the user saved in the config file
switch me.forge.Config.Mode {
@ -261,27 +260,19 @@ func forgeVerifyGuiState() {
me.argvCheckoutDevel = false
me.argvCheckoutMaster = false
me.modeReleaseW.Disable()
me.modePatchW.Disable()
me.modeUserW.Disable()
switch me.forge.Config.Mode {
case forgepb.ForgeMode_MASTER:
me.argvCheckoutMaster = true
me.newBranch.SetText("master")
me.modeReleaseW.Enable()
case forgepb.ForgeMode_DEVEL:
me.argvCheckoutDevel = true
me.newBranch.SetText("devel")
me.modePatchW.Enable()
case forgepb.ForgeMode_USER:
me.newBranch.SetText(me.forge.Config.GetUsername())
me.argvCheckoutUser = true
me.modeUserW.Enable()
default:
me.newBranch.SetText(me.forge.Config.GetUsername())
me.argvCheckoutUser = true
me.modeUserW.Enable()
}
}
@ -300,9 +291,9 @@ func forgeSwitchMode(newMode forgepb.ForgeMode) {
me.forge.Config.ConfigSave()
}
/*
func doDisableUserW() {
me.argvCheckoutUser = false
me.modeUserW.Disable()
var count int
all := me.forge.Repos.SortByFullPath()
@ -317,11 +308,10 @@ func doDisableUserW() {
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 {

View File

@ -67,9 +67,9 @@ type mainType struct {
repoDevelMergeB *gui.Node // "merge to devel" repos button
repoWritableB *gui.Node // "what repos are writable" repos button
demoB *gui.Node // opens the demo
modeReleaseW *gui.Node // opens the release window
modePatchW *gui.Node // opens the patch window
modeUserW *gui.Node // opens the user/hack window
// modeReleaseW *gui.Node // opens the release window
// modePatchW *gui.Node // opens the patch window
// modeUserW *gui.Node // opens the user/hack window
argvCheckoutUser bool // shared between the GUI and the command line tools
argvCheckoutDevel bool // shared between the GUI and the command line tools