Package org.webkitgtk
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 TypeMethodDescriptionvoidEmitted when a load operation inwebViewchanges.default MemorySegmenttoCallback(Arena arena) Creates a native function pointer to theupcall(java.lang.foreign.MemorySegment, int)method.default voidupcall(MemorySegment sourceWebView, int loadEvent) Theupcallmethod is called from native code.
-
Method Details
-
run
Emitted when a load operation inwebViewchanges. The signal is always emitted withLoadEvent.STARTEDwhen a new load request is made andLoadEvent.FINISHEDwhen 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.REDIRECTEDafter the initial emission withLoadEvent.STARTEDand beforeLoadEvent.COMMITTED. When the page content starts arriving the signal is emitted withLoadEvent.COMMITTEDevent.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
Theupcallmethod is called from native code. The parameters are marshaled andrun(org.webkitgtk.LoadEvent)is executed. -
toCallback
Creates a native function pointer to theupcall(java.lang.foreign.MemorySegment, int)method.- Specified by:
toCallbackin interfaceFunctionPointer- Parameters:
arena- the arena in which the function pointer is allocated- Returns:
- the native function pointer
-