[webkit-gtk] WebKit2 GTK+ API

Alexander Larsson alexl at redhat.com
Thu Sep 15 05:56:25 PDT 2011



----- Original Message -----
> On Thu, Sep 15, 2011 at 11:50:22AM +0200, Carlos Garcia Campos wrote:
> >
> > [...]
> >
> > Since it's a big change, I would like to share some general ideas I
> > have about the new API so that we can discuss them.
> >
> >  - Try to keep webkit1 API when possible to make porting apps
> >  easier.
> >  - Use async API following the glib/gio pattern for operations
> >  started
> >    by the user like loading a page, finding text, etc. that has an
> >    end.
> 
> I've talked to Carlos and just wanted to do some clarifications about
> what this would mean. Developers will have to use an API where they
> add
> the callbacks for the function instead of connecting to signals, for
> instance, load uri was:
> 
> webkit_web_view_load_uri (WebKitWebView *webView,
> const gchar *uri);
> 
> And now would be:
> 
> webkit_web_view_load_uri (WebKitWebView *web_view,
> const gchar *uri,
> GCancellable *cancellable,
> WebKitLoadProgressCallback progress_callback,
> gpointer progress_callback_data,
> GAsyncReadyCallback callback,
> gpointer user_data);
>

I'm not sure passing the progress callback like this is the best approach. It means e.g. that you have to reconnect the whole progress UI handling on each load, in say a webbrowser. Its a nice API if all your app does is load a single page, but not right
if you want to always show the load status of the view in some other widget.

One possible way to make the API "nicer" is to return a WebKitLoadOperation object and have progress signals on that.



More information about the webkit-gtk mailing list