aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/account/cf.go4
-rw-r--r--commands/account/clear.go4
-rw-r--r--commands/account/connection.go8
-rw-r--r--commands/account/search.go10
-rw-r--r--commands/account/sort.go6
-rw-r--r--commands/msg/toggle-threads.go4
-rw-r--r--commands/msgview/toggle-key-passthrough.go4
-rw-r--r--lib/state/renderer.go (renamed from lib/statusline/renderer.go)2
-rw-r--r--lib/state/state.go (renamed from lib/statusline/state.go)2
-rw-r--r--lib/state/texter.go (renamed from lib/statusline/texter.go)2
-rw-r--r--widgets/account.go25
11 files changed, 35 insertions, 36 deletions
diff --git a/commands/account/cf.go b/commands/account/cf.go
index 39b0bb89..f0fa3b67 100644
--- a/commands/account/cf.go
+++ b/commands/account/cf.go
@@ -5,7 +5,7 @@ import (
"strings"
"git.sr.ht/~rjarry/aerc/commands"
- "git.sr.ht/~rjarry/aerc/lib/statusline"
+ "git.sr.ht/~rjarry/aerc/lib/state"
"git.sr.ht/~rjarry/aerc/widgets"
)
@@ -51,7 +51,7 @@ func (ChangeFolder) Execute(aerc *widgets.Aerc, args []string) error {
store := acct.Store()
if store != nil {
store.ApplyClear()
- acct.SetStatus(statusline.SearchFilterClear())
+ acct.SetStatus(state.SearchFilterClear())
}
return nil
}
diff --git a/commands/account/clear.go b/commands/account/clear.go
index 6d1e7b0a..a383b621 100644
--- a/commands/account/clear.go
+++ b/commands/account/clear.go
@@ -3,7 +3,7 @@ package account
import (
"errors"
- "git.sr.ht/~rjarry/aerc/lib/statusline"
+ "git.sr.ht/~rjarry/aerc/lib/state"
"git.sr.ht/~rjarry/aerc/widgets"
"git.sr.ht/~sircmpwn/getopt"
)
@@ -52,7 +52,7 @@ func (Clear) Execute(aerc *widgets.Aerc, args []string) error {
defer store.Select(0)
}
store.ApplyClear()
- acct.SetStatus(statusline.SearchFilterClear())
+ acct.SetStatus(state.SearchFilterClear())
return nil
}
diff --git a/commands/account/connection.go b/commands/account/connection.go
index 52b569c4..0a67b2fe 100644
--- a/commands/account/connection.go
+++ b/commands/account/connection.go
@@ -3,7 +3,7 @@ package account
import (
"errors"
- "git.sr.ht/~rjarry/aerc/lib/statusline"
+ "git.sr.ht/~rjarry/aerc/lib/state"
"git.sr.ht/~rjarry/aerc/widgets"
"git.sr.ht/~rjarry/aerc/worker/types"
)
@@ -28,14 +28,14 @@ func (Connection) Execute(aerc *widgets.Aerc, args []string) error {
return errors.New("No account selected")
}
cb := func(msg types.WorkerMessage) {
- acct.SetStatus(statusline.ConnectionActivity(""))
+ acct.SetStatus(state.ConnectionActivity(""))
}
if args[0] == "connect" {
acct.Worker().PostAction(&types.Connect{}, cb)
- acct.SetStatus(statusline.ConnectionActivity("Connecting..."))
+ acct.SetStatus(state.ConnectionActivity("Connecting..."))
} else {
acct.Worker().PostAction(&types.Disconnect{}, cb)
- acct.SetStatus(statusline.ConnectionActivity("Disconnecting..."))
+ acct.SetStatus(state.ConnectionActivity("Disconnecting..."))
}
return nil
}
diff --git a/commands/account/search.go b/commands/account/search.go
index 1494f788..71833afd 100644
--- a/commands/account/search.go
+++ b/commands/account/search.go
@@ -4,7 +4,7 @@ import (
"errors"
"strings"
- "git.sr.ht/~rjarry/aerc/lib/statusline"
+ "git.sr.ht/~rjarry/aerc/lib/state"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rjarry/aerc/widgets"
@@ -39,19 +39,19 @@ func (SearchFilter) Execute(aerc *widgets.Aerc, args []string) error {
if len(args[1:]) == 0 {
return Clear{}.Execute(aerc, []string{"clear"})
}
- acct.SetStatus(statusline.FilterActivity("Filtering..."), statusline.Search(""))
+ acct.SetStatus(state.FilterActivity("Filtering..."), state.Search(""))
store.SetFilter(args[1:])
cb := func(msg types.WorkerMessage) {
if _, ok := msg.(*types.Done); ok {
- acct.SetStatus(statusline.FilterResult(strings.Join(args, " ")))
+ acct.SetStatus(state.FilterResult(strings.Join(args, " ")))
log.Tracef("Filter results: %v", store.Uids())
}
}
store.Sort(store.GetCurrentSortCriteria(), cb)
} else {
- acct.SetStatus(statusline.Search("Searching..."))
+ acct.SetStatus(state.Search("Searching..."))
cb := func(uids []uint32) {
- acct.SetStatus(statusline.Search(strings.Join(args, " ")))
+ acct.SetStatus(state.Search(strings.Join(args, " ")))
log.Tracef("Search results: %v", uids)
store.ApplySearch(uids)
// TODO: Remove when stores have multiple OnUpdate handlers
diff --git a/commands/account/sort.go b/commands/account/sort.go
index f8cb94c1..cabe10ec 100644
--- a/commands/account/sort.go
+++ b/commands/account/sort.go
@@ -6,7 +6,7 @@ import (
"git.sr.ht/~rjarry/aerc/commands"
"git.sr.ht/~rjarry/aerc/lib/sort"
- "git.sr.ht/~rjarry/aerc/lib/statusline"
+ "git.sr.ht/~rjarry/aerc/lib/state"
"git.sr.ht/~rjarry/aerc/widgets"
"git.sr.ht/~rjarry/aerc/worker/types"
)
@@ -89,10 +89,10 @@ func (Sort) Execute(aerc *widgets.Aerc, args []string) error {
}
}
- acct.SetStatus(statusline.Sorting(true))
+ acct.SetStatus(state.Sorting(true))
store.Sort(sortCriteria, func(msg types.WorkerMessage) {
if _, ok := msg.(*types.Done); ok {
- acct.SetStatus(statusline.Sorting(false))
+ acct.SetStatus(state.Sorting(false))
}
})
return nil
diff --git a/commands/msg/toggle-threads.go b/commands/msg/toggle-threads.go
index babdc31c..9508da50 100644
--- a/commands/msg/toggle-threads.go
+++ b/commands/msg/toggle-threads.go
@@ -3,7 +3,7 @@ package msg
import (
"errors"
- "git.sr.ht/~rjarry/aerc/lib/statusline"
+ "git.sr.ht/~rjarry/aerc/lib/state"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/widgets"
)
@@ -36,7 +36,7 @@ func (ToggleThreads) Execute(aerc *widgets.Aerc, args []string) error {
return err
}
store.SetThreadedView(!store.ThreadedView())
- acct.SetStatus(statusline.Threading(store.ThreadedView()))
+ acct.SetStatus(state.Threading(store.ThreadedView()))
ui.Invalidate()
return nil
}
diff --git a/commands/msgview/toggle-key-passthrough.go b/commands/msgview/toggle-key-passthrough.go
index cbc4565e..00a39559 100644
--- a/commands/msgview/toggle-key-passthrough.go
+++ b/commands/msgview/toggle-key-passthrough.go
@@ -3,7 +3,7 @@ package msgview
import (
"errors"
- "git.sr.ht/~rjarry/aerc/lib/statusline"
+ "git.sr.ht/~rjarry/aerc/lib/state"
"git.sr.ht/~rjarry/aerc/widgets"
)
@@ -28,7 +28,7 @@ func (ToggleKeyPassthrough) Execute(aerc *widgets.Aerc, args []string) error {
mv, _ := aerc.SelectedTabContent().(*widgets.MessageViewer)
keyPassthroughEnabled := mv.ToggleKeyPassthrough()
if acct := mv.SelectedAccount(); acct != nil {
- acct.SetStatus(statusline.Passthrough(keyPassthroughEnabled))
+ acct.SetStatus(state.Passthrough(keyPassthroughEnabled))
}
return nil
}
diff --git a/lib/statusline/renderer.go b/lib/state/renderer.go
index 993cfcc5..13e593fe 100644
--- a/lib/statusline/renderer.go
+++ b/lib/state/renderer.go
@@ -1,4 +1,4 @@
-package statusline
+package state
import (
"errors"
diff --git a/lib/statusline/state.go b/lib/state/state.go
index 528400b1..b5f925ac 100644
--- a/lib/statusline/state.go
+++ b/lib/state/state.go
@@ -1,4 +1,4 @@
-package statusline
+package state
import (
"fmt"
diff --git a/lib/statusline/texter.go b/lib/state/texter.go
index d06b1982..21cf3627 100644
--- a/lib/statusline/texter.go
+++ b/lib/state/texter.go
@@ -1,4 +1,4 @@
-package statusline
+package state
import "strings"
diff --git a/widgets/account.go b/widgets/account.go
index ded71f99..135afef2 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -14,7 +14,6 @@ import (
"git.sr.ht/~rjarry/aerc/lib/marker"
"git.sr.ht/~rjarry/aerc/lib/sort"
"git.sr.ht/~rjarry/aerc/lib/state"
- "git.sr.ht/~rjarry/aerc/lib/statusline"
"git.sr.ht/~rjarry/aerc/lib/templates"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/log"
@@ -36,7 +35,7 @@ type AccountView struct {
tab *ui.Tab
msglist *MessageList
worker *types.Worker
- state *statusline.State
+ state *state.State
newConn bool // True if this is a first run after a new connection/reconnection
uiConf *config.UIConfig
@@ -67,7 +66,7 @@ func NewAccountView(
acct: acct,
aerc: aerc,
host: host,
- state: statusline.NewState(acct.Name, len(config.Accounts) > 1),
+ state: state.NewState(acct.Name, len(config.Accounts) > 1),
uiConf: acctUiConf,
}
@@ -108,7 +107,7 @@ func NewAccountView(
worker.PostAction(&types.Configure{Config: acct}, nil)
worker.PostAction(&types.Connect{}, nil)
- view.SetStatus(statusline.ConnectionActivity("Connecting..."))
+ view.SetStatus(state.ConnectionActivity("Connecting..."))
if acct.CheckMail.Minutes() > 0 {
view.CheckMailTimer(acct.CheckMail)
}
@@ -116,7 +115,7 @@ func NewAccountView(
return view, nil
}
-func (acct *AccountView) SetStatus(setters ...statusline.SetStateFunc) {
+func (acct *AccountView) SetStatus(setters ...state.SetStateFunc) {
for _, fn := range setters {
fn(acct.state, acct.SelectedDirectory())
}
@@ -234,7 +233,7 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
case *types.Done:
switch msg.InResponseTo().(type) {
case *types.Connect, *types.Reconnect:
- acct.SetStatus(statusline.ConnectionActivity("Listing mailboxes..."))
+ acct.SetStatus(state.ConnectionActivity("Listing mailboxes..."))
log.Tracef("Listing mailboxes...")
acct.dirlist.UpdateList(func(dirs []string) {
var dir string
@@ -252,14 +251,14 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
}
acct.msglist.SetInitDone()
log.Infof("[%s] connected.", acct.acct.Name)
- acct.SetStatus(statusline.SetConnected(true))
+ acct.SetStatus(state.SetConnected(true))
acct.newConn = true
})
case *types.Disconnect:
acct.dirlist.ClearList()
acct.msglist.SetStore(nil)
log.Infof("[%s] disconnected.", acct.acct.Name)
- acct.SetStatus(statusline.SetConnected(false))
+ acct.SetStatus(state.SetConnected(false))
case *types.OpenDirectory:
if store, ok := acct.dirlist.SelectedMsgStore(); ok {
// If we've opened this dir before, we can re-render it from
@@ -318,7 +317,7 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
acct.msglist.SetStore(store)
}
store.Update(msg)
- acct.SetStatus(statusline.Threading(store.ThreadedView()))
+ acct.SetStatus(state.Threading(store.ThreadedView()))
}
if acct.newConn && len(msg.Uids) == 0 {
acct.checkMailOnStartup()
@@ -329,7 +328,7 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
acct.msglist.SetStore(store)
}
store.Update(msg)
- acct.SetStatus(statusline.Threading(store.ThreadedView()))
+ acct.SetStatus(state.Threading(store.ThreadedView()))
}
if acct.newConn && len(msg.Threads) == 0 {
acct.checkMailOnStartup()
@@ -357,7 +356,7 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
acct.labels = msg.Labels
case *types.ConnError:
log.Errorf("[%s] connection error: %v", acct.acct.Name, msg.Error)
- acct.SetStatus(statusline.SetConnected(false))
+ acct.SetStatus(state.SetConnected(false))
acct.PushError(msg.Error)
acct.msglist.SetStore(nil)
acct.worker.PostAction(&types.Reconnect{}, nil)
@@ -433,7 +432,7 @@ func (acct *AccountView) CheckMail() {
dirs = acct.dirlist.FilterDirs(dirs, acct.AccountConfig().CheckMailInclude, false)
dirs = acct.dirlist.FilterDirs(dirs, exclude, true)
log.Debugf("Checking for new mail on account %s", acct.Name())
- acct.SetStatus(statusline.ConnectionActivity("Checking for new mail..."))
+ acct.SetStatus(state.ConnectionActivity("Checking for new mail..."))
msg := &types.CheckMail{
Directories: dirs,
Command: acct.acct.CheckMailCmd,
@@ -452,7 +451,7 @@ func (acct *AccountView) CheckMail() {
}
acct.worker.PostAction(checkMailMsg, cb)
} else { // Done
- acct.SetStatus(statusline.ConnectionActivity(""))
+ acct.SetStatus(state.ConnectionActivity(""))
acct.Lock()
acct.checkingMail = false
acct.Unlock()