extract function for webview properties handler
This commit is contained in:
parent
184aefa4dc
commit
1cd2247e02
@ -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"
|
(let [current-url "https://terse.telent.net/admin/stream"
|
||||||
bus (event-bus)
|
bus (event-bus)
|
||||||
r {}
|
r {}
|
||||||
@ -108,27 +130,7 @@ progress, trough {
|
|||||||
})
|
})
|
||||||
webview (WebKit2.WebView {
|
webview (WebKit2.WebView {
|
||||||
:on_notify
|
:on_notify
|
||||||
(fn [self pspec c]
|
#(handle-webview-properties $1 $2 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)
|
|
||||||
))
|
|
||||||
})
|
})
|
||||||
back (doto
|
back (doto
|
||||||
(Gtk.Button {
|
(Gtk.Button {
|
||||||
|
Loading…
Reference in New Issue
Block a user