Class: Gtk::FileDialog

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Gtk::FileDialog

Creates a new GtkFileDialog object.

Instance Method Details

#accept_label ⇒ String

Label for the file chooser's accept button.

Returns:

  • (String) —

    accept-label

#accept_label=(accept_label) ⇒ String

Label for the file chooser's accept button.

Parameters:

  • accept_label (String)

Returns:

  • (String) —

    accept-label

  • (String) —

    accept-label

#default_filter ⇒ Gtk::FileFilter

The default filter.

This filter is initially active in the file chooser dialog.

If the default filter is NULL, the first filter of [propertyGtk.FileDialog:filters]
is used as the default filter. If that property contains no filter, the dialog will
be unfiltered.

If [propertyGtk.FileDialog:filters] is not NULL, the default filter should be
part of the list. If it is not, the dialog may choose to not make it available.

Returns:

#default_filter=(default_filter) ⇒ Gtk::FileFilter

The default filter.

This filter is initially active in the file chooser dialog.

If the default filter is NULL, the first filter of [propertyGtk.FileDialog:filters]
is used as the default filter. If that property contains no filter, the dialog will
be unfiltered.

If [propertyGtk.FileDialog:filters] is not NULL, the default filter should be
part of the list. If it is not, the dialog may choose to not make it available.

Parameters:

Returns:

#filters ⇒ Gio::ListModel

The list of filters.

See [propertyGtk.FileDialog:default-filter] about how these
two properties interact.

Returns:

  • (Gio::ListModel) —

    filters

#filters=(filters) ⇒ Gio::ListModel

The list of filters.

See [propertyGtk.FileDialog:default-filter] about how these
two properties interact.

Parameters:

  • filters (Gio::ListModel)

Returns:

  • (Gio::ListModel) —

    filters

  • (Gio::ListModel) —

    filters

#initial_file ⇒ Gio::File

The initial file.

This file is initially selected in the file chooser dialog

This is a utility property that sets both [propertyGtk.FileDialog:initial-folder]
and [propertyGtk.FileDialog:initial-name].

Returns:

  • (Gio::File) —

    initial-file

#initial_file=(initial_file) ⇒ Gio::File

The initial file.

This file is initially selected in the file chooser dialog

This is a utility property that sets both [propertyGtk.FileDialog:initial-folder]
and [propertyGtk.FileDialog:initial-name].

Parameters:

  • initial_file (Gio::File)

Returns:

  • (Gio::File) —

    initial-file

  • (Gio::File) —

    initial-file

#initial_folder ⇒ Gio::File

The initial folder.

This is the directory that is initially opened in the file chooser dialog.

Returns:

  • (Gio::File) —

    initial-folder

#initial_folder=(initial_folder) ⇒ Gio::File

The initial folder.

This is the directory that is initially opened in the file chooser dialog.

Parameters:

  • initial_folder (Gio::File)

Returns:

  • (Gio::File) —

    initial-folder

  • (Gio::File) —

    initial-folder

#initial_name ⇒ String

The initial name.

This is the name of the file that is initially selected in the file chooser dialog.

Returns:

  • (String) —

    initial-name

#initial_name=(initial_name) ⇒ String

The initial name.

This is the name of the file that is initially selected in the file chooser dialog.

Parameters:

  • initial_name (String)

Returns:

  • (String) —

    initial-name

  • (String) —

    initial-name

Returns whether the file chooser dialog blocks interaction
with the parent window while it is presented.

Returns:

  • (Boolean) —

    true if the file chooser dialog is modal

#modal=(modal) ⇒ Boolean

Whether the file chooser dialog is modal.

Parameters:

  • modal (Boolean)

Returns:

  • (Boolean) —

    modal

  • (Boolean) —

    modal

#modal? ⇒ Boolean

Whether the file chooser dialog is modal.

Returns:

  • (Boolean) —

    modal

#open(parent, cancellable, callback, user_data) ⇒ nil

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 closed.

Parameters:

  • parent (Gtk::Window) —

    the parent window

  • cancellable (Gio::Cancellable) —

    a cancellable to cancel the operation

  • callback (Gio::AsyncReadyCallback) —

    a callback to call when the
    operation is complete

  • user_data (GObject) —

    data to pass to callback

Returns:

  • (nil)

#open_finish(result) ⇒ Gio::File

Finishes the [methodGtk.FileDialog.open] call.

Note that this function returns a [errorGtk.DialogError.DISMISSED]
error if the user cancels the dialog.

Parameters:

  • result (Gio::AsyncResult) —

    the result

Returns:

  • (Gio::File) —

    the file that was selected

#open_multiple(parent, cancellable, callback, user_data) ⇒ nil

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
[propertyGtk.FileDialog:initial-folder].

The callback will be called when the dialog is closed.

Parameters:

  • parent (Gtk::Window) —

    the parent window

  • cancellable (Gio::Cancellable) —

    a cancellable to cancel the operation

  • callback (Gio::AsyncReadyCallback) —

    a callback to call when the
    operation is complete

  • user_data (GObject) —

    data to pass to callback

Returns:

  • (nil)

#open_multiple_finish(result) ⇒ Gio::ListModel

Finishes the [methodGtk.FileDialog.open] call.

Note that this function returns a [errorGtk.DialogError.DISMISSED]
error if the user cancels the dialog.

Parameters:

  • result (Gio::AsyncResult) —

    the result

Returns:

  • (Gio::ListModel) —

    the files that were selected,
    as a list model of [ifaceGio.File]

#open_multiple_text_files(parent, cancellable, callback, user_data) ⇒ nil

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
[propertyGtk.FileDialog:initial-folder].

