Package org.gnome.webkit
Interface WebView.LoadChangedCallback
- All Superinterfaces:
FunctionPointer
- Enclosing class:
WebView
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface declaration of the
LoadChangedCallback
callback.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Emitted when a load operation inwebView
changes.default MemorySegment
toCallback
(Arena arena) Creates a native function pointer to theupcall(java.lang.foreign.MemorySegment, int)
method.default void
upcall
(MemorySegment sourceWebView, int loadEvent) Theupcall
method is called from native code.
-
Method Details
-
run
Emitted when a load operation inwebView
changes. The signal is always emitted withLoadEvent.STARTED
when a new load request is made andLoadEvent.FINISHED
when the load finishes successfully or due to an error. When the ongoing load operation failsWebKitWebView
::load-failed signal is emitted beforeWebKitWebView
::load-changed is emitted withLoadEvent.FINISHED
. If a redirection is received from the server, this signal is emitted withLoadEvent.REDIRECTED
after the initial emission withLoadEvent.STARTED
and beforeLoadEvent.COMMITTED
. When the page content starts arriving the signal is emitted withLoadEvent.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; } }
-
upcall
Theupcall
method is called from native code. The parameters are marshaled andrun(org.gnome.webkit.LoadEvent)
is executed. -
toCallback
Creates a native function pointer to theupcall(java.lang.foreign.MemorySegment, int)
method.- Specified by:
toCallback
in interfaceFunctionPointer
- Parameters:
arena
- the function pointer will be allocated in this arena- Returns:
- the native function pointer
-