I have this almost solved. I've found this function:
void
webkit_web_view_save_to_file (WebKitWebView *web_view,
GFile *file,
WebKitSaveMode save_mode,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
in the WebKitGTK official documentation
In my project I use it like this:
webkit_web_view_save_to_file( WEBKIT_WEB_VIEW(webview), g_file_new_for_path("/absolute/path/to/file"), WEBKIT_SAVE_MODE_MHTML, NULL, NULL, NULL);
However, it does absolutely nothing (There's no file where it should be - maybe I'm missing something?). I've even put it inside a while(true)
loop (With a sleep(10)
after the webkit_web_view_save_to_file()
).
How can I make it work?
It seems that the process is asynchronous, so I had to write another function that got the result.
The function:
And then the corrected line of code: