viewplex: index views by Notebook page number
This commit is contained in:
parent
f225793fb0
commit
24052ac10d
@ -21,9 +21,6 @@
|
||||
(.. cache-dir "/cookies.db")
|
||||
WebKit2.CookiePersistentStorage.SQLITE))
|
||||
|
||||
|
||||
|
||||
|
||||
(fn named-image [name size]
|
||||
(Gtk.Image.new_from_icon_name
|
||||
name
|
||||
|
@ -10,25 +10,26 @@
|
||||
:show_tabs false
|
||||
;;# :on_switch_page
|
||||
})
|
||||
views []]
|
||||
views {}]
|
||||
(var foreground-view nil)
|
||||
{
|
||||
:listen (fn [_ name fun]
|
||||
(if (not (. relay-events name))
|
||||
(each [_ v (ipairs views)]
|
||||
(v:listen name #(listeners:notify name $1))))
|
||||
(each [_ v (pairs views)]
|
||||
(table.insert relay-events name)
|
||||
(listeners:add name fun))
|
||||
:widget widget
|
||||
:add-view (fn [self webview]
|
||||
(set foreground-view webview)
|
||||
(webview.widget:show)
|
||||
(table.insert views webview)
|
||||
(each [_ event-name (ipairs relay-events)]
|
||||
(webview:listen event-name
|
||||
#(listeners:notify event-name $1)))
|
||||
(set widget.page
|
||||
(widget:append_page webview.widget)))
|
||||
(let [page (widget:append_page webview.widget)]
|
||||
(tset views page webview)
|
||||
(set widget.page page)
|
||||
page))
|
||||
:visit #(and foreground-view (foreground-view:visit $2))
|
||||
:stop-loading #(and foreground-view
|
||||
(foreground-view:stop-loading))
|
||||
|
Loading…
Reference in New Issue
Block a user