FileDialog
Object Hierarchy:
Description:
[ CCode ( type_id = "gtk_file_dialog_get_type ()" ) ]
[ Version ( since = "4.10" ) ]
public sealed class FileDialog : Object
[ Version ( since = "4.10" ) ]
public sealed class FileDialog : Object
A `GtkFileDialog` object collects the arguments that are needed to present a file chooser dialog to the user, such as a title for the dialog and whether it should be modal.
The dialog is shown with [method@Gtk.FileDialog.open], [method@Gtk.FileDialog.save], etc. These APIs follow the GIO async pattern, and the result can be obtained by calling the corresponding finish function, for example [method@Gtk.FileDialog.open_finish].
Namespace: Gtk
Package: gtk4
Content:
Properties:
- public string accept_label { get; set; }
Label for the file chooser's accept button.
- public FileFilter default_filter { get; set; }
The default filter, that is, the filter that is initially active in the file chooser dialog.
- public ListModel filters { get; set; }
The list of filters.
- public File initial_file { get; set; }
The initial file, that is, the file that is initially selected in the file chooser dialog
- public File initial_folder { get; set; }
The initial folder, that is, the directory that is initially opened in the file chooser dialog
- public string initial_name { get; set; }
The initial name, that is, the filename that is initially selected in the file chooser dialog.
- public bool modal { get; set; }
Whether the file chooser dialog is modal.
- public string title { get; set; }
A title that may be shown on the file chooser dialog.
Creation methods:
- public FileDialog ()
Creates a new `GtkFileDialog` object.
Methods:
- public unowned string? get_accept_label ()
- public unowned FileFilter? get_default_filter ()
Gets the filter that will be selected by default in the file chooser dialog.
- public unowned ListModel? get_filters ()
Gets the filters that will be offered to the user in the file chooser dialog.
- public unowned File? get_initial_file ()
Gets the file that will be initially selected in the file chooser dialog.
- public unowned File? get_initial_folder ()
Gets the folder that will be set as the initial folder in the file chooser dialog.
- public unowned string? get_initial_name ()
Gets the name for the file that should be initially set.
- public bool get_modal ()
Returns whether the file chooser dialog blocks interaction with the parent window while it is presented.
- public unowned string get_title ()
Returns the title that will be shown on the file chooser dialog.
- public async File? open (Window? parent, Cancellable? cancellable) throws Error
This function initiates a file selection operation by presenting a file chooser dialog to the user.
- public async ListModel? open_multiple (Window? parent, Cancellable? cancellable) throws Error
This function initiates a multi-file selection operation by presenting a file chooser dialog to the user.
- public async File? save (Window? parent, Cancellable? cancellable) throws Error
This function initiates a file save operation by presenting a file chooser dialog to the user.
- public async File? select_folder (Window? parent, Cancellable? cancellable) throws Error
This function initiates a directory selection operation by presenting a file chooser dialog to the user.
- public async ListModel? select_multiple_folders (Window? parent, Cancellable? cancellable) throws Error
This function initiates a multi-directory selection operation by presenting a file chooser dialog to the user.
- public void set_accept_label (string? accept_label)
Sets the label shown on the file chooser's accept button.
- public void set_default_filter (FileFilter? filter)
Sets the filter that will be selected by default in the file chooser dialog.
- public void set_filters (ListModel? filters)
Sets the filters that will be offered to the user in the file chooser dialog.
- public void set_initial_file (File? file)
Sets the file that will be initially selected in the file chooser dialog.
- public void set_initial_folder (File? folder)
Sets the folder that will be set as the initial folder in the file chooser dialog.
- public void set_initial_name (string? name)
Sets the name for the file that should be initially set.
- public void set_modal (bool modal)
Sets whether the file chooser dialog blocks interaction with the parent window while it is presented.
- public void set_title (string title)
Sets the title that will be shown on the file chooser dialog.
Inherited Members:
All known members inherited from class GLib.Object