still WIP tab overview page
This commit is contained in:
parent
e07e04f28f
commit
fa9c818b73
@ -6,6 +6,9 @@ Touchscreen-friendly wrapper around Webkit
|
|||||||
|
|
||||||
- downloads (pass to download manager)
|
- downloads (pass to download manager)
|
||||||
- support multiple tabs
|
- support multiple tabs
|
||||||
|
- allow closing tabs
|
||||||
|
- better tab overview page
|
||||||
|
- hook up url bar & title to show info for current tab
|
||||||
- find out if it's going to eat cpu like luakit does
|
- find out if it's going to eat cpu like luakit does
|
||||||
- some kind of bookmarks/favourites/pinned tabs/memory of visited sites
|
- some kind of bookmarks/favourites/pinned tabs/memory of visited sites
|
||||||
- ESC in url bar cancels typing
|
- ESC in url bar cancels typing
|
||||||
|
@ -104,15 +104,42 @@ progress, trough {
|
|||||||
(load-adblocks webview.user_content_manager content-filter-store)
|
(load-adblocks webview.user_content_manager content-filter-store)
|
||||||
webview))
|
webview))
|
||||||
|
|
||||||
|
(fn update-tab-overview [bus tabs scrolledwindow]
|
||||||
|
(let [box (Gtk.Box {
|
||||||
|
:orientation Gtk.Orientation.VERTICAL
|
||||||
|
})]
|
||||||
|
|
||||||
|
(each [_ w (ipairs (scrolledwindow:get_children))]
|
||||||
|
(scrolledwindow:remove w))
|
||||||
|
|
||||||
|
(each [i w (pairs tabs)]
|
||||||
|
(when (> i 0)
|
||||||
|
(box:pack_start (Gtk.Button {
|
||||||
|
:label w.title
|
||||||
|
:on_clicked
|
||||||
|
#(bus:publish :switch-tab i)
|
||||||
|
})
|
||||||
|
false false 5)))
|
||||||
|
(scrolledwindow:add box)
|
||||||
|
(scrolledwindow:show_all)
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
(fn pane-cave [bus]
|
(fn pane-cave [bus]
|
||||||
(let [widget (Gtk.Notebook { :show_tabs false })
|
(let [tabs {}
|
||||||
tabs {}
|
widget (Gtk.Notebook {
|
||||||
new-tab (fn []
|
:show_tabs false
|
||||||
(print "new tab")
|
:on_switch_page
|
||||||
(let [v (new-webview bus)
|
(fn [self page num]
|
||||||
|
(when (= num 0)
|
||||||
|
(update-tab-overview bus tabs page)))
|
||||||
|
})
|
||||||
|
new-tab (fn [self child]
|
||||||
|
(let [v (or child (new-webview bus))
|
||||||
i (widget:append_page v)]
|
i (widget:append_page v)]
|
||||||
(tset tabs i v)
|
(tset tabs i v)
|
||||||
(v:show)
|
(v:show)
|
||||||
|
(set widget.page i)
|
||||||
v))
|
v))
|
||||||
current #(. tabs widget.page)]
|
current #(. tabs widget.page)]
|
||||||
(bus:subscribe :fetch #(match (current) c (c:load_uri $1)))
|
(bus:subscribe :fetch #(match (current) c (c:load_uri $1)))
|
||||||
@ -123,22 +150,22 @@ progress, trough {
|
|||||||
(bus:subscribe :go-back
|
(bus:subscribe :go-back
|
||||||
#(match (current) c (and (c:can_go_back) (c:go_back))))
|
#(match (current) c (and (c:can_go_back) (c:go_back))))
|
||||||
(bus:subscribe :new-tab new-tab)
|
(bus:subscribe :new-tab new-tab)
|
||||||
|
(bus:subscribe :switch-tab (fn [i] (widget:set_current_page i)))
|
||||||
|
|
||||||
|
(new-tab nil (Gtk.ScrolledWindow))
|
||||||
{
|
{
|
||||||
:new-tab new-tab
|
:new-tab new-tab
|
||||||
:current-tab current
|
:current-tab current
|
||||||
:widget widget
|
:widget widget
|
||||||
:next-tab (fn [self]
|
:show-tab-overview #(widget:set_current_page 0)
|
||||||
(let [n (+ 1 widget.page)]
|
|
||||||
(widget:set_current_page (if (. tabs n) n 0)))
|
|
||||||
(widget:get_current_page))
|
|
||||||
}))
|
}))
|
||||||
|
|
||||||
(let [current-url "https://terse.telent.net"
|
(let [current-url "https://terse.telent.net"
|
||||||
bus (event-bus)
|
bus (event-bus)
|
||||||
window (Gtk.Window {
|
window (Gtk.Window {
|
||||||
:title "Just browsing"
|
:title "Just browsing"
|
||||||
:default_width 800
|
:default_width 360
|
||||||
:default_height 600
|
:default_height 720
|
||||||
:on_destroy Gtk.main_quit
|
:on_destroy Gtk.main_quit
|
||||||
})
|
})
|
||||||
container (Gtk.Box {
|
container (Gtk.Box {
|
||||||
@ -169,9 +196,9 @@ progress, trough {
|
|||||||
})
|
})
|
||||||
(: :set_image (named-image "view-refresh")))
|
(: :set_image (named-image "view-refresh")))
|
||||||
views (pane-cave bus)
|
views (pane-cave bus)
|
||||||
next-tab (Gtk.Button {
|
show-tabs (Gtk.Button {
|
||||||
:label ">>"
|
:label "><"
|
||||||
:on_clicked #(views:next-tab)
|
:on_clicked #(views:show-tab-overview)
|
||||||
})
|
})
|
||||||
|
|
||||||
back (doto
|
back (doto
|
||||||
@ -197,7 +224,7 @@ progress, trough {
|
|||||||
(nav-bar:pack_start refresh false false 2)
|
(nav-bar:pack_start refresh false false 2)
|
||||||
(nav-bar:pack_start stop false false 2)
|
(nav-bar:pack_start stop false false 2)
|
||||||
(nav-bar:pack_start url true true 2)
|
(nav-bar:pack_start url true true 2)
|
||||||
(nav-bar:pack_end next-tab false false 2)
|
(nav-bar:pack_end show-tabs false false 2)
|
||||||
(nav-bar:pack_end new-tab false false 2)
|
(nav-bar:pack_end new-tab false false 2)
|
||||||
|
|
||||||
(container:pack_start nav-bar false false 5)
|
(container:pack_start nav-bar false false 5)
|
||||||
|
Loading…
Reference in New Issue
Block a user