save the toolkit config options
This commit is contained in:
parent
3420aee291
commit
d141b4d308
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
23
init.go
23
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)
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue