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`
This commit is contained in:
parent
35e2d56af7
commit
9306d55c5d
@ -85,12 +85,11 @@ progress, trough {
|
|||||||
(bus:publish :loading-progress self.estimated_load_progress)
|
(bus:publish :loading-progress self.estimated_load_progress)
|
||||||
|
|
||||||
"is-loading"
|
"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"
|
(let [current-url "https://terse.telent.net/admin/stream"
|
||||||
bus (event-bus)
|
bus (event-bus)
|
||||||
r {}
|
|
||||||
window (Gtk.Window {
|
window (Gtk.Window {
|
||||||
:title "Just browsing"
|
:title "Just browsing"
|
||||||
:default_width 800
|
:default_width 800
|
||||||
@ -114,14 +113,14 @@ progress, trough {
|
|||||||
(bus:publish :fetch self.text))
|
(bus:publish :fetch self.text))
|
||||||
})
|
})
|
||||||
(: :set_text current-url))
|
(: :set_text current-url))
|
||||||
stop-refresh (Gtk.Button {
|
stop (doto (Gtk.Button {
|
||||||
:on_clicked
|
:on_clicked #(bus:publish :stop-loading)
|
||||||
(fn [s]
|
|
||||||
(bus:publish
|
|
||||||
(if r.webview.is_loading
|
|
||||||
:stop-loading
|
|
||||||
:reload)))
|
|
||||||
})
|
})
|
||||||
|
(: :set_image (named-image "process-stop")))
|
||||||
|
refresh (doto (Gtk.Button {
|
||||||
|
:on_clicked #(bus:publish :reload)
|
||||||
|
})
|
||||||
|
(: :set_image (named-image "view-refresh")))
|
||||||
webview (WebKit2.WebView {
|
webview (WebKit2.WebView {
|
||||||
:on_notify
|
:on_notify
|
||||||
#(handle-webview-properties $1 $2 bus)
|
#(handle-webview-properties $1 $2 bus)
|
||||||
@ -144,17 +143,17 @@ progress, trough {
|
|||||||
(.. $1 " - Just browsing")))
|
(.. $1 " - Just browsing")))
|
||||||
|
|
||||||
(bus:subscribe :loading-progress #(tset progress-bar :fraction $1))
|
(bus:subscribe :loading-progress #(tset progress-bar :fraction $1))
|
||||||
(bus:subscribe :loading?
|
(bus:subscribe :start-loading
|
||||||
#(stop-refresh:set_image
|
(fn [] (stop:show) (refresh:hide)))
|
||||||
(named-image
|
(bus:subscribe :stop-loading
|
||||||
(if $1 "process-stop" "view-refresh"))))
|
(fn [] (stop:hide) (refresh:show)))
|
||||||
|
|
||||||
(tset r :webview webview)
|
|
||||||
(load-adblocks webview.user_content_manager content-filter-store)
|
(load-adblocks webview.user_content_manager content-filter-store)
|
||||||
|
|
||||||
(nav-bar:pack_start back false false 2)
|
(nav-bar:pack_start back false false 2)
|
||||||
(nav-bar:pack_start url true true 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 nav-bar false false 5)
|
||||||
(container:pack_start progress-bar false false 0)
|
(container:pack_start progress-bar false false 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user