valavapi

Why do webkit-1.0 and gtk+-3.0 have more than 900 same symbols in .vapi files


As the title says my problem is that I try to use both gtk 3 and webkit 1.

I am following this example https://live.gnome.org/Vala/WebKitSample

except that I am using gtk 3 instead of 2.

I am using valac 0.16.0

I have now noticed that errors are Gdk 2 and Gdk 3 same symbols.

This seems like a way to solve my problems link but it is nonstandard.

Nevermind, I have fixed it with a bundled webkitgtk.


Solution

  • You cannot use library webkit-1.0 with gtk+-3.0, because webkit-1.0 depends on gtk+-2.0 and gdk-2.0 that conflict with gtk+-3.0 and gdk-3.0. You have to use library webkitgtk-3.0 that has same API as webkit-1.0, but depends on gtk+-3.0 and gdk-3.0.

    Since webkigtk-3.0 bindings are not shipped with Vala (bug 676249), you have to create your own bindings (follow instructions in the mentioned e-mail) and tell valac where your webkigtk-3.0.vapi file is located (--vapidir=.).

    $ ls
    webkitgtk-3.0.deps  webkitgtk-3.0.vapi  webkit-sample.vala
    $ valac --vapidir=. --pkg gtk+-3.0 --pkg webkitgtk-3.0 --thread webkit-sample.vala
    /tmp/fenryxo/webkit-sample.vala.c: In function ‘vala_browser_create_widgets’:
    /tmp/fenryxo/webkit-sample.vala.c:206:2: warning: ‘gtk_vbox_new’ is deprecated (declared at /usr/include/gtk-3.0/gtk/deprecated/gtkvbox.h:60): Use 'gtk_box_new' instead [-Wdeprecated-declarations]
    $ ls
    webkitgtk-3.0.deps  webkitgtk-3.0.vapi  webkit-sample  webkit-sample.vala