In contrast to [methodGtk.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 closed.

Parameters:

  • parent (Gtk::Window) —

    the parent window

  • cancellable (Gio::Cancellable) —

    a cancellable to cancel the operation

  • callback (Gio::AsyncReadyCallback) —

    a callback to call when the
    operation is complete

  • user_data (GObject) —

    data to pass to callback

Returns:

  • (nil)

#open_multiple_text_files_finish(result, encoding) ⇒ Gio::ListModel

Finishes the [methodGtk.FileDialog.open] call.

Note that this function returns a [errorGtk.DialogError.DISMISSED]
error if the user cancels the dialog.

Parameters:

  • result (Gio::AsyncResult) —

    the result

  • encoding (String) —

    return location for the text encoding to use

Returns:

  • (Gio::ListModel) —

    the files that were selected,
    as a list model of [ifaceGio.File]

#open_text_file(parent, cancellable, callback, user_data) ⇒ nil

Initiates a file selection operation by presenting a file chooser
dialog to the user.

In contrast to [methodGtk.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 closed.

Parameters:

  • parent (Gtk::Window) —

    the parent GtkWindow

  • cancellable (Gio::Cancellable) —

    a GCancellable to cancel the operation

  • callback (Gio::AsyncReadyCallback) —

    a callback to call when the
    operation is complete

  • user_data (GObject) —

    data to pass to callback

Returns:

  • (nil)

#open_text_file_finish(result, encoding) ⇒ Gio::File

Finishes the [methodGtk.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.

Note that this function returns a [errorGtk.DialogError.DISMISSED]
error if the user cancels the dialog.

Parameters:

  • result (Gio::AsyncResult) —

    a GAsyncResult

  • encoding (String) —

    return location for the text encoding to use

Returns:

  • (Gio::File) —

    the file that was selected

#save(parent, cancellable, callback, user_data) ⇒ nil

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 closed.

Parameters:

  • parent (Gtk::Window) —

    the parent window

  • cancellable (Gio::Cancellable) —

    a cancellable to cancel the operation

  • callback (Gio::AsyncReadyCallback) —

    a callback to call when the
    operation is complete

  • user_data (GObject) —

    data to pass to callback

Returns:

  • (nil)

#save_finish(result) ⇒ Gio::File

Finishes the [methodGtk.FileDialog.save] call.

Note that this function returns a [errorGtk.DialogError.DISMISSED]
error if the user cancels the dialog.

Parameters:

  • result (Gio::AsyncResult) —

    the result

Returns:

  • (Gio::File) —

    the file that was selected

#save_text_file(parent, cancellable, callback, user_data) ⇒ nil

Initiates a file save operation by presenting a file chooser
dialog to the user.

In contrast to [methodGtk.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 closed.

Parameters:

  • parent (Gtk::Window) —

    the parent GtkWindow

  • cancellable (Gio::Cancellable) —

    a GCancellable to cancel the operation

  • callback (Gio::AsyncReadyCallback) —

    a callback to call when the
    operation is complete

  • user_data (GObject) —

    data to pass to callback

Returns:

  • (nil)

#save_text_file_finish(result, encoding, line_ending) ⇒ Gio::File

Finishes the [methodGtk.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.

Note that this function returns a [errorGtk.DialogError.DISMISSED]
error if the user cancels the dialog.

Parameters:

  • result (Gio::AsyncResult) —

    a GAsyncResult

  • encoding (String) —

    return location for the text encoding to use

  • line_ending (String) —

    return location for the line endings to use

Returns:

  • (Gio::File) —

    the file that was selected.

#select_folder(parent, cancellable, callback, user_data) ⇒ nil

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 [propertyGtk.FileDialog:initial-folder].

The callback will be called when the dialog is closed.

Parameters:

  • parent (Gtk::Window) —

    the parent window

  • cancellable (Gio::Cancellable) —

    a cancellable to cancel the operation

  • callback (Gio::AsyncReadyCallback) —

    a callback to call when the
    operation is complete

  • user_data (GObject) —

    data to pass to callback

Returns:

  • (nil)

#select_folder_finish(result) ⇒ Gio::File

Finishes the [methodGtk.FileDialog.select_folder] call.

Note that this function returns a [errorGtk.DialogError.DISMISSED]
error if the user cancels the dialog.

Parameters:

  • result (Gio::AsyncResult) —

    the result

Returns:

  • (Gio::File) —

    the folder that was selected

#select_multiple_folders(parent, cancellable, callback, user_data) ⇒ nil

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 [propertyGtk.FileDialog:initial-folder].

The callback will be called when the dialog is closed.

Parameters:

  • parent (Gtk::Window) —

    the parent window

  • cancellable (Gio::Cancellable) —

    a cancellable to cancel the operation

  • callback (Gio::AsyncReadyCallback) —

    a callback to call when the
    operation is complete

  • user_data (GObject) —

    data to pass to callback

Returns:

  • (nil)

#select_multiple_folders_finish(result) ⇒ Gio::ListModel

Finishes the [methodGtk.FileDialog.select_multiple_folders] call.

Note that this function returns a [errorGtk.DialogError.DISMISSED]
error if the user cancels the dialog.

Parameters:

  • result (Gio::AsyncResult) —

    the result

Returns:

  • (Gio::ListModel) —

    the folders that were selected,
    as a list model of [ifaceGio.File]

#title ⇒ String

A title that may be shown on the file chooser dialog.

Returns:

  • (String) —

    title

#title=(title) ⇒ String

A title that may be shown on the file chooser dialog.

Parameters:

  • title (String)

Returns:

  • (String) —

    title

  • (String) —

    title