[webkit-gtk] Custom Filechooser dialog

Mario Sanchez Prada msanchez at igalia.com
Fri Feb 10 15:30:10 PST 2012


Hi,

On Fri, 2012-02-10 at 13:03 +0100, Simon Schampijer wrote:
> [...]
> Ok, I did an initial patch (attached) to pipe an "upload-requested" 
> signal out, the return value is a boolean to indicate whether the 
> application handles the upload or not.
> 
> We have to get back the information from the application which file(s) 
> should be uploaded as well. I wonder how the API would best look like 
> for this. We could handle that in the return value, if we get a filename 
> back it was handled, if NULL is returned we display the default upload 
> dialog. This would be similar signal handling as in 
> 'create-plugin-widget' where we return a widget from the signal 
> callback. Looks like we would have to write a custom GSignalAccumulator 
> for this. Other ideas suggestions?

Perhaps we could emit some extra object with that signal (a wrapper for
the FileChooser object?) that the application could use to call to
choose_files() and cancel() methods? I did something like that in a
patch for WK2 I started working on yesterday, and seems to work fine in
there, not sure at this point whether it could fit or not in WK1.

> [...]
> >> - API additions for webkit vs webkit2?
> >
> > It'd make sense to have it in both ports actually.
> 
> Agreed,

As I mentioned above, I started yesterday working on the same thing for
WebKit2GTK+ (implement runOpenPanel) and the implementation I have so
far looks pretty similar to what it's being discussed here: I also emit
a signal to give the app a chance to use its own filechooser dialog, and
provide a default handler at the same time which runs a
GtkFileChooserDialog.

So, I think it would be pretty nice if we could agree on implementing
this in WebKit1 and WebKit2 as much similar as possible, starting with
the name of the signal :-)

I used 'decide-open-panel' (probably a terrible name) inspired in the
'decide-policy' signal in WK2, but 'upload-request' sounds good to me as
well, although I'm not sure if it will be too specific or not.

For reference, I have sent a mail to this list some minutes ago, with
the details of the patch I have so far (which I also attached, btw):
https://lists.webkit.org/pipermail/webkit-gtk/2012-February/000965.html

Opinions?
Mario



More information about the webkit-gtk mailing list