[webkit-gtk] Implement runOpenPanel in WebKit2GTK+

Carlos Garcia Campos cgarcia at igalia.com
Mon Feb 13 10:47:10 PST 2012

El lun, 13-02-2012 a las 10:17 -0800, Martin Robinson escribió:
> On Mon, Feb 13, 2012 at 10:06 AM, Mario Sanchez Prada
> <msanchez at igalia.com> wrote:
> > As you can see I added an _accepted_mime_types() function besides the
> > one suggested by Carlos (_get_file_filter()), because I thought under
> > some scenarios it could be interesting to have easy access to the list
> > of accepted mime types (as in an array of char*), and extracting that
> > list from a GtkFileFilter instance is not trivial at all.
> I think that's a good idea. Part of the reason for implementing this
> signal is to allow embedders to create their own custom file choosers.
> This seems to be a requirement for Sugar.

Yes my initial idea was to use a GTkFileFilter because I thought it had
api to get the list of mime-types, but it doesn't. So we need a more
generic api, for user that won't use GtkFileChooser. Returning them as a
GtkFileFilter in addition is just convenient api for users using
GtkFileChooser, like our internal implementation.

> I notice that these methods often return NULL terminated arrays of
> gchar*, but one method accepts a GSList*.

This is because gtk_file_chooser_get_uris() returns a GSList.

>  Would it make sense to use
> NULL terminated arrays or GLists everywhere or is there a compelling
> reason why a GList is better in only some places?

When you don't know the size of the returned array in advance, using a
glist you avoid iterating the array twice, one to get the size and
allocate the returned array and another one to fill the array. In this
case, in get_mime_types() we already know the size, so we can just fill
the array in a single iteration and return a gchar ** than can be easily
freed with g_strfreev(). I'm not opposed to return also a GSList in this
case, though.

> --Martin
> _______________________________________________
> webkit-gtk mailing list
> webkit-gtk at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-gtk

Carlos Garcia Campos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20120213/60a90f92/attachment.bin>

More information about the webkit-gtk mailing list