[webkit-gtk] Implement runOpenPanel in WebKit2GTK+
Mario Sanchez Prada
msanchez at igalia.com
Tue Feb 14 01:14:37 PST 2012
On Mon, 2012-02-13 at 19:47 +0100, Carlos Garcia Campos wrote:
> > 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.
Exactly. That's the main reason.
> > 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.
I had the same doubt yesterday, but Carlos convinced me with the
rationale we explained above. However, if we agree consistency is
important I think I would vote for a GSList, since it's probably more
GNOME-ish than a simple gchar**. Not an strong opinion ,though
More information about the webkit-gtk