summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go49
1 files changed, 46 insertions, 3 deletions
diff --git a/main.go b/main.go
index ae3c6d4..27e61cc 100644
--- a/main.go
+++ b/main.go
@@ -17,8 +17,44 @@ var uiMainUndef bool = true
var uiMain sync.Once
var muAction sync.Mutex
+func queueAction(n *tree.Node, atype widget.ActionType) {
+ ui.QueueMain(func() {
+ newAction(n, atype)
+ })
+}
+
+func queueAdd(n *tree.Node) {
+ ui.QueueMain(func() {
+ newAdd(n)
+ })
+}
+
+func queueSetTitle(n *tree.Node, s string) {
+ ui.QueueMain(func() {
+ SetText(n, s)
+ })
+}
+
+func queueSetLabel(n *tree.Node, s string) {
+ ui.QueueMain(func() {
+ SetText(n, s)
+ })
+}
+
+func queueSetText(n *tree.Node, s string) {
+ ui.QueueMain(func() {
+ SetText(n, s)
+ })
+}
+
+func queueAddText(n *tree.Node, s string) {
+ ui.QueueMain(func() {
+ AddText(n, s)
+ })
+}
+
+/*
func queueMain(currentA widget.Action) {
- /*
// this never happends
defer func() {
if r := recover(); r != nil {
@@ -29,7 +65,6 @@ func queueMain(currentA widget.Action) {
me.myTree.SendToolkitPanic()
}
}()
- */
// andlabs puts this inside the gofunction over there
// probably this should be changed around here
// and only andlabs stuff should be sent there?
@@ -41,6 +76,7 @@ func queueMain(currentA widget.Action) {
processAction(&currentA)
})
}
+*/
func guiMain() {
defer func() {
@@ -79,7 +115,14 @@ func init() {
me.myTree = tree.New()
me.myTree.PluginName = "andlabs"
- me.myTree.ActionFromChannel = queueMain
+ // me.myTree.ActionFromChannel = queueMain
+
+ me.myTree.NodeAction = queueAction
+ me.myTree.Add = queueAdd
+ me.myTree.SetTitle = queueSetTitle
+ me.myTree.SetLabel = queueSetLabel
+ me.myTree.SetText = queueSetText
+ me.myTree.AddText = queueAddText
// TODO: this is messed up. run ui.Main() from the first add? Initialize it with an empty thing first?
// fake out the OS toolkit by making a fake window. This is probably needed for macos & windows