diff options
| author | Jeff Carr <[email protected]> | 2025-03-25 07:28:06 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-25 13:17:00 -0500 |
| commit | d141b4d308f71418e8d43a58c2e04f9560db3092 (patch) | |
| tree | 57dc156187f844d078c10b98bf30e1ca3a477d7e | |
| parent | 3420aee2911af5ecfc8ee77bfff2c890b78d86ab (diff) | |
save the toolkit config options
| -rw-r--r-- | addNode.go | 6 | ||||
| -rw-r--r-- | init.go | 23 | ||||
| -rw-r--r-- | toolkitConfig.proto | 4 |
3 files changed, 28 insertions, 5 deletions
@@ -38,9 +38,9 @@ func addNode(a *widget.Action) *Node { } if treeRoot.FindWidgetId(a.WidgetId) != nil { - log.Log(TREEWARN, "AddNode() WidgetId already exists", a.WidgetId) - log.Log(TREEWARN, "probably this is a Show() / Hide() issue") - log.Log(TREEWARN, "TODO: figure out what to do here") + // ignore these errors for now + log.Log(TREE, "AddNode() WidgetId already exists", a.WidgetId) + log.Log(TREE, "TODO: figure out what to do here probably this is a Show() / Hide() issue") return treeRoot.FindWidgetId(a.WidgetId) } @@ -72,3 +72,26 @@ func (t *TreeInfo) ConfigFind(n string) (string, error) { } return "", fmt.Errorf("toolkit config %s not found", n) } + +func (t *TreeInfo) ConfigSave(o *ToolkitConfig) { + t.configInsert(o) + t.config.configSave() +} + +// update the config option value (or append if new record) +func (t *TreeInfo) configInsert(newr *ToolkitConfig) { + all := t.config.All() // get the list of repos + for all.Scan() { + r := all.Next() + if t.PluginName != r.Plugin { + // option isn't for this plugin + continue + } + if newr.Name == r.Name { + // found the record! + r.Value = newr.Value + return + } + } + t.config.Append(newr) +} diff --git a/toolkitConfig.proto b/toolkitConfig.proto index a53fdc4..1ce14b4 100644 --- a/toolkitConfig.proto +++ b/toolkitConfig.proto @@ -7,8 +7,8 @@ package forgepb; import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp message ToolkitConfig { // - string plugin = 1; // 'gocui', 'andlabs', etc - string name = 2; // variable name 'fullscreen' + string plugin = 1; // 'gocui', 'andlabs', etc `autogenpb:unique` + string name = 2; // variable name 'fullscreen' `autogenpb:unique` string value = 3; // value "true" } |
