Skip to main content

FileChooserExt

Trait FileChooserExt 

Source
pub trait FileChooserExt: IsA<FileChooser> + 'static {
Show 78 methods // Provided methods fn add_filter(&self, filter: FileFilter) { ... } fn add_shortcut_folder(&self, folder: impl AsRef<Path>) -> Result<(), Error> { ... } fn add_shortcut_folder_uri(&self, uri: &str) -> Result<(), Error> { ... } fn action(&self) -> FileChooserAction { ... } fn choice(&self, id: &str) -> Option<GString> { ... } fn creates_folders(&self) -> bool { ... } fn current_folder(&self) -> Option<PathBuf> { ... } fn current_folder_file(&self) -> Option<File> { ... } fn current_folder_uri(&self) -> Option<GString> { ... } fn current_name(&self) -> Option<GString> { ... } fn does_overwrite_confirmation(&self) -> bool { ... } fn extra_widget(&self) -> Option<Widget> { ... } fn file(&self) -> Option<File> { ... } fn filename(&self) -> Option<PathBuf> { ... } fn filenames(&self) -> Vec<PathBuf> { ... } fn files(&self) -> Vec<File> { ... } fn filter(&self) -> Option<FileFilter> { ... } fn is_local_only(&self) -> bool { ... } fn preview_file(&self) -> Option<File> { ... } fn preview_filename(&self) -> Option<PathBuf> { ... } fn preview_uri(&self) -> Option<GString> { ... } fn preview_widget(&self) -> Option<Widget> { ... } fn is_preview_widget_active(&self) -> bool { ... } fn selects_multiple(&self) -> bool { ... } fn shows_hidden(&self) -> bool { ... } fn uri(&self) -> Option<GString> { ... } fn uris(&self) -> Vec<GString> { ... } fn uses_preview_label(&self) -> bool { ... } fn list_filters(&self) -> Vec<FileFilter> { ... } fn list_shortcut_folder_uris(&self) -> Vec<GString> { ... } fn list_shortcut_folders(&self) -> Vec<PathBuf> { ... } fn remove_choice(&self, id: &str) { ... } fn remove_filter(&self, filter: &FileFilter) { ... } fn remove_shortcut_folder( &self, folder: impl AsRef<Path>, ) -> Result<(), Error> { ... } fn remove_shortcut_folder_uri(&self, uri: &str) -> Result<(), Error> { ... } fn select_all(&self) { ... } fn select_file(&self, file: &impl IsA<File>) -> Result<(), Error> { ... } fn select_filename(&self, filename: impl AsRef<Path>) -> bool { ... } fn select_uri(&self, uri: &str) -> bool { ... } fn set_action(&self, action: FileChooserAction) { ... } fn set_choice(&self, id: &str, option: &str) { ... } fn set_create_folders(&self, create_folders: bool) { ... } fn set_current_folder(&self, filename: impl AsRef<Path>) -> bool { ... } fn set_current_folder_file( &self, file: &impl IsA<File>, ) -> Result<(), Error> { ... } fn set_current_folder_uri(&self, uri: &str) -> bool { ... } fn set_current_name(&self, name: &str) { ... } fn set_do_overwrite_confirmation(&self, do_overwrite_confirmation: bool) { ... } fn set_extra_widget(&self, extra_widget: &impl IsA<Widget>) { ... } fn set_file(&self, file: &impl IsA<File>) -> Result<(), Error> { ... } fn set_filename(&self, filename: impl AsRef<Path>) -> bool { ... } fn set_filter(&self, filter: &FileFilter) { ... } fn set_local_only(&self, local_only: bool) { ... } fn set_preview_widget(&self, preview_widget: &impl IsA<Widget>) { ... } fn set_preview_widget_active(&self, active: bool) { ... } fn set_select_multiple(&self, select_multiple: bool) { ... } fn set_show_hidden(&self, show_hidden: bool) { ... } fn set_uri(&self, uri: &str) -> bool { ... } fn set_use_preview_label(&self, use_label: bool) { ... } fn unselect_all(&self) { ... } fn unselect_file(&self, file: &impl IsA<File>) { ... } fn unselect_filename(&self, filename: impl AsRef<Path>) { ... } fn unselect_uri(&self, uri: &str) { ... } fn connect_confirm_overwrite<F: Fn(&Self) -> FileChooserConfirmation + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_current_folder_changed<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_file_activated<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_selection_changed<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_update_preview<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_action_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_create_folders_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_do_overwrite_confirmation_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_extra_widget_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_filter_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_local_only_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_preview_widget_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_preview_widget_active_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_select_multiple_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_show_hidden_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_use_preview_label_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... }
}
Expand description

