summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addNode.go6
-rw-r--r--init.go23
-rw-r--r--toolkitConfig.proto4
3 files changed, 28 insertions, 5 deletions
diff --git a/addNode.go b/addNode.go
index 63c54a5..715d3c4 100644
--- a/addNode.go
+++ b/addNode.go
@@ -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)
}
diff --git a/init.go b/init.go
index 6bb8efd..8122cca 100644
--- a/init.go
+++ b/init.go
@@ -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"
}