make the buttons work

This commit is contained in:
Jeff Carr 2025-01-30 13:44:22 -06:00
parent 4484b0b84d
commit d568d5dbe4
1 changed files with 18 additions and 9 deletions

View File

@ -16,13 +16,10 @@ type repoMergeWindow struct {
mainBranchVersion *gadgets.OneLiner // the primary branch version mainBranchVersion *gadgets.OneLiner // the primary branch version
develBranchVersion *gadgets.OneLiner // the devel branch version develBranchVersion *gadgets.OneLiner // the devel branch version
userBranchVersion *gadgets.OneLiner // the user branch version userBranchVersion *gadgets.OneLiner // the user branch version
currentVersion *gadgets.OneLiner // the devel branch version
currentVersion *gadgets.OneLiner // the devel branch version currentBranch *gadgets.OneLiner // the user branch version
currentBranch *gadgets.OneLiner // the user branch version mergeD *gui.Node // the merge button
mergeM *gui.Node // the merge button
//shelf *gui.Node // the first box in the stack, set as horizontal
//grid *gui.Node // the list of available patches
//setgrid *gui.Node // the list of each patchset
} }
// todo: autogenerate these or make them standared 'gui' package functions // todo: autogenerate these or make them standared 'gui' package functions
@ -70,6 +67,18 @@ func (w *repoMergeWindow) Update() {
w.currentBranch.SetText(w.repo.GetCurrentBranchName()) w.currentBranch.SetText(w.repo.GetCurrentBranchName())
w.currentVersion.SetText(w.repo.GetCurrentVersion()) w.currentVersion.SetText(w.repo.GetCurrentVersion())
if w.repo.GetCurrentBranchName() == w.repo.GetDevelBranchName() {
w.mergeD.Enable()
} else {
w.mergeD.Disable()
}
if w.repo.GetCurrentBranchName() == w.repo.GetMasterBranchName() {
w.mergeM.Enable()
} else {
w.mergeM.Disable()
}
} }
func (rs *RepoStatus) MakeRepoMergeWindow(repo *gitpb.Repo) *repoMergeWindow { func (rs *RepoStatus) MakeRepoMergeWindow(repo *gitpb.Repo) *repoMergeWindow {
@ -106,7 +115,7 @@ func (rs *RepoStatus) MakeRepoMergeWindow(repo *gitpb.Repo) *repoMergeWindow {
w.repo.Reload() w.repo.Reload()
w.Update() w.Update()
}) })
grid.NewButton("merge to devel", func() { w.mergeD = grid.NewButton("merge to devel", func() {
log.Info("repo:", repo.GetGoPath()) log.Info("repo:", repo.GetGoPath())
if result, err := repo.MergeToDevel(); err == nil { if result, err := repo.MergeToDevel(); err == nil {
log.Warn("THINGS SEEM OK", repo.GetFullPath()) log.Warn("THINGS SEEM OK", repo.GetFullPath())
@ -135,7 +144,7 @@ func (rs *RepoStatus) MakeRepoMergeWindow(repo *gitpb.Repo) *repoMergeWindow {
w.repo.Reload() w.repo.Reload()
w.Update() w.Update()
}) })
grid.NewButton("merge to master", func() { w.mergeM = grid.NewButton("merge to master", func() {
log.Info("repo:", repo.GetGoPath()) log.Info("repo:", repo.GetGoPath())
if result, err := repo.MergeToMaster(); err == nil { if result, err := repo.MergeToMaster(); err == nil {
log.Warn("THINGS SEEM OK", repo.GetFullPath()) log.Warn("THINGS SEEM OK", repo.GetFullPath())