From dc15523652a290a23485c1a6ed3054413be963d6 Mon Sep 17 00:00:00 2001 From: Miguel Mota Date: Tue, 17 Apr 2018 19:34:54 -0700 Subject: [PATCH] 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 --- cointop/config.go | 6 +++--- cointop/layout.go | 1 - cointop/save.go | 2 +- cointop/table.go | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cointop/config.go b/cointop/config.go index 4e8db2e..2cbbd13 100644 --- a/cointop/config.go +++ b/cointop/config.go @@ -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 } } diff --git a/cointop/layout.go b/cointop/layout.go index 8e2bb44..971e902 100644 --- a/cointop/layout.go +++ b/cointop/layout.go @@ -85,7 +85,6 @@ func (ct *Cointop) layout(g *gocui.Gui) error { ct.setActiveView("table") ct.intervalFetchData() } - ct.rowChanged() return nil } diff --git a/cointop/save.go b/cointop/save.go index 3967656..158441e 100644 --- a/cointop/save.go +++ b/cointop/save.go @@ -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() }() diff --git a/cointop/table.go b/cointop/table.go index 6739a2b..ad13719 100644 --- a/cointop/table.go +++ b/cointop/table.go @@ -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 }