From 24613ea424d6bc24187645b73184762673ac0be7 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Mon, 2 Jan 2023 22:03:03 +0000 Subject: [PATCH] hook up the history logger thing --- dunlin.fnl | 4 ++++ frame.fnl | 9 ++++++--- history.fnl | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dunlin.fnl b/dunlin.fnl index ad12363..2935ab0 100644 --- a/dunlin.fnl +++ b/dunlin.fnl @@ -18,6 +18,10 @@ } }) +(local history (require :history)) +(tset _G :history (history.open + (.. (os.getenv "HOME") "/.dunlin-history.db"))) + (let [f (Frame.new my-keymap) b (Buffer.new "main")] (f:show-buffer b) diff --git a/frame.fnl b/frame.fnl index 468e318..f98f68f 100644 --- a/frame.fnl +++ b/frame.fnl @@ -38,12 +38,15 @@ contentwidget (Gtk.Box { :orientation Gtk.Orientation.VERTICAL }) - update-prop (fn [name value] + update-prop (fn [props name value] (match name :estimated-load-progress (tset progress-bar :fraction value) :uri - (tset echo-area :label value) + (do (tset echo-area :label value) + (_G.history:visit value (os.time))) + :title + (_G.history:title self.buffer.properties.uri value) n (comment (print "prop change" n value))))] @@ -91,7 +94,7 @@ (b:subscribe-property-changes (fn [name val] (if (= b self.buffer) - (update-prop name val) + (update-prop self name val) (print "ignore props from background" b)))) (b.webview:show)) }] diff --git a/history.fnl b/history.fnl index 60aa2cf..daac8d6 100644 --- a/history.fnl +++ b/history.fnl @@ -42,7 +42,7 @@ (icollect [r (s:nrows)] r))) (fn open [pathname] - (let [db (if pathname (sqlite:open pathname) (sqlite:open_memory))] + (let [db (if pathname (sqlite.open pathname) (sqlite.open_memory))] (migrate-all db) { : db