Merge branch 'main' of github.com:telent/just

phoen
Daniel Barlow 2022-02-19 15:46:09 +00:00
commit 64cd3a986c
2 changed files with 26 additions and 12 deletions

View File

@ -159,7 +159,6 @@ progress, trough {
(box:add (Gtk.Label { :label "Open tabs" })) (box:add (Gtk.Label { :label "Open tabs" }))
(each [i w (pairs tabs)] (each [i w (pairs tabs)]
(when (> i 0) (when (> i 0)
(box:pack_start (box:pack_start
@ -172,6 +171,15 @@ progress, trough {
(load-webview-thumbnail w)) (load-webview-thumbnail w))
false false 5))) false false 5)))
(box:pack_start (Gtk.Button
{
:label " + "
:width 300
:height 200
:on_clicked #(bus:publish $1 :new-tab)
})
false false 5)
(scrolledwindow:add box) (scrolledwindow:add box)
(scrolledwindow:show_all) (scrolledwindow:show_all)
)) ))
@ -186,13 +194,16 @@ progress, trough {
(when (= num 0) (when (= num 0)
(update-tab-overview bus tabs page))) (update-tab-overview bus tabs page)))
}) })
new-tab (fn [self child] add-page (fn [v]
(let [v (or child (new-webview bus)) (let [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) (set widget.page i)
v)) v))
new-tab (fn [self]
(let [v (add-page (new-webview bus))]
(v:load_uri "about:blank")
v))
tab-overview (Gtk.ScrolledWindow) tab-overview (Gtk.ScrolledWindow)
current #(. tabs widget.page)] current #(. tabs widget.page)]
(bus:subscribe :fetch #(match (current) c (c:load_uri $2))) (bus:subscribe :fetch #(match (current) c (c:load_uri $2)))
@ -218,13 +229,17 @@ progress, trough {
(tset tabs i nil) (tset tabs i nil)
(update-tab-overview bus tabs tab-overview) (update-tab-overview bus tabs tab-overview)
(widget:set_current_page 0))) (widget:set_current_page 0)))
(new-tab nil tab-overview) (add-page tab-overview)
{ {
:new-tab new-tab :new-tab new-tab
:current-tab current :current-tab current
:widget widget :widget widget
:show-tab-overview #(widget:set_current_page 0) :show-tab-overview (fn []
(widget:set_current_page 0)
(bus:publish tab-overview :url-changed false)
(bus:publish tab-overview :title-changed "Open tabs"))
})) }))
(local completions (local completions
@ -261,10 +276,6 @@ progress, trough {
:on_clicked #(bus:publish $1 :stop-loading) :on_clicked #(bus:publish $1 :stop-loading)
}) })
(: :set_image (named-image "process-stop"))) (: :set_image (named-image "process-stop")))
new-tab (Gtk.Button {
:on_clicked #(bus:publish $1 :new-tab)
:label ""
})
refresh (doto (Gtk.Button { refresh (doto (Gtk.Button {
:on_clicked #(bus:publish $1 :reload) :on_clicked #(bus:publish $1 :reload)
}) })
@ -283,7 +294,10 @@ progress, trough {
(= (views:current-tab) tab))] (= (views:current-tab) tab))]
(bus:subscribe :url-changed (bus:subscribe :url-changed
#(when (visible? $1) (url:set_text $2))) #(when (visible? $1)
(doto url
(: :set_text (or $2 ""))
(: :set_editable (and $2 true)))))
(bus:subscribe :title-changed (bus:subscribe :title-changed
#(when (visible? $1) #(when (visible? $1)
@ -308,7 +322,6 @@ progress, trough {
(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 show-tabs false false 2) (nav-bar:pack_end show-tabs 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)
(container:pack_start progress-bar false false 0) (container:pack_start progress-bar false false 0)

1
just/shell.nix Normal file
View File

@ -0,0 +1 @@
with import <nixpkgs> {} ; callPackage ./. {}