summaryrefslogtreecommitdiff
path: root/windowNewPatches.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-03-10 13:52:25 -0500
committerJeff Carr <[email protected]>2025-03-10 13:52:25 -0500
commit18d9a7a099978174f81c016e90cdc9b6cd3162f2 (patch)
tree152bc0f9b0fde42a16c53036b9a0f3c02cb04f59 /windowNewPatches.go
parent2c5841f5ecf7432fb09b3bcf6aee8783ec0c1432 (diff)
trying to get patchset tables to work
Diffstat (limited to 'windowNewPatches.go')
-rw-r--r--windowNewPatches.go71
1 files changed, 71 insertions, 0 deletions
diff --git a/windowNewPatches.go b/windowNewPatches.go
new file mode 100644
index 0000000..3e7e435
--- /dev/null
+++ b/windowNewPatches.go
@@ -0,0 +1,71 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
+package main
+
+import (
+ "sync"
+
+ "go.wit.com/gui"
+ "go.wit.com/lib/gadgets"
+ "go.wit.com/lib/protobuf/forgepb"
+ "go.wit.com/log"
+)
+
+type stdPatchTableWin struct {
+ sync.Mutex
+ win *gadgets.GenericWindow // the machines gui window
+ box *gui.Node // the machines gui parent box widget
+ TB *forgepb.PatchesTable // the gui table buffer
+ update bool // if the window should be updated
+}
+
+func (w *stdPatchTableWin) Toggle() {
+ if w == nil {
+ return
+ }
+ if w.win == nil {
+ return
+ }
+ w.win.Toggle()
+}
+
+func makePatchesWin() *stdPatchTableWin {
+ dwin := new(stdPatchTableWin)
+ dwin.win = gadgets.NewGenericWindow("forge current patchsets", "who is squirreling around?")
+ dwin.win.Custom = func() {
+ log.Info("test delete window here")
+ }
+ grid := dwin.win.Group.RawGrid()
+
+ grid.NewButton("reload", func() {
+ })
+
+ // make a box at the bottom of the window for the protobuf table
+ dwin.box = dwin.win.Bottom.Box().SetProgName("TBOX")
+
+ return dwin
+}
+
+func (dwin *stdPatchTableWin) doPatchesTable(currentPatches *forgepb.Patches) {
+ dwin.Lock()
+ defer dwin.Unlock()
+ if dwin.TB != nil {
+ dwin.TB.Delete()
+ dwin.TB = nil
+ }
+}
+
+// define what rows to have in the protobuf table
+func AddPatchesPB(tbox *gui.Node, pb *forgepb.Patches) *forgepb.PatchesTable {
+ t := pb.NewTable("PatchesPB")
+ t.NewUuid()
+ t.SetParent(tbox)
+
+ t.AddRepoNamespace()
+ t.AddFilename()
+ t.AddCommitHash()
+
+ t.ShowTable()
+ return t
+}