mirror of
https://github.com/miguelmota/cointop
synced 2024-11-05 00:00:14 +00:00
saving loader
Former-commit-id: f020bdc57d06a2005b704711fc4b3e5a5e1c300f [formerly f020bdc57d06a2005b704711fc4b3e5a5e1c300f [formerly c788b24445ecd99250b9bb99c0e8ca61fed209dc [formerly ac164af8b92f7beb67562106d501d220019ea2be]]] Former-commit-id: 13fa9f5d2b56367b7f74a9552a729353179c34e4 Former-commit-id: da32569b8ccc50bfe40bd3701efff5fc7f1638ef [formerly 29de0dc1642f7416fe59f225382e58270408e037] Former-commit-id: 54d3e42041527c426b93865d82b8f81bff5127dd
This commit is contained in:
parent
a77b73b597
commit
dc15523652
@ -3,6 +3,7 @@ package cointop
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/user"
|
||||
"strings"
|
||||
@ -98,13 +99,12 @@ func (ct *Cointop) saveConfig() error {
|
||||
defer ct.savemux.Unlock()
|
||||
path := ct.configPath()
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
fo, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, 0666)
|
||||
defer fo.Close()
|
||||
b, err := ct.configToToml()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := fo.Write(b); err != nil {
|
||||
err = ioutil.WriteFile(path, b, 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,6 @@ func (ct *Cointop) layout(g *gocui.Gui) error {
|
||||
ct.setActiveView("table")
|
||||
ct.intervalFetchData()
|
||||
}
|
||||
ct.rowChanged()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ func (ct *Cointop) save() error {
|
||||
|
||||
func (ct *Cointop) setSavingStatus() {
|
||||
go func() {
|
||||
ct.loadingTicks("saving", 900)
|
||||
ct.loadingTicks("saving", 590)
|
||||
ct.updateStatusbar("")
|
||||
ct.rowChanged()
|
||||
}()
|
||||
|
@ -88,6 +88,7 @@ func (ct *Cointop) refreshTable() error {
|
||||
ct.update(func() {
|
||||
ct.tableview.Clear()
|
||||
ct.table.Format().Fprint(ct.tableview)
|
||||
ct.rowChanged()
|
||||
})
|
||||
|
||||
return nil
|
||||
@ -142,7 +143,6 @@ func (ct *Cointop) updateTable() error {
|
||||
ct.coins = sliced
|
||||
ct.sort(ct.sortby, ct.sortdesc, ct.coins)
|
||||
ct.refreshTable()
|
||||
ct.rowChanged()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user