How to create a simple webkit browser in vala? -
i have simple code:
using glib; using gtk; using webkit; public class browser : window { private const string url = "http://mixtape.quadhome.com/6/"; public browser() { this.add(this.create_web_window()); this.destroy.connect(gtk.main_quit); } private scrolledwindow create_web_window() { var view = new webview(); view.load_uri(browser.url); var scrolled_window = new scrolledwindow(null, null); scrolled_window.set_policy(policytype.automatic, policytype.automatic); scrolled_window.add(view); return scrolled_window; } public static int main(string[] args) { gtk.init(ref args); var browser = new browser(); browser.show_all(); gtk.main(); return 0; } }
my problem here when compile with:
valac --pkg gtk+-3.0 --pkg webkit2gtk-4.0 searcher.vala
it gives error:
fatal error: webkit2/webkit2.h: no such file or directory #include <webkit2/webkit2.h>
i use valac-0.26 has webkit2gtk-4.0. found googleing there no "webkit2gtk-4.0.pc" donwloaded arch package , wanted "javascriptcore.pc" , after copied gave same error message. these in "/usr/lib/pkgconfig". i'm pretty stuck. please me if can.
first have install dev dependencies..
sudo apt-get install libwebkit2gtk-3.0-dev
another thing.. in webkit2 theres no need place webview in scrolled window
attach window directly
window.add(webview)
or
mygtkwidget.add(webview)
Comments
Post a Comment