WebKit2.WebView::load-changed
connect('load-changed', function (webView, load_event: WebKit2.LoadEvent, ): void);
Emitted when the a load operation in @web_view changes. The signal is always emitted with WebKit2.LoadEvent.started when a new load request is made and WebKit2.LoadEvent.finished when the load finishes successfully or due to an error. When the ongoing load operation fails WebKit2.WebView::load-failed signal is emitted before WebKit2.WebView::load-changed is emitted with WebKit2.LoadEvent.finished. If a redirection is received from the server, this signal is emitted with WebKit2.LoadEvent.redirected after the initial emission with WebKit2.LoadEvent.started and before WebKit2.LoadEvent.committed. When the page content starts arriving the signal is emitted with WebKit2.LoadEvent.committed event.
You can handle this signal and use a switch to track any ongoing load operation.
<informalexample><programlisting> 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; } } </programlisting></informalexample>
- webView
instance of WebKit2.WebView that is emitting the signal
- load_event