From 2512c0403fa42b19c3e87fed44240da045ec902f Mon Sep 17 00:00:00 2001 From: Koni Marti Date: Fri, 18 Mar 2022 22:35:33 +0100 Subject: statusline: implement per-account status Implement a statusline state for each account. Keep the ex line and the push notifications global. Add account name prefix to push notifications. Prefix status line with account name when multiple accounts are available. Use account-specific status line for each tab where an account is defined. Handle threading, filter/search, viewer passthrough and connection status. Signed-off-by: Koni Marti Acked-by: Robin Jarry --- commands/account/connection.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'commands/account/connection.go') diff --git a/commands/account/connection.go b/commands/account/connection.go index a87993b6..52b569c4 100644 --- a/commands/account/connection.go +++ b/commands/account/connection.go @@ -3,6 +3,7 @@ package account import ( "errors" + "git.sr.ht/~rjarry/aerc/lib/statusline" "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -26,12 +27,15 @@ func (Connection) Execute(aerc *widgets.Aerc, args []string) error { if acct == nil { return errors.New("No account selected") } + cb := func(msg types.WorkerMessage) { + acct.SetStatus(statusline.ConnectionActivity("")) + } if args[0] == "connect" { - acct.Worker().PostAction(&types.Connect{}, nil) - acct.SetStatus("Connecting...") + acct.Worker().PostAction(&types.Connect{}, cb) + acct.SetStatus(statusline.ConnectionActivity("Connecting...")) } else { - acct.Worker().PostAction(&types.Disconnect{}, nil) - acct.SetStatus("Disconnecting...") + acct.Worker().PostAction(&types.Disconnect{}, cb) + acct.SetStatus(statusline.ConnectionActivity("Disconnecting...")) } return nil } -- cgit