aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/account-wizard.go
diff options
context:
space:
mode:
authorJeffas <dev@jeffas.io>2020-05-31 12:37:46 +0100
committerReto Brunner <reto@labrat.space>2020-06-09 08:48:47 +0200
commit543510f5c146aa6e4d3344ec7d109ad7945fa106 (patch)
tree7356a64e28c2ab9123e84a76381e2cd99e82849a /widgets/account-wizard.go
parent3877b1aa719569d3666bce227e351afcbc2628af (diff)
downloadaerc-543510f5c146aa6e4d3344ec7d109ad7945fa106.tar.gz
Make grid sizes dynamic
The grid used static sizes which meant that changing settings didn't have an effect on elements of the ui, notably the sidebar width. This patch makes the `Size` parameter of a cell a function which returns the `int`, allowing for dynamic sizes. A `Const` function is also included for ease of use for static sizes.
Diffstat (limited to 'widgets/account-wizard.go')
-rw-r--r--widgets/account-wizard.go98
1 files changed, 49 insertions, 49 deletions
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go
index 6f93367f..4e51926d 100644
--- a/widgets/account-wizard.go
+++ b/widgets/account-wizard.go
@@ -136,18 +136,18 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
})
basics := ui.NewGrid().Rows([]ui.GridSpec{
- {ui.SIZE_EXACT, 8}, // Introduction
- {ui.SIZE_EXACT, 1}, // Account name (label)
- {ui.SIZE_EXACT, 1}, // (input)
- {ui.SIZE_EXACT, 1}, // Padding
- {ui.SIZE_EXACT, 1}, // Full name (label)
- {ui.SIZE_EXACT, 1}, // (input)
- {ui.SIZE_EXACT, 1}, // Padding
- {ui.SIZE_EXACT, 1}, // Email address (label)
- {ui.SIZE_EXACT, 1}, // (input)
- {ui.SIZE_WEIGHT, 1},
+ {ui.SIZE_EXACT, ui.Const(8)}, // Introduction
+ {ui.SIZE_EXACT, ui.Const(1)}, // Account name (label)
+ {ui.SIZE_EXACT, ui.Const(1)}, // (input)
+ {ui.SIZE_EXACT, ui.Const(1)}, // Padding
+ {ui.SIZE_EXACT, ui.Const(1)}, // Full name (label)
+ {ui.SIZE_EXACT, ui.Const(1)}, // (input)
+ {ui.SIZE_EXACT, ui.Const(1)}, // Padding
+ {ui.SIZE_EXACT, ui.Const(1)}, // Email address (label)
+ {ui.SIZE_EXACT, ui.Const(1)}, // (input)
+ {ui.SIZE_WEIGHT, ui.Const(1)},
}).Columns([]ui.GridSpec{
- {ui.SIZE_WEIGHT, 1},
+ {ui.SIZE_WEIGHT, ui.Const(1)},
})
basics.AddChild(
ui.NewText("\nWelcome to aerc! Let's configure your account.\n\n" +
@@ -209,23 +209,23 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
})
incoming := ui.NewGrid().Rows([]ui.GridSpec{
- {ui.SIZE_EXACT, 3}, // Introduction
- {ui.SIZE_EXACT, 1}, // Username (label)
- {ui.SIZE_EXACT, 1}, // (input)
- {ui.SIZE_EXACT, 1}, // Padding
- {ui.SIZE_EXACT, 1}, // Password (label)
- {ui.SIZE_EXACT, 1}, // (input)
- {ui.SIZE_EXACT, 1}, // Padding
- {ui.SIZE_EXACT, 1}, // Server (label)
- {ui.SIZE_EXACT, 1}, // (input)
- {ui.SIZE_EXACT, 1}, // Padding
- {ui.SIZE_EXACT, 1}, // Connection mode (label)
- {ui.SIZE_EXACT, 2}, // (input)
- {ui.SIZE_EXACT, 1}, // Padding
- {ui.SIZE_EXACT, 1}, // Connection string
- {ui.SIZE_WEIGHT, 1},
+ {ui.SIZE_EXACT, ui.Const(3)}, // Introduction
+ {ui.SIZE_EXACT, ui.Const(1)}, // Username (label)
+ {ui.SIZE_EXACT, ui.Const(1)}, // (input)
+ {ui.SIZE_EXACT, ui.Const(1)}, // Padding
+ {ui.SIZE_EXACT, ui.Const(1)}, // Password (label)
+ {ui.SIZE_EXACT, ui.Const(1)}, // (input)
+ {ui.SIZE_EXACT, ui.Const(1)}, // Padding
+ {ui.SIZE_EXACT, ui.Const(1)}, // Server (label)
+ {ui.SIZE_EXACT, ui.Const(1)}, // (input)
+ {ui.SIZE_EXACT, ui.Const(1)}, // Padding
+ {ui.SIZE_EXACT, ui.Const(1)}, // Connection mode (label)
+ {ui.SIZE_EXACT, ui.Const(2)}, // (input)
+ {ui.SIZE_EXACT, ui.Const(1)}, // Padding
+ {ui.SIZE_EXACT, ui.Const(1)}, // Connection string
+ {ui.SIZE_WEIGHT, ui.Const(1)},
}).Columns([]ui.GridSpec{
- {ui.SIZE_WEIGHT, 1},
+ {ui.SIZE_WEIGHT, ui.Const(1)},
})
incoming.AddChild(ui.NewText("\nConfigure incoming mail (IMAP)"))
incoming.AddChild(
@@ -283,26 +283,26 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
})
outgoing := ui.NewGrid().Rows([]ui.GridSpec{
- {ui.SIZE_EXACT, 3}, // Introduction
- {ui.SIZE_EXACT, 1}, // Username (label)
- {ui.SIZE_EXACT, 1}, // (input)
- {ui.SIZE_EXACT, 1}, // Padding
- {ui.SIZE_EXACT, 1}, // Password (label)
- {ui.SIZE_EXACT, 1}, // (input)
- {ui.SIZE_EXACT, 1}, // Padding
- {ui.SIZE_EXACT, 1}, // Server (label)
- {ui.SIZE_EXACT, 1}, // (input)
- {ui.SIZE_EXACT, 1}, // Padding
- {ui.SIZE_EXACT, 1}, // Connection mode (label)
- {ui.SIZE_EXACT, 2}, // (input)
- {ui.SIZE_EXACT, 1}, // Padding
- {ui.SIZE_EXACT, 1}, // Connection string
- {ui.SIZE_EXACT, 1}, // Padding
- {ui.SIZE_EXACT, 1}, // Copy to sent (label)
- {ui.SIZE_EXACT, 2}, // (input)
- {ui.SIZE_WEIGHT, 1},
+ {ui.SIZE_EXACT, ui.Const(3)}, // Introduction
+ {ui.SIZE_EXACT, ui.Const(1)}, // Username (label)
+ {ui.SIZE_EXACT, ui.Const(1)}, // (input)
+ {ui.SIZE_EXACT, ui.Const(1)}, // Padding
+ {ui.SIZE_EXACT, ui.Const(1)}, // Password (label)
+ {ui.SIZE_EXACT, ui.Const(1)}, // (input)
+ {ui.SIZE_EXACT, ui.Const(1)}, // Padding
+ {ui.SIZE_EXACT, ui.Const(1)}, // Server (label)
+ {ui.SIZE_EXACT, ui.Const(1)}, // (input)
+ {ui.SIZE_EXACT, ui.Const(1)}, // Padding
+ {ui.SIZE_EXACT, ui.Const(1)}, // Connection mode (label)
+ {ui.SIZE_EXACT, ui.Const(2)}, // (input)
+ {ui.SIZE_EXACT, ui.Const(1)}, // Padding
+ {ui.SIZE_EXACT, ui.Const(1)}, // Connection string
+ {ui.SIZE_EXACT, ui.Const(1)}, // Padding
+ {ui.SIZE_EXACT, ui.Const(1)}, // Copy to sent (label)
+ {ui.SIZE_EXACT, ui.Const(2)}, // (input)
+ {ui.SIZE_WEIGHT, ui.Const(1)},
}).Columns([]ui.GridSpec{
- {ui.SIZE_WEIGHT, 1},
+ {ui.SIZE_WEIGHT, ui.Const(1)},
})
outgoing.AddChild(ui.NewText("\nConfigure outgoing mail (SMTP)"))
outgoing.AddChild(
@@ -374,10 +374,10 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
})
complete := ui.NewGrid().Rows([]ui.GridSpec{
- {ui.SIZE_EXACT, 7}, // Introduction
- {ui.SIZE_WEIGHT, 1}, // Previous / Finish / Finish & open tutorial
+ {ui.SIZE_EXACT, ui.Const(7)}, // Introduction
+ {ui.SIZE_WEIGHT, ui.Const(1)}, // Previous / Finish / Finish & open tutorial
}).Columns([]ui.GridSpec{
- {ui.SIZE_WEIGHT, 1},
+ {ui.SIZE_WEIGHT, ui.Const(1)},
})
complete.AddChild(ui.NewText(
"\nConfiguration complete!\n\n" +