diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-17 10:05:55 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-17 10:05:55 +0200 |
| commit | 47b6776c2cb9b017ad95acb5aae8e34b8776fc7c (patch) | |
| tree | 3efb4a2f2c36f4537a3fe1377cfb010fd63072ec /gui/internal/model/prefs.go | |
| parent | 0e067e693609589d46f5aa6e161b95cc905987cc (diff) | |
| download | krino-47b6776c2cb9b017ad95acb5aae8e34b8776fc7c.tar.gz krino-47b6776c2cb9b017ad95acb5aae8e34b8776fc7c.zip | |
gui: sort the plan by name, size, age, action or rule
Diffstat (limited to 'gui/internal/model/prefs.go')
| -rw-r--r-- | gui/internal/model/prefs.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gui/internal/model/prefs.go b/gui/internal/model/prefs.go index 6b3a6cb..2d2dc04 100644 --- a/gui/internal/model/prefs.go +++ b/gui/internal/model/prefs.go @@ -36,6 +36,9 @@ type Prefs struct { ShowSize bool `json:"show_size"` ShowAge bool `json:"show_age"` ShowRule bool `json:"show_rule"` + // Sort is the order a freshly scanned plan is read in; the picker in + // the toolbar changes it for the window in front of you. + Sort string `json:"sort"` // Layout is how the Plan tab is arranged: "side" puts the file list // beside the explanation, "stacked" puts it above, with the preview // beside the explanation underneath. @@ -60,7 +63,7 @@ const ( // DefaultPrefs is what a window does before anything is chosen. func DefaultPrefs() Prefs { return Prefs{Colours: true, Preview: true, SelectAll: true, - ShowSize: true, ShowAge: true, ShowRule: true, + ShowSize: true, ShowAge: true, ShowRule: true, Sort: SortDefault, PreviewHeight: DefaultPreviewHeight, PreviewWidth: DefaultPreviewWidth, ListWidth: DefaultListWidth, ListHeight: DefaultListHeight, Layout: LayoutSide} @@ -91,6 +94,9 @@ func LoadPrefs() Prefs { if p.Layout != LayoutSide && p.Layout != LayoutStacked { p.Layout = LayoutSide } + if !IsSortOrder(p.Sort) { + p.Sort = SortDefault + } return p } |
