class Gtk::FileDialog
- Gtk::FileDialog
- GObject::Object
- Reference
- Object
Overview
Asynchronous API to present a file chooser dialog.
Gtk::FileDialog
collects the arguments that are needed to present
the dialog to the user, such as a title for the dialog and whether
it should be modal.
The dialog is shown with Gtk::FileDialog#open
,
Gtk::FileDialog#save
, etc.
Defined in:
lib/gi-crystal/src/auto/gtk-4.0/file_dialog.crConstructors
-
.new : self
Creates a new
Gtk::FileDialog
object. - .new(*, accept_label : String | Nil = nil, default_filter : Gtk::FileFilter | Nil = nil, filters : Gio::ListModel | Nil = nil, initial_file : Gio::File | Nil = nil, initial_folder : Gio::File | Nil = nil, initial_name : String | Nil = nil, modal : Bool | Nil = nil, title : String | Nil = nil)
Class Method Summary
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. -
#accept_label : String | Nil
Retrieves the text used by the dialog on its accept button.
- #accept_label=(value : String) : String
-
#accept_label=(value : Nil) : Nil
Set
#accept_label
property to nil. -
#accept_label=(accept_label : String | Nil) : Nil
Sets the label shown on the file chooser's accept button.
-
#accept_label? : String | Nil
Same as
#accept_label
, but can return nil. -
#default_filter : Gtk::FileFilter | Nil
Gets the filter that will be selected by default in the file chooser dialog.
-
#default_filter=(filter : Gtk::FileFilter | Nil) : Nil
Sets the filter that will be selected by default in the file chooser dialog.
-
#filters : Gio::ListModel | Nil
Gets the filters that will be offered to the user in the file chooser dialog.
-
#filters=(filters : Gio::ListModel | Nil) : Nil
Sets the filters that will be offered to the user in the file chooser dialog.
-
#hash(hasher)
See
Object#hash(hasher)
-
#initial_file : Gio::File | Nil
Gets the file that will be initially selected in the file chooser dialog.
-
#initial_file=(file : Gio::File | Nil) : Nil
Sets the file that will be initially selected in the file chooser dialog.
-
#initial_folder : Gio::File | Nil
Gets the folder that will be set as the initial folder in the file chooser dialog.
-
#initial_folder=(folder : Gio::File | Nil) : Nil
Sets the folder that will be set as the initial folder in the file chooser dialog.
-
#initial_name : String | Nil
Gets the filename that will be initially selected.
- #initial_name=(value : String) : String
-
#initial_name=(value : Nil) : Nil
Set
#initial_name
property to nil. -
#initial_name=(name : String | Nil) : Nil
Sets the filename that will be initially selected.
-
#initial_name? : String | Nil
Same as
#initial_name
, but can return nil. -
#modal : Bool
Returns whether the file chooser dialog blocks interaction with the parent window while it is presented.
-
#modal=(modal : Bool) : Nil
Sets whether the file chooser dialog blocks interaction with the parent window while it is presented.
- #modal? : Bool
-
#open(parent : Gtk::Window | Nil, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil
Presents a file chooser dialog to the user.
-
#open_finish(result : Gio::AsyncResult) : Gio::File | Nil
Finishes the
Gtk::FileDialog#open
call. -
#open_multiple(parent : Gtk::Window | Nil, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil
Presents a file chooser dialog to the user.
-
#open_multiple_finish(result : Gio::AsyncResult) : Gio::ListModel | Nil
Finishes the
Gtk::FileDialog#open
call. -
#open_multiple_text_files(parent : Gtk::Window | Nil, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil
Presents a file chooser dialog to the user.
-
#open_multiple_text_files_finish(result : Gio::AsyncResult, encoding : String) : Gio::ListModel | Nil
Finishes the
Gtk::FileDialog#open
call. -
#open_text_file(parent : Gtk::Window | Nil, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil
Initiates a file selection operation by presenting a file chooser dialog to the user.
-
#open_text_file_finish(result : Gio::AsyncResult, encoding : String) : Gio::File | Nil
Finishes the
Gtk::FileDialog#open_text_file
call and returns the resulting file and text encoding. -
#save(parent : Gtk::Window | Nil, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil
Presents a file chooser dialog to the user.
-
#save_finish(result : Gio::AsyncResult) : Gio::File | Nil
Finishes the
Gtk::FileDialog#save
call. -
#save_text_file(parent : Gtk::Window | Nil, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil
Initiates a file save operation by presenting a file chooser dialog to the user.
-
#save_text_file_finish(result : Gio::AsyncResult, encoding : String, line_ending : String) : Gio::File | Nil
Finishes the
Gtk::FileDialog#save_text_file
call and returns the resulting file, text encoding and line endings. -
#select_folder(parent : Gtk::Window | Nil, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil
Presents a file chooser dialog to the user.
-
#select_folder_finish(result : Gio::AsyncResult) : Gio::File | Nil
Finishes the
Gtk::FileDialog#select_folder
call. -
#select_multiple_folders(parent : Gtk::Window | Nil, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil
Presents a file chooser dialog to the user.
-
#select_multiple_folders_finish(result : Gio::AsyncResult) : Gio::ListModel | Nil
Finishes the
Gtk::FileDialog#select_multiple_folders
call. -
#title : String
Returns the title that will be shown on the file chooser dialog.
-
#title=(title : String) : Nil
Sets the title that will be shown on the file chooser dialog.
-
#title=(value : Nil) : Nil
Set
#title
property to nil. -
#title? : String | Nil
Same as
#title
, but can return nil.
Instance methods inherited from class GObject::Object
==(other : self)
==,
bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding
bind_property,
bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding
bind_property_full,
data(key : String) : Pointer(Void) | Nil
data,
finalize
finalize,
freeze_notify : Nil
freeze_notify,
getv(names : Enumerable(String), values : Enumerable(_)) : Nil
getv,
hash(hasher)
hash,
notify(property_name : String) : Nil
notify,
notify_by_pspec(pspec : GObject::ParamSpec) : Nil
notify_by_pspec,
notify_signal
notify_signal,
property(property_name : String, value : _) : Nil
property,
qdata(quark : UInt32) : Pointer(Void) | Nil
qdata,
ref_count : UInt32
ref_count,
run_dispose : Nil
run_dispose,
set_data(key : String, data : Pointer(Void) | Nil) : Nil
set_data,
set_property(property_name : String, value : _) : Nil
set_property,
steal_data(key : String) : Pointer(Void) | Nil
steal_data,
steal_qdata(quark : UInt32) : Pointer(Void) | Nil
steal_qdata,
thaw_notify : Nil
thaw_notify,
to_unsafe : Pointer(Void)
to_unsafe,
watch_closure(closure : GObject::Closure) : Nil
watch_closure
Constructor methods inherited from class GObject::Object
cast(obj : GObject::Object) : self
cast,
new(pointer : Pointer(Void), transfer : GICrystal::Transfer)new new, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv
Class methods inherited from class GObject::Object
cast?(obj : GObject::Object) : self | Nil
cast?,
compat_control(what : UInt64, data : Pointer(Void) | Nil) : UInt64
compat_control,
g_type : UInt64
g_type,
interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec
interface_find_property,
interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec)
interface_list_properties
Macros inherited from class GObject::Object
previous_vfunc(*args)
previous_vfunc,
previous_vfunc!(*args)
previous_vfunc!,
signal(signature)
signal
Constructor Detail
Class Method Detail
Instance Method Detail
Returns true
if this reference is the same as other. Invokes same?
.
Sets the label shown on the file chooser's accept button.
Leaving the accept label unset or setting it as NULL
will
fall back to a default label, depending on what API is used
to launch the file dialog.
Gets the filter that will be selected by default in the file chooser dialog.
Sets the filter that will be selected by default in the file chooser dialog.
If set to NULL
, the first item in Gtk::FileDialog#filters
will be used as the default filter. If that list is empty, the dialog
will be unfiltered.
Gets the filters that will be offered to the user in the file chooser dialog.
Sets the filters that will be offered to the user in the file chooser dialog.
Gets the file that will be initially selected in the file chooser dialog.
Sets the file that will be initially selected in the file chooser dialog.
This function is a shortcut for calling both
Gtk::FileDialog#initial_folder=
and
Gtk::FileDialog#initial_name=
with the
directory and name of file, respectively.
Gets the folder that will be set as the initial folder in the file chooser dialog.
Sets the folder that will be set as the initial folder in the file chooser dialog.
Sets the filename that will be initially selected.
For save dialogs, name will usually be pre-entered into the name field.
If a file with this name already exists in the directory set via [property@Gtk.FileDialog:initial-folder], the dialog will preselect it.
Returns whether the file chooser dialog blocks interaction with the parent window while it is presented.
Sets whether the file chooser dialog blocks interaction with the parent window while it is presented.
Presents a file chooser dialog to the user.
The file chooser dialog will be set up to select a single file.
The callback will be called when the dialog is dismissed.
Presents a file chooser dialog to the user.
The file chooser dialog will be set up to select multiple files.
The file chooser dialog will initially be opened in the directory [property@Gtk.FileDialog:initial-folder].
The callback will be called when the dialog is dismissed.
Presents a file chooser dialog to the user.
The file chooser dialog will be set up to select multiple files.
The file chooser dialog will initially be opened in the directory [property@Gtk.FileDialog:initial-folder].
In contrast to Gtk::FileDialog#open
, this function
lets the user select the text encoding for the files, if possible.
The callback will be called when the dialog is dismissed.
Finishes the Gtk::FileDialog#open
call.
Initiates a file selection operation by presenting a file chooser dialog to the user.
In contrast to Gtk::FileDialog#open
, this function
lets the user select the text encoding for the file, if possible.
The callback will be called when the dialog is dismissed.
Finishes the Gtk::FileDialog#open_text_file
call
and returns the resulting file and text encoding.
If the user has explicitly selected a text encoding to use
for the file, then encoding will be set to a codeset name that
is suitable for passing to iconv_open(). Otherwise, it will
be NULL
.
Presents a file chooser dialog to the user.
The file chooser dialog will be save mode.
The callback will be called when the dialog is dismissed.
Initiates a file save operation by presenting a file chooser dialog to the user.
In contrast to Gtk::FileDialog#save
, this function
lets the user select the text encoding and line endings for
the text file, if possible.
The callback will be called when the dialog is dismissed.
Finishes the Gtk::FileDialog#save_text_file
call
and returns the resulting file, text encoding and line endings.
If the user has explicitly selected a text encoding to use
for the file, then encoding will be set to a codeset name that
is suitable for passing to iconv_open(). Otherwise, it will
be NULL
.
The line_ending will be set to one of "\n", "\r\n", "\r" or "", where the latter means to preserve existing line endings.
Presents a file chooser dialog to the user.
The file chooser dialog will be set up to select a single folder.
If you pass initial_folder, the file chooser dialog will initially be opened in the parent directory of that folder, otherwise, it will be in the directory [property@Gtk.FileDialog:initial-folder].
The callback will be called when the dialog is dismissed.
Presents a file chooser dialog to the user.
The file chooser dialog will be set up to allow selecting multiple folders.
The file chooser dialog will initially be opened in the directory [property@Gtk.FileDialog:initial-folder].
The callback will be called when the dialog is dismissed.