From 93f2acf3ab7e95f1b4cc0a663b984877a5b7172c Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sat, 5 Feb 2022 23:52:52 +0000 Subject: [PATCH] add a progress indicator --- just/README.md | 1 - just/just.fnl | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/just/README.md b/just/README.md index 1d8110d..c4bcf05 100644 --- a/just/README.md +++ b/just/README.md @@ -5,7 +5,6 @@ Touchscreen-friendly wrapper around Webkit ## TO DO - downloads (pass to download manager) -- progress indicator - support multiple tabs - find out if it's going to eat cpu like luakit does - some kind of bookmarks/favourites/pinned tabs/memory of visited sites diff --git a/just/just.fnl b/just/just.fnl index 8ca7635..b649cee 100644 --- a/just/just.fnl +++ b/just/just.fnl @@ -40,6 +40,20 @@ (fn [filter] (content-manager:add_filter filter)))))))) +(let [css " +progress, trough { + max-height: 6px; + color: #4444bb; +} +" + style_provider (Gtk.CssProvider)] + (style_provider:load_from_data css) + (Gtk.StyleContext.add_provider_for_screen + (lgi.Gdk.Screen.get_default) + style_provider + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION + )) + (let [current-url "https://terse.telent.net/admin/stream" r {} @@ -55,6 +69,11 @@ nav-bar (Gtk.Box { :orientation Gtk.Orientation.HORIZONTAL }) + progress-bar (Gtk.ProgressBar { + :orientation Gtk.Orientation.HORIZONTAL + :fraction 1.0 + :margin 0 + }) url (doto (Gtk.Entry { :on_activate (fn [self] @@ -79,6 +98,11 @@ (window:set_title (.. self.title " - Just browsing")) + (= pspec.name + "estimated-load-progress") + (tset progress-bar :fraction + self.estimated_load_progress) + (= pspec.name "is-loading") (stop-refresh:set_image (named-image @@ -103,6 +127,7 @@ (nav-bar:pack_end stop-refresh false false 2) (container:pack_start nav-bar false false 5) + (container:pack_start progress-bar false false 0) (container:pack_start webview true true 5) (webview:load_uri current-url)