eufon

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 9306d55c5d9d7558f366c0ec595a127673aa75f2
parent 35e2d56af719139bcdd4c3ab246160596693cb95
Author: Daniel Barlow <dan@telent.net>
Date:   Sun,  6 Feb 2022 14:26:58 +0000

replace stop-refresh with two separate buttons

and show/hide them depending on context.
This means we can get rid of the `r` we were using for
forward references to `webview`

Diffstat:
Mjust/just.fnl | 31+++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/just/just.fnl b/just/just.fnl @@ -85,12 +85,11 @@ progress, trough { (bus:publish :loading-progress self.estimated_load_progress) "is-loading" - (bus:publish :loading? self.is_loading) + (bus:publish (if self.is_loading :start-loading :stop-loading)) )) (let [current-url "https://terse.telent.net/admin/stream" bus (event-bus) - r {} window (Gtk.Window { :title "Just browsing" :default_width 800 @@ -114,14 +113,14 @@ progress, trough { (bus:publish :fetch self.text)) }) (: :set_text current-url)) - stop-refresh (Gtk.Button { - :on_clicked - (fn [s] - (bus:publish - (if r.webview.is_loading - :stop-loading - :reload))) - }) + stop (doto (Gtk.Button { + :on_clicked #(bus:publish :stop-loading) + }) + (: :set_image (named-image "process-stop"))) + refresh (doto (Gtk.Button { + :on_clicked #(bus:publish :reload) + }) + (: :set_image (named-image "view-refresh"))) webview (WebKit2.WebView { :on_notify #(handle-webview-properties $1 $2 bus) @@ -144,17 +143,17 @@ progress, trough { (.. $1 " - Just browsing"))) (bus:subscribe :loading-progress #(tset progress-bar :fraction $1)) - (bus:subscribe :loading? - #(stop-refresh:set_image - (named-image - (if $1 "process-stop" "view-refresh")))) + (bus:subscribe :start-loading + (fn [] (stop:show) (refresh:hide))) + (bus:subscribe :stop-loading + (fn [] (stop:hide) (refresh:show))) - (tset r :webview webview) (load-adblocks webview.user_content_manager content-filter-store) (nav-bar:pack_start back false false 2) (nav-bar:pack_start url true true 2) - (nav-bar:pack_end stop-refresh false false 2) + (nav-bar:pack_end refresh false false 2) + (nav-bar:pack_end stop false false 2) (container:pack_start nav-bar false false 5) (container:pack_start progress-bar false false 0)