I have read about the load-change signal which can be emitted when a load operation in web_view changes.( https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView.html#WebKitWebView-load-changed ) And I need to use this but I don't understand how I can get the WebKitLoadEvent load_event to acctualy use this function. I didn't see any other function which returns a WebKitLoadEvent. How do I use this function?
static void web_view_load_changed (WebKitWebView *web_view,WebKitLoadEvent load_event, gpointer data)
{
struct widget *w = (struct widget *)data;
const gchar *redirected_uri;
const gchar *uri;
GTimer *timer = g_timer_new ();
switch (load_event) {
case WEBKIT_LOAD_STARTED:
break;
case WEBKIT_LOAD_REDIRECTED:
break;
case WEBKIT_LOAD_COMMITTED:
break;
case WEBKIT_LOAD_FINISHED:
break;
}
}
As you said this signal is beeing emitted from web_view. So in order to use this you only need to connect this function with the web_view at the place where your web_view is created.
This should look like this: web_view = WEBKIT_WEB_VIEW(webkit_web_view_new()); g_signal_connect(web_view, "load-change", G_CALLBAK(web_view_load_changed), (gpointer) data);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.