aboutsummaryrefslogtreecommitdiff
path: root/gui/internal/ui
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-17 12:11:42 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-17 12:11:42 +0200
commitbddbd74e4a73e8e32bcf648efd1cac5655f6d0cd (patch)
tree187e6a1fb722d9ab97d2076f69f997f5d371e943 /gui/internal/ui
parentcd7425b81f963a948f0abe7df3f9e58e190c2b78 (diff)
downloadkrino-bddbd74e4a73e8e32bcf648efd1cac5655f6d0cd.tar.gz
krino-bddbd74e4a73e8e32bcf648efd1cac5655f6d0cd.zip
comments that explain the code, not how it was written
About 340 comments cited the development process: task and plan numbers, fix waves, rulings, reviewers, and the author in the third person with a date. None of that exists outside the work itself, so to a reader it pointed at nothing. Each one now states the engineering reason it was standing in front of; where a comment was provenance and nothing else, it is gone. References to docs/design.md and docs/gui-design.md by section stay: both ship with the repository. The design documents lose their amendment diaries - CHANGELOG.md is that record - and the GUI's says plainly that the window has gone further than the document. Only comments changed. Every .go file was parsed and its code printed with comments stripped, before and after: the two hashes are identical across all 175 files.
Diffstat (limited to 'gui/internal/ui')
-rw-r--r--gui/internal/ui/forms.go18
-rw-r--r--gui/internal/ui/highlight.go2
-rw-r--r--gui/internal/ui/plan.go34
-rw-r--r--gui/internal/ui/rules.go4
-rw-r--r--gui/internal/ui/settings.go4
-rw-r--r--gui/internal/ui/window.go11
6 files changed, 33 insertions, 40 deletions
diff --git a/gui/internal/ui/forms.go b/gui/internal/ui/forms.go
index fd97546..a7211cb 100644
--- a/gui/internal/ui/forms.go
+++ b/gui/internal/ui/forms.go
@@ -18,15 +18,14 @@ import (
// condKinds are the tests a condition row offers, plus the three operators
// that hold other conditions. A row's entry holds that form's arguments
// exactly as they are written, so no test is out of reach of the form
-// editor and none is silently rewritten (see docs/gui-design.md §5.1 and
-// the deviation noted in plan 17).
+// editor and none is silently rewritten (see docs/gui-design.md §5.1).
var condKinds = []string{"type", "name", "path", "content", "size", "age",
"duplicate", "matched", "and", "or", "not"}
// condLabels is how the picker names them. The rows are already joined by
// "all of these must hold", so the three operators say what they are for -
// grouping conditions inside one row - rather than looking like the way to
-// join two rows (his report, 2026-09-16).
+// join two rows.
var condLabels = map[string]string{
"and": "and (all of these)",
"or": "or (any of these)",
@@ -299,7 +298,7 @@ var settingChoices = map[string][]string{
}
// settingHelp is what each setting does, shown when the pointer rests on
-// its row (his request, 2026-09-17). The wording follows krino.conf(5).
+// its row. The wording follows krino.conf(5).
var settingHelp = map[string]string{
"path": "the directory krino sorts; a directory's file must set it",
"recursive": "look in subdirectories too, not only the directory itself",
@@ -502,7 +501,7 @@ func (f *formsView) refreshLabels() {
f.forms = forms
for i, form := range forms {
// Row 0 is the directory itself, so form i is row i+1: without the
- // offset every label moved up a row after an edit (his report).
+ // offset every label moved up a row after an edit.
if row := f.list.RowAtIndex(i + 1); row != nil {
if label, ok := row.Child().(*gtk.Label); ok {
label.SetText(escape(formLabel(form)))
@@ -598,7 +597,7 @@ func (f *formsView) move(delta int) {
// onTestRule scans the directory with the unsaved text and lists the files
// the selected rule would take, in the pane on the right. It reads only -
// no lock, nothing moved - but takes as long as a scan, so it runs off the
-// main loop (his request, 2026-09-16).
+// main loop.
func (f *formsView) onTestRule() {
if f.sel < 0 || f.sel >= len(f.forms) {
f.owner.showTestOutput("Select a rule in the list first.")
@@ -694,8 +693,7 @@ func newFormEditor(form model.Form, changed func()) *formEditor {
// An exclude has no rule behind it and a rule may have no (when ...) at
// all, so neither pointer is followed without asking first: reading
- // form.Rule for an exclude crashed the window (found by the release
- // checklist, 2026-09-17).
+ // form.Rule for an exclude crashed the window.
var when []*sexp.Node
switch {
case form.Kind == model.ExcludeForm:
@@ -784,7 +782,7 @@ func (fe *formEditor) text() (string, error) {
// drawConds rebuilds the condition tree: one row per condition, indented by
// how deep it sits, with the operators holding the conditions under them
-// (GUI design §5.1, his choice 2026-09-17).
+// (GUI design §5.1).
func (fe *formEditor) drawConds() {
for child := fe.conds.FirstChild(); child != nil; child = fe.conds.FirstChild() {
fe.conds.Remove(child)
@@ -918,7 +916,7 @@ var compareOps = []string{">", ">=", "<", "<=", "="}
// condRow is one condition: its kind, and its arguments. A size or an age
// is a comparison, so it gets an operator of its own and a value to type
-// rather than one field holding both (his request, 2026-09-16).
+// rather than one field holding both.
type condRow struct {
root *gtk.Box
kind *gtk.DropDown
diff --git a/gui/internal/ui/highlight.go b/gui/internal/ui/highlight.go
index 8a4acd4..786acee 100644
--- a/gui/internal/ui/highlight.go
+++ b/gui/internal/ui/highlight.go
@@ -10,7 +10,7 @@ import (
// The colours a configuration is painted in. They are chosen to read on a
// light and a dark theme alike, since the window follows whatever GTK theme
-// is in use (his request, 2026-09-16).
+// is in use.
var spanColours = map[model.SpanKind]string{
model.SpanComment: "#8b8b8b",
model.SpanString: "#2e8b57",
diff --git a/gui/internal/ui/plan.go b/gui/internal/ui/plan.go
index 650668c..bcbb8a2 100644
--- a/gui/internal/ui/plan.go
+++ b/gui/internal/ui/plan.go
@@ -97,7 +97,7 @@ func newPlanView(w *Window) *planView {
p.dirs.Connect("notify::selected", p.showPath)
p.scan = gtk.NewButtonWithLabel("Scan")
// The one button that starts everything, so it carries the theme's
- // accent like Apply does (his request, 2026-09-17).
+ // accent like Apply does.
p.scan.AddCSSClass("suggested-action")
p.scan.SetTooltipText("read the directory and work out what would happen to each file; nothing is touched until Apply")
p.selAll = gtk.NewButtonWithLabel("Select all")
@@ -120,13 +120,13 @@ func newPlanView(w *Window) *planView {
p.filter.SetSizeRequest(200, -1)
// The order the plan is read in. It starts as the settings say and can
- // be changed for this window alone (his request, 2026-09-17).
+ // be changed for this window alone.
p.sort = gtk.NewDropDownFromStrings(sortItems())
p.sort.SetTooltipText("the order the plan is listed in; Settings has the one a new window starts with")
// The bar reads as the order of operations: which directory, how it
// will be listed, what of it, where it is on disk - then Scan, and only
- // then what to do with what comes back (his request, 2026-09-17).
+ // then what to do with what comes back.
bar.Append(gtk.NewLabel("Directory"))
bar.Append(p.dirs)
bar.Append(gtk.NewLabel("sort"))
@@ -160,7 +160,7 @@ func newPlanView(w *Window) *planView {
// The explanation is laid out rather than printed: the file's name, then
// a line per step with the action in its own colour, centred in the
- // pane so the eye lands on it (his request, 2026-09-17).
+ // pane so the eye lands on it.
p.details = gtk.NewBox(gtk.OrientationVertical, 6)
p.details.SetHAlign(gtk.AlignCenter)
p.details.SetVAlign(gtk.AlignStart)
@@ -176,7 +176,7 @@ func newPlanView(w *Window) *planView {
// Under the explanation, a look at the file itself: a picture for an
// image, the first page for a PDF, the first lines for anything that is
- // text (his request, 2026-09-16).
+ // text.
p.previewNote = gtk.NewLabel("")
p.previewNote.SetXAlign(0)
p.previewNote.SetMarginStart(8)
@@ -186,7 +186,7 @@ func newPlanView(w *Window) *planView {
p.previewNote.AddCSSClass("dim-label")
// The picture fills whatever the divider leaves it. Inside a scrolled
// window it would be given its smallest size instead, which is what
- // made the page a stamp (his report, 2026-09-17).
+ // made the page a stamp.
p.picture = gtk.NewPicture()
p.picture.SetCanShrink(true)
p.picture.SetContentFit(gtk.ContentFitContain)
@@ -252,7 +252,7 @@ func newPlanView(w *Window) *planView {
}
// checkedMenu is "With checked": the same two overrides the row menu has,
-// for every file that is checked at once (his request, 2026-09-17).
+// for every file that is checked at once.
func (p *planView) checkedMenu() *gtk.MenuButton {
box := gtk.NewBox(gtk.OrientationVertical, 0)
trash := gtk.NewButtonWithLabel("Trash them instead")
@@ -603,7 +603,7 @@ func (p *planView) setBusy(busy bool) {
// selectAll checks or unchecks every file that can be applied - and, while
// a filter is on, only the files it leaves on screen, so what Apply acts on
-// is what was in front of him.
+// is what is visible.
func (p *planView) selectAll(on bool) {
if p.tab == nil {
return
@@ -670,8 +670,7 @@ func (p *planView) fillList() {
p.selNone.SetSensitive(!p.tab.Applied)
p.sayWhatIsShown()
// A fresh list starts at its left edge: without this the view can open
- // scrolled sideways, with the file names out of sight (his report,
- // 2026-09-17).
+ // scrolled sideways, with the file names out of sight.
if adj := p.listScroll.HAdjustment(); adj != nil {
adj.SetValue(0)
}
@@ -680,7 +679,7 @@ func (p *planView) fillList() {
// widths is how wide each column has to be for this plan: enough for the
// longest value it holds, within limits, so a rule name or an outcome is
// shown whole rather than cut to an ellipsis. The list scrolls sideways
-// when the total does not fit (his report, 2026-09-16).
+// when the total does not fit.
func (p *planView) widths() [7]int {
w := [7]int{16, 5, 4, 6, 16, 8, 6}
root := p.dirRoot()
@@ -701,7 +700,7 @@ func (p *planView) widths() [7]int {
w[i] = min(w[i], cap)
}
// A column is never narrower than its own heading, or the heading is
- // the thing that ends in an ellipsis (his report, 2026-09-17).
+ // the thing that ends in an ellipsis.
for i, title := range columnTitles {
w[i] = max(w[i], len([]rune(title)))
}
@@ -830,8 +829,7 @@ func (p *planView) rowWidget(i int, r model.Row, w [7]int) *gtk.ListBoxRow {
// ever the column cut to an ellipsis.
action, colour := rowAction(r)
// Every column can shrink: a pane narrower than their natural widths
- // used to push the whole row out of view to the left (his report,
- // 2026-09-17).
+ // used to push the whole row out of view to the left.
cells := [7]gtk.Widgetter{
colFile: columnMin(escape(r.Rel), w[colFile], 12, true),
colSize: columnMin(model.SizeText(r.Size), w[colSize], 4, false),
@@ -949,8 +947,7 @@ func (p *planView) showDetails(i int) {
p.details.Append(detailLine(what, "dim-label"))
}
// Where the other copy is, in full: the reason names it relative to the
- // directory when it is inside it, which reads as no place at all (his
- // report, 2026-09-17).
+ // directory when it is inside it, which reads as no place at all.
if r.DuplicateOf != "" {
p.details.Append(detailLine("the same bytes as "+escape(xdg.Abbrev(r.DuplicateOf)), "dim-label"))
}
@@ -1058,9 +1055,8 @@ func (p *planView) showPreview(rel string) {
}
// setLayout arranges the tab the way the settings ask: the file list beside
-// the explanation, or above it with the preview to its side (his sketch,
-// 2026-09-17). The widgets are the same either way; only the panes holding
-// them change.
+// the explanation, or above it with the preview to its side. The widgets
+// are the same either way; only the panes holding them change.
func (p *planView) setLayout(which string) {
if p.layout == which && p.arrangement != nil {
return
diff --git a/gui/internal/ui/rules.go b/gui/internal/ui/rules.go
index 5cce276..62cf074 100644
--- a/gui/internal/ui/rules.go
+++ b/gui/internal/ui/rules.go
@@ -102,7 +102,7 @@ func newRulesView(w *Window) *rulesView {
// Line numbers: their own view beside the editor, in the same scrolled
// window so the two always line up. The editor does not wrap, so one
- // line of text is one line on screen (his request, 2026-09-16).
+ // line of text is one line on screen.
r.nums = gtk.NewTextView()
r.nums.SetMonospace(true)
r.nums.SetEditable(false)
@@ -185,7 +185,7 @@ func newRulesView(w *Window) *rulesView {
r.root.Append(gtk.NewSeparator(gtk.OrientationHorizontal))
r.root.Append(panes)
// The problems sit under both sub-tabs: a form's mistake is reported
- // where the form is, not only in the text (his report, 2026-09-16).
+ // where the form is, not only in the text.
r.root.Append(gtk.NewSeparator(gtk.OrientationHorizontal))
r.root.Append(diagScroll)
diff --git a/gui/internal/ui/settings.go b/gui/internal/ui/settings.go
index 73c4072..79dba6a 100644
--- a/gui/internal/ui/settings.go
+++ b/gui/internal/ui/settings.go
@@ -13,7 +13,7 @@ import (
// inherits, and how this window behaves. The first are written to
// krino.conf with the care a rules file is written with - checked first,
// the previous text kept as krino.conf.bak - and the second to gui.json,
-// which krino itself never reads (his request, 2026-09-16).
+// which krino itself never reads.
type settingsWindow struct {
w *Window
win *gtk.Window
@@ -175,7 +175,7 @@ func (w *Window) showSettings() {
closeBtn := gtk.NewButtonWithLabel("Close")
closeBtn.ConnectClicked(func() { s.win.Close() })
// The buttons sit outside the scrolled area: on a short screen they
- // would otherwise be below the fold, which is where he found them.
+ // would otherwise be below the fold, where they are easy to miss.
buttons := gtk.NewBox(gtk.OrientationHorizontal, 6)
buttons.SetHAlign(gtk.AlignEnd)
buttons.SetMarginStart(12)
diff --git a/gui/internal/ui/window.go b/gui/internal/ui/window.go
index 5132c12..c52234b 100644
--- a/gui/internal/ui/window.go
+++ b/gui/internal/ui/window.go
@@ -67,7 +67,7 @@ func NewWindow(app *gtk.Application, e *engine.Engine) *Window {
})
// Settings sits at the end of the tab strip - the window's top right -
- // with a gear beside the word (his request, 2026-09-17).
+ // with a gear beside the word.
settings := gtk.NewButton()
settingsBox := gtk.NewBox(gtk.OrientationHorizontal, 6)
settingsBox.Append(gtk.NewImageFromIconName("emblem-system-symbolic"))
@@ -100,7 +100,7 @@ func NewWindow(app *gtk.Application, e *engine.Engine) *Window {
// holds, rather than leaving a lock file for the next run to find.
w.win.ConnectCloseRequest(func() bool {
// A plan is only a plan until Apply: leaving with one open throws
- // it away, which is worth saying out loud (his report, 2026-09-17).
+ // it away, which is worth saying out loud.
if w.plan.hasUnapplied() && !w.leaving {
w.confirmLeaving()
return true
@@ -154,7 +154,7 @@ func (w *Window) confirmLeaving() {
}
// addDirectory asks for a name and a path and makes krino sort that
-// directory too - the window had no way to do it (his report, 2026-09-17).
+// directory too - the window had no way to do it.
func (w *Window) addDirectory() {
d := gtk.NewWindow()
d.SetTitle("Add a directory")
@@ -311,7 +311,7 @@ func runInBackground(work func(context.Context) error, done func(error)) context
// deletions without reading: they are the ones that cannot be undone from
// the window. They are the fallbacks; themeColours replaces them with the
// running theme's own, so the window looks like the rest of the desktop
-// rather than like GNOME's palette (his request, 2026-09-17).
+// rather than like GNOME's palette.
var actionColours = map[plan.Kind]string{
plan.Copy: "#2a9d8f",
plan.Move: "#3584e4",
@@ -323,8 +323,7 @@ var actionColours = map[plan.Kind]string{
// actionClasses name the CSS class each action's cell carries. The colour
// is applied by a style sheet rather than by painting the text, so that a
// selected row - which draws its own background - can take the colour back
-// and stay readable: his green accent on his green selection was not (his
-// report, 2026-09-17).
+// and stay readable: a green accent on a green selection is not.
var actionClasses = map[plan.Kind]string{
plan.Copy: "krino-copy",
plan.Move: "krino-move",