Trait webkit2gtk::prelude::FileChooserRequestExt
source · [−]pub trait FileChooserRequestExt: 'static {
fn cancel(&self);
fn mime_types(&self) -> Vec<GString>;
fn mime_types_filter(&self) -> Option<FileFilter>;
fn selects_multiple(&self) -> bool;
fn selected_files(&self) -> Vec<GString>;
fn select_files(&self, files: &[&str]);
fn filter(&self) -> Option<FileFilter>;
fn connect_filter_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_mime_types_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_select_multiple_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_selected_files_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
}
Expand description
Required Methods
sourcefn cancel(&self)
fn cancel(&self)
Ask WebKit to cancel the request.
It’s important to do this in case no selection has been made in the client, otherwise the request won’t be properly completed and the browser will keep the request pending forever, which might cause the browser to hang.
sourcefn mime_types(&self) -> Vec<GString>
fn mime_types(&self) -> Vec<GString>
Get the list of MIME types the file chooser dialog should handle.
Get the list of MIME types the file chooser dialog should handle, in the format specified in RFC 2046 for “media types”. Its contents depend on the value of the ‘accept’ attribute for HTML input elements. This function should normally be called before presenting the file chooser dialog to the user, to decide whether to allow the user to select multiple files at once or only one.
Returns
a
None
-terminated array of strings if a list of accepted MIME types
is defined or None
otherwise, meaning that any MIME type should be
accepted. This array and its contents are owned by WebKit and
should not be modified or freed.
sourcefn mime_types_filter(&self) -> Option<FileFilter>
fn mime_types_filter(&self) -> Option<FileFilter>
Get the filter currently associated with the request.
Get the filter currently associated with the request, ready to be
used by GtkFileChooser
. This function should normally be called
before presenting the file chooser dialog to the user, to decide
whether to apply a filter so the user would not be allowed to
select files with other MIME types.
See mime_types()
if you are
interested in getting the list of accepted MIME types.
Returns
a gtk::FileFilter
if a list of accepted
MIME types is defined or None
otherwise. The returned object is
owned by WebKit should not be modified or freed.
sourcefn selects_multiple(&self) -> bool
fn selects_multiple(&self) -> bool
Whether the file chooser should allow selecting multiple files.
Determine whether the file chooser associated to this
FileChooserRequest
should allow selecting multiple files,
which depends on the HTML input element having a ‘multiple’
attribute defined.
Returns
true
if the file chooser should allow selecting multiple files or false
otherwise.
sourcefn selected_files(&self) -> Vec<GString>
fn selected_files(&self) -> Vec<GString>
Get the list of selected files associated to the request.
Get the list of selected files currently associated to the request. Initially, the return value of this method contains any files selected in previous file chooser requests for this HTML input element. Once webkit_file_chooser_request_select_files, the value will reflect whatever files are given.
This function should normally be called only before presenting the file chooser dialog to the user, to decide whether to perform some extra action, like pre-selecting the files from a previous request.
Returns
a
None
-terminated array of strings if there are selected files
associated with the request or None
otherwise. This array and its
contents are owned by WebKit and should not be modified or
freed.
sourcefn select_files(&self, files: &[&str])
fn select_files(&self, files: &[&str])
sourcefn filter(&self) -> Option<FileFilter>
fn filter(&self) -> Option<FileFilter>
The filter currently associated with the request. See
mime_types_filter()
for more
details.