2022-12-19 18:19:13 +00:00
|
|
|
(local { : Gtk : Gdk : WebKit2 : cairo } (require :lgi))
|
2022-12-20 10:34:37 +00:00
|
|
|
(local { : view } (require :fennel))
|
2022-12-19 20:57:23 +00:00
|
|
|
(local command (require :command))
|
|
|
|
|
2022-12-20 10:34:37 +00:00
|
|
|
(var frames [])
|
|
|
|
|
2022-12-19 18:48:51 +00:00
|
|
|
(fn new-frame []
|
2022-12-19 18:19:13 +00:00
|
|
|
(let [hpad 2
|
|
|
|
vpad 2
|
|
|
|
window (Gtk.Window {
|
|
|
|
:title "Dunlin"
|
|
|
|
:default_width 800
|
|
|
|
:default_height 720
|
|
|
|
:on_destroy Gtk.main_quit
|
|
|
|
})
|
|
|
|
container (Gtk.Box {
|
|
|
|
:orientation Gtk.Orientation.VERTICAL
|
|
|
|
})
|
|
|
|
commander (Gtk.Entry {
|
|
|
|
:on_activate
|
|
|
|
(fn [event]
|
2022-12-19 21:01:10 +00:00
|
|
|
(command.invoke event.text {}))
|
2022-12-19 18:19:13 +00:00
|
|
|
})
|
|
|
|
progress-bar (Gtk.ProgressBar {
|
|
|
|
:orientation Gtk.Orientation.HORIZONTAL
|
|
|
|
:fraction 1.0
|
|
|
|
:margin 0
|
|
|
|
})
|
2022-12-20 10:34:37 +00:00
|
|
|
contentwidget (Gtk.Box {
|
|
|
|
:orientation Gtk.Orientation.VERTICAL
|
|
|
|
})
|
2022-12-19 18:19:13 +00:00
|
|
|
]
|
|
|
|
(doto container
|
|
|
|
(: :pack_start commander false false vpad)
|
|
|
|
(: :pack_start progress-bar false false vpad)
|
|
|
|
(: :pack_start contentwidget true true vpad))
|
|
|
|
(window:add container)
|
|
|
|
(window:show_all)
|
2022-12-20 10:34:37 +00:00
|
|
|
(let [f
|
|
|
|
{
|
|
|
|
:window window
|
|
|
|
:buffer nil
|
|
|
|
:commander commander
|
|
|
|
:content contentwidget
|
|
|
|
:show-buffer (fn [self b]
|
|
|
|
(each [_ w (pairs (contentwidget:get_children))]
|
|
|
|
(w:hide))
|
|
|
|
(contentwidget:pack_start b.webview true true 0)
|
|
|
|
(b.webview:show))
|
|
|
|
}]
|
|
|
|
(table.insert frames f)
|
|
|
|
f)))
|
|
|
|
|
2022-12-19 18:19:13 +00:00
|
|
|
|
2022-12-20 10:34:37 +00:00
|
|
|
{ :new new-frame :frames frames }
|