summaryrefslogtreecommitdiff
path: root/plugin.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin.go')
-rw-r--r--plugin.go40
1 files changed, 20 insertions, 20 deletions
diff --git a/plugin.go b/plugin.go
index 72b3112..7e8ad3c 100644
--- a/plugin.go
+++ b/plugin.go
@@ -56,6 +56,26 @@ type aplug struct {
var allPlugins []*aplug
+func (n *Node) LoadToolkit(name string) (*Node, error) {
+ log.Log(PLUG, "LoadToolkit() START for name =", name)
+ plug := initPlugin(name)
+ if plug == nil {
+ return n, errors.New("initPlugin(" + name + ") failed")
+ }
+ plug.dead = false
+
+ log.Log(PLUG, "LoadToolkit() sending Toolkit Init action to the plugin channel")
+ var a widget.Action
+ a.ActionType = widget.ToolkitInit
+ plug.pluginChan <- a
+ // sleep(.5) // temp hack until chan communication is setup
+
+ // TODO: find a new way to do this that is locking, safe and accurate
+ me.rootNode.redraw(plug)
+ log.Log(PLUG, "LoadToolkit() END for name =", name)
+ return n, nil
+}
+
// loads and initializes a toolkit (andlabs/ui, gocui, etc)
// attempts to locate the .so file
func initPlugin(name string) *aplug {
@@ -281,26 +301,6 @@ func (n *Node) ListToolkits() {
}
}
-func (n *Node) LoadToolkit(name string) (*Node, error) {
- log.Log(PLUG, "LoadToolkit() START for name =", name)
- plug := initPlugin(name)
- if plug == nil {
- return n, errors.New("initPlugin(" + name + ") failed")
- }
- plug.dead = false
-
- log.Log(PLUG, "LoadToolkit() sending Toolkit Init action to the plugin channel")
- var a widget.Action
- a.ActionType = widget.ToolkitInit
- plug.pluginChan <- a
- // sleep(.5) // temp hack until chan communication is setup
-
- // TODO: find a new way to do this that is locking, safe and accurate
- me.rootNode.redraw(plug)
- log.Log(PLUG, "LoadToolkit() END for name =", name)
- return n, nil
-}
-
func (n *Node) CloseToolkit(name string) bool {
log.Log(PLUG, "CloseToolkit() for name =", name)
for i, plug := range allPlugins {