connectLoadChanged

fun connectLoadChanged(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (loadEvent: LoadEvent) -> Unit): <Error class: unknown class>

Emitted when a load operation in @web_view changes. The signal is always emitted with %WEBKIT_LOAD_STARTED when a new load request is made and %WEBKIT_LOAD_FINISHED when the load finishes successfully or due to an error. When the ongoing load operation fails #WebKitWebView::load-failed signal is emitted before #WebKitWebView::load-changed is emitted with %WEBKIT_LOAD_FINISHED. If a redirection is received from the server, this signal is emitted with %WEBKIT_LOAD_REDIRECTED after the initial emission with %WEBKIT_LOAD_STARTED and before %WEBKIT_LOAD_COMMITTED. When the page content starts arriving the signal is emitted with %WEBKIT_LOAD_COMMITTED event.

You can handle this signal and use a switch to track any ongoing load operation.

static void web_view_load_changed (WebKitWebView  *web_view,
WebKitLoadEvent load_event,
gpointer user_data)
{
switch (load_event) {
case WEBKIT_LOAD_STARTED:
// New load, we have now a provisional URI
provisional_uri = webkit_web_view_get_uri (web_view);
// Here we could start a spinner or update the
// location bar with the provisional URI
break;
case WEBKIT_LOAD_REDIRECTED:
redirected_uri = webkit_web_view_get_uri (web_view);
break;
case WEBKIT_LOAD_COMMITTED:
// The load is being performed. Current URI is
// the final one and it won't change unless a new
// load is requested or a navigation within the
// same page is performed
uri = webkit_web_view_get_uri (web_view);
break;
case WEBKIT_LOAD_FINISHED:
// Load finished, we can now stop the spinner
break;
}
}

Parameters

connectFlags

A combination of ConnectFlags

handler

the Callback to connect. Params: loadEvent the #WebKitLoadEvent