From 317b472d544d2f825d7007202053d6fa521a4747 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Tue, 15 Jan 2019 04:50:34 +0100 Subject: badwolf.c: Add load progress information --- badwolf.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/badwolf.c b/badwolf.c index aa18b24..a086af1 100644 --- 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); -- cgit v1.3.1-23-gd82d