aboutsummaryrefslogtreecommitdiffstats
path: root/ethereal/gui.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-07-18 17:57:58 +0800
committerobscuren <geffobscura@gmail.com>2014-07-18 17:57:58 +0800
commit34e2ab9f9fac7067fa4a4dbe6170283f1d9c682a (patch)
tree4a563d3a7ce84f0bf62e231c82c4d91f0cb35851 /ethereal/gui.go
parent44296c0b33de5f6c2ff28c6a0fd528d6ccd04dec (diff)
downloaddexon-34e2ab9f9fac7067fa4a4dbe6170283f1d9c682a.tar.gz
dexon-34e2ab9f9fac7067fa4a4dbe6170283f1d9c682a.tar.zst
dexon-34e2ab9f9fac7067fa4a4dbe6170283f1d9c682a.zip
Added block update
Diffstat (limited to 'ethereal/gui.go')
-rw-r--r--ethereal/gui.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/ethereal/gui.go b/ethereal/gui.go
index 9a65ff3d0..ad701a584 100644
--- a/ethereal/gui.go
+++ b/ethereal/gui.go
@@ -266,6 +266,10 @@ func (gui *Gui) setWalletValue(amount, unconfirmedFunds *big.Int) {
gui.win.Root().Call("setWalletValue", str)
}
+func (self *Gui) getObjectByName(objectName string) qml.Object {
+ return self.win.Root().ObjectByName(objectName)
+}
+
// Simple go routine function that updates the list of peers in the GUI
func (gui *Gui) update() {
reactor := gui.eth.Reactor()
@@ -289,13 +293,16 @@ func (gui *Gui) update() {
}
reactor.Subscribe("peerList", peerChan)
- ticker := time.NewTicker(5 * time.Second)
+ peerUpdateTicker := time.NewTicker(5 * time.Second)
+ generalUpdateTicker := time.NewTicker(1 * time.Second)
state := gui.eth.StateManager().TransState()
unconfirmedFunds := new(big.Int)
gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Amount)))
- gui.win.Root().ObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate())
+ gui.getObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate())
+
+ lastBlockLabel := gui.getObjectByName("lastBlockLabel")
for {
select {
@@ -345,8 +352,10 @@ func (gui *Gui) update() {
gui.loadAddressBook()
case <-peerChan:
gui.setPeerInfo()
- case <-ticker.C:
+ case <-peerUpdateTicker.C:
gui.setPeerInfo()
+ case <-generalUpdateTicker.C:
+ lastBlockLabel.Set("text", "#"+gui.eth.BlockChain().CurrentBlock.Number.String())
}
}
}