In this tutorial, you will learn:
How to display a web page with WebKit.
How to manipulate the contents of a web page using WebKit's DOM functions.
This tutorial assumes you are familiar with the C programming language and have a basic understanding of GTK+, including how to create and place widgets and how to connect callback functions to signals. See to learn the basics of GTK+.
The GNOME platform includes WebKitGTK+, built on top of the powerful WebKit HTML framework. WebKit is used throughout GNOME, not just to view web pages on the Internet, but also to create rich user interfaces that can be easily styled with CSS.
In this tutorial, you will create a simple message board using WebKit. The message board will allow you to enter some text and have it added to a list of messages in HTML. Before you begin, you need to set up a project in Anjuta.
In Anjuta, click
Select
Fill out your details on the
Disable the
You need to tell Anjuta you're using WebKitGTK+ on this project.
On the
After you finish the new project assistant, open the file
gtk/gtk.h
, add the following line:
#include <webkit/webkit.h>
Verify that everything works by building what you have so far.
Click
You should now be able to run the program. Click
Now that you can show a window, it's time to start working with WebKit.
For this tutorial, you'll create a text entry and a web view and pack
them both into a window. Find the function create_window
and
replace it with the following: