summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go41
1 files changed, 8 insertions, 33 deletions
diff --git a/main.go b/main.go
index 0ae6608..ab6d902 100644
--- a/main.go
+++ b/main.go
@@ -8,7 +8,7 @@ import (
"os"
"go.wit.com/log"
- "go.wit.com/widget"
+ "go.wit.com/toolkits/tree"
)
// sets defaults and establishes communication
@@ -19,38 +19,19 @@ func init() {
// init the config struct default values
Set(&me, "default")
- pluginChan = make(chan widget.Action)
+ me.myTree = tree.New()
+ me.myTree.PluginName = "gocui"
+ me.myTree.ActionFromChannel = action
+
+ // pluginChan = make(chan widget.Action)
log.Log(NOW, "Init() start pluginChan")
- go catchActionChannel()
+ // go catchActionChannel()
log.Sleep(.1) // probably not needed, but in here for now under development
go main()
log.Sleep(.1) // probably not needed, but in here for now under development
}
-/*
-recieves requests from the program to do things like:
-* add new widgets
-* change the text of a label
-* etc..
-*/
-func catchActionChannel() {
- log.Log(INFO, "catchActionChannel() START")
- for {
- log.Log(INFO, "catchActionChannel() infinite for() loop restarted select on channel")
- select {
- case a := <-pluginChan:
- if me.baseGui == nil {
- // something went wrong initializing the gocui
- log.Log(ERROR, "ERROR: console did not initialize")
- continue
- }
- log.Log(INFO, "catchActionChannel()", a.WidgetId, a.ActionType, a.WidgetType, a.ProgName)
- action(&a)
- }
- }
-}
-
func Exit() {
// TODO: what should actually happen here?
log.Log(NOW, "Exit() here. doing standardExit()")
@@ -65,18 +46,12 @@ func standardExit() {
// log(true, "standardExit() setOutput(os.Stdout)")
// setOutput(os.Stdout)
log.Log(NOW, "standardExit() send back Quit()")
- go sendBackQuit() // don't stall here in case the
+ // go sendBackQuit() // don't stall here in case the
// induces a delay in case the callback channel is broken
log.Sleep(1)
log.Log(NOW, "standardExit() exit()")
os.Exit(0)
}
-func sendBackQuit() {
- // send 'Quit' back to the program (?)
- var a widget.Action
- a.ActionType = widget.UserQuit
- callback <- a
-}
var outf *os.File