summaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-05-28 10:32:32 -0400
committerDrew DeVault <sir@cmpwn.com>2020-05-28 10:32:32 -0400
commit76a91813d8dc0f0011202f8120fc197097f022aa (patch)
treeff4cd6581d3af0911954a37550602366d2bb0e2f /widgets
parentb9af9b5fb1c4f226499ab9c56d3e24f2b9b2db24 (diff)
downloadaerc-76a91813d8dc0f0011202f8120fc197097f022aa.zip
Revert "Remove duration from the status methods"
This reverts commit f06d683688e3d2139b14f67b7e349089e7200bf4.
Diffstat (limited to 'widgets')
-rw-r--r--widgets/account-wizard.go7
-rw-r--r--widgets/account.go3
-rw-r--r--widgets/aerc.go20
-rw-r--r--widgets/compose.go5
-rw-r--r--widgets/msglist.go3
-rw-r--r--widgets/tabhost.go10
6 files changed, 28 insertions, 20 deletions
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go
index 9bdac98..e247dd2 100644
--- a/widgets/account-wizard.go
+++ b/widgets/account-wizard.go
@@ -10,6 +10,7 @@ import (
"path"
"strconv"
"strings"
+ "time"
"github.com/gdamore/tcell"
"github.com/go-ini/ini"
@@ -428,7 +429,7 @@ func (wizard *AccountWizard) ConfigureTemporaryAccount(temporary bool) {
func (wizard *AccountWizard) errorFor(d ui.Interactive, err error) {
if d == nil {
- wizard.aerc.PushError(" " + err.Error())
+ wizard.aerc.PushError(" "+err.Error(), 10*time.Second)
wizard.Invalidate()
return
}
@@ -443,7 +444,7 @@ func (wizard *AccountWizard) errorFor(d ui.Interactive, err error) {
wizard.step = step
wizard.focus = focus
wizard.Focus(true)
- wizard.aerc.PushError(" " + err.Error())
+ wizard.aerc.PushError(" "+err.Error(), 10*time.Second)
wizard.Invalidate()
return
}
@@ -554,7 +555,7 @@ func (wizard *AccountWizard) finish(tutorial bool) {
term.OnClose = func(err error) {
wizard.aerc.RemoveTab(term)
if err != nil {
- wizard.aerc.PushError(" " + err.Error())
+ wizard.aerc.PushError(" "+err.Error(), 10*time.Second)
}
}
}
diff --git a/widgets/account.go b/widgets/account.go
index 113cbf7..564a95d 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"log"
+ "time"
"github.com/gdamore/tcell"
@@ -289,7 +290,7 @@ func (acct *AccountView) getSortCriteria() []*types.SortCriterion {
}
criteria, err := sort.GetSortCriteria(acct.UiConfig().Sort)
if err != nil {
- acct.aerc.PushError(" ui.sort: " + err.Error())
+ acct.aerc.PushError(" ui.sort: "+err.Error(), 10*time.Second)
return nil
}
return criteria
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 47d7cc2..57d6cef 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -386,16 +386,16 @@ func (aerc *Aerc) SetError(status string) *StatusMessage {
return aerc.statusline.SetError(status)
}
-func (aerc *Aerc) PushStatus(text string) *StatusMessage {
- return aerc.statusline.Push(text, 10*time.Second)
+func (aerc *Aerc) PushStatus(text string, expiry time.Duration) *StatusMessage {
+ return aerc.statusline.Push(text, expiry)
}
-func (aerc *Aerc) PushError(text string) *StatusMessage {
- return aerc.statusline.PushError(text, 10*time.Second)
+func (aerc *Aerc) PushError(text string, expiry time.Duration) *StatusMessage {
+ return aerc.statusline.PushError(text, expiry)
}
-func (aerc *Aerc) PushSuccess(text string) *StatusMessage {
- return aerc.statusline.PushSuccess(text, 10*time.Second)
+func (aerc *Aerc) PushSuccess(text string, expiry time.Duration) *StatusMessage {
+ return aerc.statusline.PushSuccess(text, expiry)
}
func (aerc *Aerc) focus(item ui.Interactive) {
@@ -424,11 +424,11 @@ func (aerc *Aerc) BeginExCommand(cmd string) {
exline := NewExLine(aerc.conf, cmd, func(cmd string) {
parts, err := shlex.Split(cmd)
if err != nil {
- aerc.PushError(" " + err.Error())
+ aerc.PushError(" "+err.Error(), 10*time.Second)
}
err = aerc.cmd(parts)
if err != nil {
- aerc.PushError(" " + err.Error())
+ aerc.PushError(" "+err.Error(), 10*time.Second)
}
// only add to history if this is an unsimulated command,
// ie one not executed from a keybinding
@@ -452,7 +452,7 @@ func (aerc *Aerc) RegisterPrompt(prompt string, cmd []string) {
}
err := aerc.cmd(cmd)
if err != nil {
- aerc.PushError(" " + err.Error())
+ aerc.PushError(" "+err.Error(), 10*time.Second)
}
}, func(cmd string) []string {
return nil // TODO: completions
@@ -479,7 +479,7 @@ func (aerc *Aerc) RegisterChoices(choices []Choice) {
}
err := aerc.cmd(cmd)
if err != nil {
- aerc.PushError(" " + err.Error())
+ aerc.PushError(" "+err.Error(), 10*time.Second)
}
}, func(cmd string) []string {
return nil // TODO: completions
diff --git a/widgets/compose.go b/widgets/compose.go
index a0faf58..f85e1f3 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -73,7 +73,7 @@ func NewComposer(aerc *Aerc, acct *AccountView, conf *config.AercConfig,
templateData := templates.ParseTemplateData(defaults, original)
cmpl := completer.New(conf.Compose.AddressBookCmd, func(err error) {
aerc.PushError(
- fmt.Sprintf("could not complete header: %v", err))
+ fmt.Sprintf("could not complete header: %v", err), 10*time.Second)
worker.Logger.Printf("could not complete header: %v", err)
}, aerc.Logger())
layout, editors, focusable := buildComposeHeader(aerc, cmpl, defaults)
@@ -261,7 +261,8 @@ func (c *Composer) readSignatureFromFile() []byte {
signature, err := ioutil.ReadFile(sigFile)
if err != nil {
c.aerc.PushError(
- fmt.Sprintf(" Error loading signature from file: %v", sigFile))
+ fmt.Sprintf(" Error loading signature from file: %v", sigFile),
+ 10*time.Second)
return nil
}
return signature
diff --git a/widgets/msglist.go b/widgets/msglist.go
index b440f3e..5d12f8e 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -3,6 +3,7 @@ package widgets
import (
"fmt"
"log"
+ "time"
"github.com/gdamore/tcell"
"github.com/mattn/go-runewidth"
@@ -185,7 +186,7 @@ func (ml *MessageList) MouseEvent(localX int, localY int, event tcell.Event) {
lib.NewMessageStoreView(msg, store, ml.aerc.DecryptKeys,
func(view lib.MessageView, err error) {
if err != nil {
- ml.aerc.PushError(err.Error())
+ ml.aerc.PushError(err.Error(), 10*time.Second)
return
}
viewer := NewMessageViewer(acct, ml.aerc.Config(), view)
diff --git a/widgets/tabhost.go b/widgets/tabhost.go
index b6b3041..1322a0a 100644
--- a/widgets/tabhost.go
+++ b/widgets/tabhost.go
@@ -1,11 +1,15 @@
package widgets
+import (
+ "time"
+)
+
type TabHost interface {
BeginExCommand(cmd string)
SetStatus(status string) *StatusMessage
SetError(err string) *StatusMessage
- PushStatus(text string) *StatusMessage
- PushError(text string) *StatusMessage
- PushSuccess(text string) *StatusMessage
+ PushStatus(text string, expiry time.Duration) *StatusMessage
+ PushError(text string, expiry time.Duration) *StatusMessage
+ PushSuccess(text string, expiry time.Duration) *StatusMessage
Beep()
}