logo

badwolf

Unnamed repository; edit this file 'description' to name the repository.
commit: 317b472d544d2f825d7007202053d6fa521a4747
parent: 008910b49b0686ac2cb165153d411703d887303a
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 15 Jan 2019 04:50:34 +0100

badwolf.c: Add load progress information

Diffstat:

Mbadwolf.c21+++++++++++++++++++++
1 file changed, 21 insertions(+), 0 deletions(-)

diff --git a/badwolf.c b/badwolf.c @@ -72,6 +72,23 @@ WebViewCb_notify__title(WebKitWebView *webView, GParamSpec *pspec, gpointer user return TRUE; } +static gboolean WebViewCb_notify__estimated_load_progress(WebKitWebView *webView, + GParamSpec *pspec, + gpointer user_data) +{ + struct Client *browser = (struct Client *)user_data; + gdouble progress; + + progress = webkit_web_view_get_estimated_load_progress(browser->webView); + if(progress == 1) + { + progress = 0; + } + gtk_entry_set_progress_fraction(GTK_ENTRY(browser->location), progress); + + return TRUE; +} + static gboolean WebViewCb_mouse_target_changed(WebKitWebView *webView, WebKitHitTestResult *hit, guint modifiers, @@ -134,6 +151,10 @@ int main(int argc, char *argv[]) "mouse-target-changed", G_CALLBACK(WebViewCb_mouse_target_changed), browser); + g_signal_connect(browser->webView, + "notify::estimated-load-progress", + G_CALLBACK(WebViewCb_notify__estimated_load_progress), + browser); WebKitSettings *settings = webkit_web_view_get_settings(browser->webView);