Provided Methods§

Source

fn add_filter(&self, filter: FileFilter)

Adds filter to the list of filters that the user can select between. When a filter is selected, only files that are passed by that filter are displayed.

Note that the self takes ownership of the filter, so you have to ref and sink it if you want to keep a reference.

§filter

a FileFilter

Source

fn add_shortcut_folder(&self, folder: impl AsRef<Path>) -> Result<(), Error>

Adds a folder to be displayed with the shortcut folders in a file chooser. Note that shortcut folders do not get saved, as they are provided by the application. For example, you can use this to add a “/usr/share/mydrawprogram/Clipart” folder to the volume list.

§folder

filename of the folder to add

§Returns

true if the folder could be added successfully, false otherwise. In the latter case, the error will be set as appropriate.

Source

fn add_shortcut_folder_uri(&self, uri: &str) -> Result<(), Error>

Adds a folder URI to be displayed with the shortcut folders in a file chooser. Note that shortcut folders do not get saved, as they are provided by the application. For example, you can use this to add a “file:///usr/share/mydrawprogram/Clipart” folder to the volume list.

§uri

URI of the folder to add

§Returns

true if the folder could be added successfully, false otherwise. In the latter case, the error will be set as appropriate.

Source

fn action(&self) -> FileChooserAction

Gets the type of operation that the file chooser is performing; see set_action().

§Returns

the action that the file selector is performing

Source

fn choice(&self, id: &str) -> Option<GString>

Gets the currently selected option in the ‘choice’ with the given ID.

§id

the ID of the choice to get

§Returns

the ID of the currenly selected option

Source

fn creates_folders(&self) -> bool

Gets whether file choser will offer to create new folders. See set_create_folders().

§Returns

true if the Create Folder button should be displayed.

Source

fn current_folder(&self) -> Option<PathBuf>

Gets the current folder of self as a local filename. See set_current_folder().

