aboutsummaryrefslogtreecommitdiff
path: root/gui/internal/ui
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-17 00:32:04 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-17 00:32:04 +0200
commit4744ffac60b9bde27616f34a934f9404bc314efc (patch)
tree0366f6abb1062fc23ab72f8ab47fb7114bed5944 /gui/internal/ui
parent04b4243ad31d144c4caf9be4c5096a0f27a2648e (diff)
downloadkrino-4744ffac60b9bde27616f34a934f9404bc314efc.tar.gz
krino-4744ffac60b9bde27616f34a934f9404bc314efc.zip
gui: a rendered PDF page per file, and Settings in the top right
Diffstat (limited to 'gui/internal/ui')
-rw-r--r--gui/internal/ui/plan.go17
-rw-r--r--gui/internal/ui/window.go17
2 files changed, 30 insertions, 4 deletions
diff --git a/gui/internal/ui/plan.go b/gui/internal/ui/plan.go
index 97d8599..f4ecb91 100644
--- a/gui/internal/ui/plan.go
+++ b/gui/internal/ui/plan.go
@@ -45,6 +45,7 @@ type planView struct {
previewScroll *gtk.ScrolledWindow
previewTmp string
previewFor string
+ renderedDir string
previewOff bool
startSelected bool
menu *gtk.Popover
@@ -573,9 +574,16 @@ func (p *planView) showPreview(rel string) {
p.picture.SetFilename(pv.Image)
p.picture.SetVisible(true)
p.pictureFrame.SetVisible(true)
+ // The picture is loaded, so the page rendered for the row
+ // before it can go.
+ p.dropRendered()
+ p.renderedDir = pv.Dir
case model.PreviewText:
p.previewText.Buffer().SetText(escapeText(pv.Text))
p.previewScroll.SetVisible(true)
+ p.dropRendered()
+ default:
+ p.dropRendered()
}
})
}
@@ -593,8 +601,17 @@ func (p *planView) applyPrefs(prefs model.Prefs) {
}
}
+// dropRendered removes the page rendered for the previous row.
+func (p *planView) dropRendered() {
+ if p.renderedDir != "" {
+ os.RemoveAll(p.renderedDir)
+ p.renderedDir = ""
+ }
+}
+
// closePreview removes what the previews left behind.
func (p *planView) closePreview() {
+ p.dropRendered()
if p.previewTmp != "" {
os.RemoveAll(p.previewTmp)
p.previewTmp = ""
diff --git a/gui/internal/ui/window.go b/gui/internal/ui/window.go
index 9727846..819591c 100644
--- a/gui/internal/ui/window.go
+++ b/gui/internal/ui/window.go
@@ -58,6 +58,19 @@ 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).
+ settings := gtk.NewButton()
+ settingsBox := gtk.NewBox(gtk.OrientationHorizontal, 6)
+ settingsBox.Append(gtk.NewImageFromIconName("emblem-system-symbolic"))
+ settingsBox.Append(gtk.NewLabel("Settings"))
+ settings.SetChild(settingsBox)
+ settings.SetHasFrame(false)
+ settings.SetTooltipText("krino's defaults, and how this window behaves")
+ settings.SetMarginEnd(6)
+ settings.ConnectClicked(func() { w.showSettings() })
+ notebook.SetActionWidget(settings, gtk.PackEnd)
+
w.status = gtk.NewLabel("")
w.status.SetXAlign(0)
w.status.SetMarginStart(8)
@@ -65,13 +78,9 @@ func NewWindow(app *gtk.Application, e *engine.Engine) *Window {
w.status.SetMarginTop(4)
w.status.SetMarginBottom(4)
- settings := gtk.NewButtonWithLabel("Settings")
- settings.SetHasFrame(false)
- settings.ConnectClicked(func() { w.showSettings() })
statusRow := gtk.NewBox(gtk.OrientationHorizontal, 6)
w.status.SetHExpand(true)
statusRow.Append(w.status)
- statusRow.Append(settings)
box := gtk.NewBox(gtk.OrientationVertical, 0)
notebook.SetVExpand(true)