Implemented GUI watchers for rapid reload. Implements #46

This commit is contained in:
Maran
2014-05-20 16:58:13 +02:00
parent 0ef7f63729
commit 0cf617ef0c
2 changed files with 69 additions and 3 deletions

View File

@ -18,14 +18,16 @@ type AppContainer interface {
NewBlock(*ethchain.Block)
ObjectChanged(*ethchain.StateObject)
StorageChanged(*ethchain.StorageState)
NewWatcher(chan bool)
}
type ExtApplication struct {
*ethpub.PEthereum
blockChan chan ethutil.React
changeChan chan ethutil.React
quitChan chan bool
blockChan chan ethutil.React
changeChan chan ethutil.React
quitChan chan bool
watcherQuitChan chan bool
container AppContainer
lib *UiLib
@ -38,6 +40,7 @@ func NewExtApplication(container AppContainer, lib *UiLib) *ExtApplication {
make(chan ethutil.React, 1),
make(chan ethutil.React, 1),
make(chan bool),
make(chan bool),
container,
lib,
nil,
@ -66,6 +69,8 @@ func (app *ExtApplication) run() {
reactor := app.lib.eth.Reactor()
reactor.Subscribe("newBlock", app.blockChan)
app.container.NewWatcher(app.watcherQuitChan)
win := app.container.Window()
win.Show()
win.Wait()
@ -83,6 +88,7 @@ func (app *ExtApplication) stop() {
// Kill the main loop
app.quitChan <- true
app.watcherQuitChan <- true
close(app.blockChan)
close(app.quitChan)