extract function for webview properties handler

phoen
Daniel Barlow 2022-02-06 14:08:42 +00:00
parent 184aefa4dc
commit 1cd2247e02
1 changed files with 23 additions and 21 deletions

View File

@ -72,6 +72,28 @@ progress, trough {
))
(fn handle-webview-properties [self pspec bus]
(if (= pspec.name "uri")
(bus:publish
:url-changed self.uri)
(and (= pspec.name "title")
(> (# self.title) 0))
(bus:publish
:title-changed
self.title)
(= pspec.name
"estimated-load-progress")
(bus:publish
:loading-progress
self.estimated_load_progress)
(= pspec.name "is-loading")
(bus:publish
:loading? self.is_loading)
))
(let [current-url "https://terse.telent.net/admin/stream"
bus (event-bus)
r {}
@ -108,27 +130,7 @@ progress, trough {
})
webview (WebKit2.WebView {
:on_notify
(fn [self pspec c]
(if (= pspec.name "uri")
(bus:publish
:url-changed self.uri)
(and (= pspec.name "title")
(> (# self.title) 0))
(bus:publish
:title-changed
self.title)
(= pspec.name
"estimated-load-progress")
(bus:publish
:loading-progress
self.estimated_load_progress)
(= pspec.name "is-loading")
(bus:publish
:loading? self.is_loading)
))
#(handle-webview-properties $1 $2 bus)
})
back (doto
(Gtk.Button {