Note that this is the folder that the file chooser is currently displaying (e.g. “/home/username/Documents”), which is not the same as the currently-selected folder if the chooser is in FileChooserAction::SelectFolder mode (e.g. “/home/username/Documents/selected-folder/”. To get the currently-selected folder in that mode, use uri() as the usual way to get the selection.

§Returns

the full path of the current folder, or None if the current path cannot be represented as a local filename. Free with g_free(). This function will also return None if the file chooser was unable to load the last folder that was requested from it; for example, as would be for calling set_current_folder() on a nonexistent folder.

Source

fn current_folder_file(&self) -> Option<File>

Gets the current folder of self as gio::File. See current_folder_uri().

§Returns

the gio::File for the current folder.

Source

fn current_folder_uri(&self) -> Option<GString>

Gets the current folder of self as an URI. See set_current_folder_uri().

Note that this is the folder that the file chooser is currently displaying (e.g. “file:///home/username/Documents”), which is not the same as the currently-selected folder if the chooser is in FileChooserAction::SelectFolder mode (e.g. “file:///home/username/Documents/selected-folder/”. To get the currently-selected folder in that mode, use uri() as the usual way to get the selection.

§Returns

the URI for the current folder. Free with g_free(). This function will also return None if the file chooser was unable to load the last folder that was requested from it; for example, as would be for calling set_current_folder_uri() on a nonexistent folder.

Source

fn current_name(&self) -> Option<GString>

Gets the current name in the file selector, as entered by the user in the text entry for “Name”.

This is meant to be used in save dialogs, to get the currently typed filename when the file itself does not exist yet. For example, an application that adds a custom extra widget to the file chooser for “file format” may want to change the extension of the typed filename based on the chosen format, say, from “.jpg” to “.png”.

§Returns

The raw text from the file chooser’s “Name” entry. Free this with g_free(). Note that this string is not a full pathname or URI; it is whatever the contents of the entry are. Note also that this string is in UTF-8 encoding, which is not necessarily the system’s encoding for filenames.

Source

fn does_overwrite_confirmation(&self) -> bool

Queries whether a file chooser is set to confirm for overwriting when the user types a file name that already exists.

§Returns

true if the file chooser will present a confirmation dialog; false otherwise.

Source

fn extra_widget(&self) -> Option<Widget>

Gets the current extra widget; see set_extra_widget().

§Returns

the current extra widget, or None

Source

fn file(&self) -> Option<File>

Gets the gio::File for the currently selected file in the file selector. If multiple files are selected, one of the files will be returned at random.

If the file chooser is in folder mode, this function returns the selected folder.

§Returns

a selected gio::File. You own the returned file; use g_object_unref() to release it.

Source

fn filename(&self) -> Option<PathBuf>

Gets the filename for the currently selected file in the file selector. The filename is returned as an absolute path. If multiple files are selected, one of the filenames will be returned at random.

If the file chooser is in folder mode, this function returns the selected folder.

§Returns

The currently selected filename, or None if no file is selected, or the selected file can’t be represented with a local filename. Free with g_free().

Source

fn filenames(&self) -> Vec<PathBuf>

Lists all the selected files and subfolders in the current folder of self. The returned names are full absolute paths. If files in the current folder cannot be represented as local filenames they will be ignored. (See uris())

§Returns

a GSList containing the filenames of all selected files and subfolders in the current folder. Free the returned list with g_slist_free(), and the filenames with g_free().

Source

fn files(&self) -> Vec<File>

Lists all the selected files and subfolders in the current folder of self as gio::File. An internal function, see uris().

§Returns

a GSList containing a gio::File for each selected file and subfolder in the current folder. Free the returned list with g_slist_free(), and the files with g_object_unref().

Source

fn filter(&self) -> Option<FileFilter>

Gets the current filter; see set_filter().

§Returns

the current filter, or None

Source

fn is_local_only(&self) -> bool

Gets whether only local files can be selected in the file selector. See set_local_only()

§Returns

true if only local files can be selected.

Source

fn preview_file(&self) -> Option<File>

Gets the gio::File that should be previewed in a custom preview Internal function, see preview_uri().

§Returns

the gio::File for the file to preview, or None if no file is selected. Free with g_object_unref().

Source

fn preview_filename(&self) -> Option<PathBuf>

Gets the filename that should be previewed in a custom preview widget. See set_preview_widget().

§Returns

the filename to preview, or None if no file is selected, or if the selected file cannot be represented as a local filename. Free with g_free()

Source

fn preview_uri(&self) -> Option<GString>

Gets the URI that should be previewed in a custom preview widget. See set_preview_widget().

§Returns

the URI for the file to preview, or None if no file is selected. Free with g_free().

Source

fn preview_widget(&self) -> Option<Widget>

Gets the current preview widget; see set_preview_widget().

§Returns

the current preview widget, or None

Source

fn is_preview_widget_active(&self) -> bool

Gets whether the preview widget set by set_preview_widget() should be shown for the current filename. See set_preview_widget_active().

§Returns

true if the preview widget is active for the current filename.

Source

fn selects_multiple(&self) -> bool

Gets whether multiple files can be selected in the file selector. See set_select_multiple().

§Returns

true if multiple files can be selected.

Source

fn shows_hidden(&self) -> bool

Gets whether hidden files and folders are displayed in the file selector. See set_show_hidden().

§Returns

true if hidden files and folders are displayed.

Source

fn uri(&self) -> Option<GString>

Gets the URI for the currently selected file in the file selector. If multiple files are selected, one of the filenames will be returned at random.

If the file chooser is in folder mode, this function returns the selected folder.

§Returns

The currently selected URI, or None if no file is selected. If set_local_only() is set to true (the default) a local URI will be returned for any FUSE locations. Free with g_free()

Source

fn uris(&self) -> Vec<GString>

Lists all the selected files and subfolders in the current folder of self. The returned names are full absolute URIs.

§Returns

a GSList containing the URIs of all selected files and subfolders in the current folder. Free the returned list with g_slist_free(), and the filenames with g_free().

Source

fn uses_preview_label(&self) -> bool

Gets whether a stock label should be drawn with the name of the previewed file. See set_use_preview_label().

§Returns

true if the file chooser is set to display a label with the name of the previewed file, false otherwise.

Source

fn list_filters(&self) -> Vec<FileFilter>

Lists the current set of user-selectable filters; see add_filter(), remove_filter().

§Returns

a GSList containing the current set of user selectable filters. The contents of the list are owned by GTK+, but you must free the list itself with g_slist_free() when you are done with it.

Source

fn list_shortcut_folder_uris(&self) -> Vec<GString>

Queries the list of shortcut folders in the file chooser, as set by add_shortcut_folder_uri().

§Returns

A list of folder URIs, or None if there are no shortcut folders. Free the returned list with g_slist_free(), and the URIs with g_free().

Source

fn list_shortcut_folders(&self) -> Vec<PathBuf>

Queries the list of shortcut folders in the file chooser, as set by add_shortcut_folder().

§Returns

A list of folder filenames, or None if there are no shortcut folders. Free the returned list with g_slist_free(), and the filenames with g_free().

Source

fn remove_choice(&self, id: &str)

Removes a ‘choice’ that has been added with FileChooserExtManual::add_choice().

§id

the ID of the choice to remove

Source

fn remove_filter(&self, filter: &FileFilter)

Removes filter from the list of filters that the user can select between.

§filter

a FileFilter

Source

fn remove_shortcut_folder(&self, folder: impl AsRef<Path>) -> Result<(), Error>

Removes a folder from a file chooser’s list of shortcut folders.

§folder

filename of the folder to remove

§Returns

true if the operation succeeds, false otherwise. In the latter case, the error will be set as appropriate.

See also: add_shortcut_folder()

Source

fn remove_shortcut_folder_uri(&self, uri: &str) -> Result<(), Error>

Removes a folder URI from a file chooser’s list of shortcut folders.

§uri

URI of the folder to remove

§Returns

true if the operation succeeds, false otherwise. In the latter case, the error will be set as appropriate.

See also: add_shortcut_folder_uri()

Source

fn select_all(&self)

Selects all the files in the current folder of a file chooser.

Source

fn select_file(&self, file: &impl IsA<File>) -> Result<(), Error>

Selects the file referred to by file. An internal function. See _gtk_file_chooser_select_uri().

§file

the file to select

§Returns

Not useful.

Source

fn select_filename(&self, filename: impl AsRef<Path>) -> bool

Selects a filename. If the file name isn’t in the current folder of self, then the current folder of self will be changed to the folder containing filename.

§filename

the filename to select

§Returns

Not useful.

See also: set_filename()

Source

fn select_uri(&self, uri: &str) -> bool

Selects the file to by uri. If the URI doesn’t refer to a file in the current folder of self, then the current folder of self will be changed to the folder containing filename.

§uri

the URI to select

§Returns

Not useful.

Source

fn set_action(&self, action: FileChooserAction)

Sets the type of operation that the chooser is performing; the user interface is adapted to suit the selected action. For example, an option to create a new folder might be shown if the action is FileChooserAction::Save but not if the action is FileChooserAction::Open.

§action

the action that the file selector is performing

Source

fn set_choice(&self, id: &str, option: &str)

Selects an option in a ‘choice’ that has been added with FileChooserExtManual::add_choice(). For a boolean choice, the possible options are “true” and “false”.

§id

the ID of the choice to set

§option

the ID of the option to select

Source

fn set_create_folders(&self, create_folders: bool)

Sets whether file choser will offer to create new folders. This is only relevant if the action is not set to be FileChooserAction::Open.

§create_folders

true if the Create Folder button should be displayed

Source

fn set_current_folder(&self, filename: impl AsRef<Path>) -> bool

Sets the current folder for self from a local filename. The user will be shown the full contents of the current folder, plus user interface elements for navigating to other folders.

In general, you should not use this function. See the [section on setting up a file chooser dialog][gtkfilechooserdialog-setting-up] for the rationale behind this.

§filename

the full path of the new current folder

§Returns

Not useful.

Source

fn set_current_folder_file(&self, file: &impl IsA<File>) -> Result<(), Error>

Sets the current folder for self from a gio::File. Internal function, see set_current_folder_uri().

§file

the gio::File for the new folder

§Returns

true if the folder could be changed successfully, false otherwise.

Source

fn set_current_folder_uri(&self, uri: &str) -> bool

Sets the current folder for self from an URI. The user will be shown the full contents of the current folder, plus user interface elements for navigating to other folders.

In general, you should not use this function. See the [section on setting up a file chooser dialog][gtkfilechooserdialog-setting-up] for the rationale behind this.

§uri

the URI for the new current folder

§Returns

true if the folder could be changed successfully, false otherwise.

Source

fn set_current_name(&self, name: &str)

Sets the current name in the file selector, as if entered by the user. Note that the name passed in here is a UTF-8 string rather than a filename. This function is meant for such uses as a suggested name in a “Save As…” dialog. You can pass “Untitled.doc” or a similarly suitable suggestion for the name.

If you want to preselect a particular existing file, you should use set_filename() or set_uri() instead. Please see the documentation for those functions for an example of using set_current_name() as well.

§name

the filename to use, as a UTF-8 string

Source

fn set_do_overwrite_confirmation(&self, do_overwrite_confirmation: bool)

Sets whether a file chooser in FileChooserAction::Save mode will present a confirmation dialog if the user types a file name that already exists. This is false by default.

If set to true, the self will emit the confirm-overwrite signal when appropriate.

If all you need is the stock confirmation dialog, set this property to true. You can override the way confirmation is done by actually handling the confirm-overwrite signal; please refer to its documentation for the details.

§do_overwrite_confirmation

whether to confirm overwriting in save mode

Source

fn set_extra_widget(&self, extra_widget: &impl IsA<Widget>)

Sets an application-supplied widget to provide extra options to the user.

§extra_widget

widget for extra options

Source

fn set_file(&self, file: &impl IsA<File>) -> Result<(), Error>

if (document_is_new) { // the user just created a new document gtk_file_chooser_set_current_folder_file (chooser, default_file_for_saving); gtk_file_chooser_set_current_name (chooser, “Untitled document”); } else { // the user edited an existing document gtk_file_chooser_set_file (chooser, existing_file); } ]|

§file

the gio::File to set as current

§Returns

Not useful.

Source

fn set_filename(&self, filename: impl AsRef<Path>) -> bool

if (document_is_new) { // the user just created a new document gtk_file_chooser_set_current_name (chooser, “Untitled document”); } else { // the user edited an existing document gtk_file_chooser_set_filename (chooser, existing_filename); } ]|

In the first case, the file chooser will present the user with useful suggestions as to where to save his new file. In the second case, the file’s existing location is already known, so the file chooser will use it.

§filename

the filename to set as current

§Returns

Not useful.

Source

fn set_filter(&self, filter: &FileFilter)

Sets the current filter; only the files that pass the filter will be displayed. If the user-selectable list of filters is non-empty, then the filter should be one of the filters in that list. Setting the current filter when the list of filters is empty is useful if you want to restrict the displayed set of files without letting the user change it.

§filter

a FileFilter

Source

fn set_local_only(&self, local_only: bool)

Sets whether only local files can be selected in the file selector. If local_only is true (the default), then the selected file or files are guaranteed to be accessible through the operating systems native file system and therefore the application only needs to worry about the filename functions in FileChooser, like filename(), rather than the URI functions like uri(),

On some systems non-native files may still be available using the native filesystem via a userspace filesystem (FUSE).

§local_only

true if only local files can be selected

Source

fn set_preview_widget(&self, preview_widget: &impl IsA<Widget>)

Sets an application-supplied widget to use to display a custom preview of the currently selected file. To implement a preview, after setting the preview widget, you connect to the update-preview signal, and call preview_filename() or preview_uri() on each change. If you can display a preview of the new file, update your widget and set the preview active using set_preview_widget_active(). Otherwise, set the preview inactive.

When there is no application-supplied preview widget, or the application-supplied preview widget is not active, the file chooser will display no preview at all.

§preview_widget

widget for displaying preview.

Source

fn set_preview_widget_active(&self, active: bool)

Sets whether the preview widget set by set_preview_widget() should be shown for the current filename. When active is set to false, the file chooser may display an internally generated preview of the current file or it may display no preview at all. See set_preview_widget() for more details.

§active

whether to display the user-specified preview widget

Source

fn set_select_multiple(&self, select_multiple: bool)

Sets whether multiple files can be selected in the file selector. This is only relevant if the action is set to be FileChooserAction::Open or FileChooserAction::SelectFolder.

§select_multiple

true if multiple files can be selected.

Source

fn set_show_hidden(&self, show_hidden: bool)

Sets whether hidden files and folders are displayed in the file selector.

§show_hidden

true if hidden files and folders should be displayed.

Source

fn set_uri(&self, uri: &str) -> bool

if (document_is_new) { // the user just created a new document gtk_file_chooser_set_current_name (chooser, “Untitled document”); } else { // the user edited an existing document gtk_file_chooser_set_uri (chooser, existing_uri); } ]|

In the first case, the file chooser will present the user with useful suggestions as to where to save his new file. In the second case, the file’s existing location is already known, so the file chooser will use it.

§uri

the URI to set as current

§Returns

Not useful.

Source

fn set_use_preview_label(&self, use_label: bool)

Sets whether the file chooser should display a stock label with the name of the file that is being previewed; the default is true. Applications that want to draw the whole preview area themselves should set this to false and display the name themselves in their preview widget.

See also: set_preview_widget()

§use_label

whether to display a stock label with the name of the previewed file

Source

fn unselect_all(&self)

Unselects all the files in the current folder of a file chooser.

Source

fn unselect_file(&self, file: &impl IsA<File>)

Unselects the file referred to by file. If the file is not in the current directory, does not exist, or is otherwise not currently selected, does nothing.

§file

a gio::File

Source

fn unselect_filename(&self, filename: impl AsRef<Path>)

Unselects a currently selected filename. If the filename is not in the current directory, does not exist, or is otherwise not currently selected, does nothing.

§filename

the filename to unselect

Source

fn unselect_uri(&self, uri: &str)

Unselects the file referred to by uri. If the file is not in the current directory, does not exist, or is otherwise not currently selected, does nothing.

§uri

the URI to unselect

Source

fn connect_confirm_overwrite<F: Fn(&Self) -> FileChooserConfirmation + 'static>( &self, f: F, ) -> SignalHandlerId

static GtkFileChooserConfirmation confirm_overwrite_callback (GtkFileChooser *chooser, gpointer data) { char *uri;

uri = gtk_file_chooser_get_uri (chooser);

if (is_uri_read_only (uri)) { if (user_wants_to_replace_read_only_file (uri)) return GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME; else return GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN; } else return GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM; // fall back to the default dialog }

chooser = gtk_file_chooser_dialog_new (…);

gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE); g_signal_connect (chooser, “confirm-overwrite”, G_CALLBACK (confirm_overwrite_callback), NULL);

if (gtk_dialog_run (chooser) == GTK_RESPONSE_ACCEPT) save_to_file (gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));

gtk_widget_destroy (chooser); ]|

§Returns

a FileChooserConfirmation value that indicates which action to take after emitting the signal.

Source

fn connect_current_folder_changed<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

This signal is emitted when the current folder in a FileChooser changes. This can happen due to the user performing some action that changes folders, such as selecting a bookmark or visiting a folder on the file list. It can also happen as a result of calling a function to explicitly change the current folder in a file chooser.

Normally you do not need to connect to this signal, unless you need to keep track of which folder a file chooser is showing.

See also: set_current_folder(), current_folder(), set_current_folder_uri(), current_folder_uri().

Source

fn connect_file_activated<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

This signal is emitted when the user “activates” a file in the file chooser. This can happen by double-clicking on a file in the file list, or by pressing Enter.

Normally you do not need to connect to this signal. It is used internally by FileChooserDialog to know when to activate the default button in the dialog.

See also: filename(), filenames(), uri(), uris().

Source

fn connect_selection_changed<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

This signal is emitted when there is a change in the set of selected files in a FileChooser. This can happen when the user modifies the selection with the mouse or the keyboard, or when explicitly calling functions to change the selection.

Normally you do not need to connect to this signal, as it is easier to wait for the file chooser to finish running, and then to get the list of selected files using the functions mentioned below.

See also: select_filename(), unselect_filename(), filename(), filenames(), select_uri(), unselect_uri(), uri(), uris().

Source

fn connect_update_preview<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

This signal is emitted when the preview in a file chooser should be regenerated. For example, this can happen when the currently selected file changes. You should use this signal if you want your file chooser to have a preview widget.

Once you have installed a preview widget with set_preview_widget(), you should update it when this signal is emitted. You can use the functions preview_filename() or preview_uri() to get the name of the file to preview. Your widget may not be able to preview all kinds of files; your callback must call set_preview_widget_active() to inform the file chooser about whether the preview was generated successfully or not.

Please see the example code in [Using a Preview Widget][gtkfilechooser-preview].

See also: set_preview_widget(), set_preview_widget_active(), set_use_preview_label(), preview_filename(), preview_uri().

Source

fn connect_action_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Source

fn connect_create_folders_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_do_overwrite_confirmation_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_extra_widget_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Source

fn connect_local_only_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_preview_widget_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_preview_widget_active_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_select_multiple_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_show_hidden_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_use_preview_label_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§