From a31d184ba53a9a61b8a0eed42cee52f9b1f2dc51 Mon Sep 17 00:00:00 2001 From: Ray Ganardi Date: Tue, 19 May 2020 13:06:49 +0200 Subject: aerc: Refactor getpasswd dialog Previously there's a hack for showing and hiding the dialog. Change it to use channels to emulate async/await --- widgets/pgpinfo.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'widgets/pgpinfo.go') diff --git a/widgets/pgpinfo.go b/widgets/pgpinfo.go index dc03cf63..5da91412 100644 --- a/widgets/pgpinfo.go +++ b/widgets/pgpinfo.go @@ -41,11 +41,8 @@ func (p *PGPInfo) DrawSignature(ctx *ui.Context) { p.details.SignatureError.Error()) } else { entity := p.details.SignedBy.Entity - var ident *openpgp.Identity - // TODO: Pick identity more intelligently - for _, ident = range entity.Identities { - break - } + ident := entity.PrimaryIdentity() + x := ctx.Printf(0, 0, validStyle, "✓ Authentic ") x += ctx.Printf(x, 0, tcell.StyleDefault, "Signature from %s (%8X)", @@ -56,11 +53,7 @@ func (p *PGPInfo) DrawSignature(ctx *ui.Context) { func (p *PGPInfo) DrawEncryption(ctx *ui.Context, y int) { validStyle := tcell.StyleDefault.Foreground(tcell.ColorGreen).Bold(true) entity := p.details.DecryptedWith.Entity - var ident *openpgp.Identity - // TODO: Pick identity more intelligently - for _, ident = range entity.Identities { - break - } + ident := entity.PrimaryIdentity() x := ctx.Printf(0, y, validStyle, "✓ Encrypted ") x += ctx.Printf(x, y, tcell.StyleDefault, -- cgit