Open idlesong opened 4 years ago
Not sure.
Try to call get_type()
before you use it.
Heyo! I'm using Glade on my GTK-rs web browser, and I've got this working.
Firstly, the get_object()
function gets an object by its ID/unique instance name. Have you given your WebView widget a name in Glade?
Additionally, if that doesn't work for whatever reason (though, it should), you can create your own WebView instance in Rust, like this:
let web_view_builder = webkit2gtk::WebViewBuilder::new()
.is_ephemeral(false)
.automation_presentation_type(webkit2gtk::AutomationBrowsingContextPresentation::Tab);
let web_view = web_view_builder.build();
The webkit2gtk-rs
and gtk3-rs
documentation books are really useful, so take a look at those on the regular.
In glade, I added a WebKitWebView, then I want to get this object in my code:
It builded success, but when run:
I searched the web, it seems there are only two related answers, https://stackoverflow.com/questions/51010820/glade-invalid-object-type-webkitwebview-when-loading-from-file-works-on-gla
https://prognotes.net/2019/12/make-a-gtk-web-browser-with-glade/
But one is C, one is Vala. It's too hard to convert to rust for me. Is there any samples or documents about it? Thanks.