diff options
badwolf.c: Add load progress information
1 files changed, 21 insertions, 0 deletions
| -rw-r--r-- | badwolf.c | 21 |
@@ -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); |