gtkmm: Gtk::FileDialog Class Reference

gtkmm 4.11.1

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gtk::FileDialog Class Reference
Dialogs

A Gtk::FileDialog 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. More...

`#include <gtkmm/filedialog.h>`

Inheritance diagram for Gtk::FileDialog:
[legend]

## Public Member Functions
| FileDialog (FileDialog && src) noexcept
FileDialog & | operator= (FileDialog && src) noexcept
| ~FileDialog () noexcept override
GtkFileDialog * | gobj ()
| Provides access to the underlying C GObject. More...
const GtkFileDialog * | gobj () const
| Provides access to the underlying C GObject. More...
GtkFileDialog * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
Glib::ustring | get_title () const
| Returns the title that will be shown on the file chooser dialog. More...
void | set_title (const Glib::ustring & title)
| Sets the title that will be shown on the file chooser dialog. More...
bool | get_modal () const
| Returns whether the file chooser dialog blocks interaction with the parent window while it is presented. More...
void | set_modal (bool modal=true)
| Sets whether the file chooser dialog blocks interaction with the parent window while it is presented. More...
Glib::RefPtr< Gio::ListModel > | get_filters ()
| Gets the filters that will be offered to the user in the file chooser dialog. More...
Glib::RefPtr< const Gio::ListModel > | get_filters () const
| Gets the filters that will be offered to the user in the file chooser dialog. More...
void | set_filters (const Glib::RefPtr< Gio::ListModel > & filters)
| Sets the filters that will be offered to the user in the file chooser dialog. More...
Glib::RefPtr< FileFilter > | get_default_filter ()
| Gets the filter that will be selected by default in the file chooser dialog. More...
Glib::RefPtr< const FileFilter > | get_default_filter () const
| Gets the filter that will be selected by default in the file chooser dialog. More...
void | set_default_filter (const Glib::RefPtr< FileFilter > & filter)
| Sets the filter that will be selected by default in the file chooser dialog. More...
Glib::RefPtr< Gio::File > | get_initial_folder ()
| Gets the folder that will be set as the initial folder in the file chooser dialog. More...
Glib::RefPtr< const Gio::File > | get_initial_folder () const
| Gets the folder that will be set as the initial folder in the file chooser dialog. More...
void | set_initial_folder (const Glib::RefPtr< Gio::File > & folder)
| Sets the folder that will be set as the initial folder in the file chooser dialog. More...
std::string | get_initial_name () const
| Gets the name for the file that should be initially set. More...
void | set_initial_name (const std::string & name)
| Sets the name for the file that should be initially set. More...
Glib::RefPtr< Gio::File > | get_initial_file ()
| Gets the file that will be initially selected in the file chooser dialog. More...
Glib::RefPtr< const Gio::File > | get_initial_file () const
| Gets the file that will be initially selected in the file chooser dialog. More...
void | set_initial_file (const Glib::RefPtr< Gio::File > & file)
| Sets the file that will be initially selected in the file chooser dialog. More...
Glib::ustring | get_accept_label () const
void | set_accept_label (const Glib::ustring & accept_label)
| Sets the label shown on the file chooser's accept button. More...
void | open (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={})
| This function initiates a file selection operation by presenting a file chooser dialog to the user. More...
void | open (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={})
| A open() convenience overload. More...
Glib::RefPtr< Gio::File > | open_finish (const Glib::RefPtr< Gio::AsyncResult > & result)
| Finishes the open() call and returns the resulting file. More...
void | select_folder (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={})
| This function initiates a directory selection operation by presenting a file chooser dialog to the user. More...
void | select_folder (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={})
| A select_folder() convenience overload. More...
Glib::RefPtr< Gio::File > | select_folder_finish (const Glib::RefPtr< Gio::AsyncResult > & result)
| Finishes the select_folder() call and returns the resulting file. More...
void | save (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={})
| This function initiates a file save operation by presenting a file chooser dialog to the user. More...
void | save (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={})
| A save() convenience overload. More...
Glib::RefPtr< Gio::File > | save_finish (const Glib::RefPtr< Gio::AsyncResult > & result)
| Finishes the save() call and returns the resulting file. More...
void | open_multiple (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={})
| This function initiates a multi-file selection operation by presenting a file chooser dialog to the user. More...
void | open_multiple (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={})
| A open_multiple() convenience overload. More...
std::vector< Glib::RefPtr< Gio::File > > | open_multiple_finish (const Glib::RefPtr< Gio::AsyncResult > & result)
| Finishes the open_multiple() call and returns the resulting files in a std::vector. More...
void | select_multiple_folders (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={})
| This function initiates a multi-directory selection operation by presenting a file chooser dialog to the user. More...
void | select_multiple_folders (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={})
| A select_multiple_folders() convenience overload. More...
std::vector< Glib::RefPtr< Gio::File > > | select_multiple_folders_finish (const Glib::RefPtr< Gio::AsyncResult > & result)
| Finishes the select_multiple_folders() call and returns the resulting files in a std::vector. More...
Glib::PropertyProxy< Glib::ustring > | property_title ()
| A title that may be shown on the file chooser dialog. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_title () const
| A title that may be shown on the file chooser dialog. More...
Glib::PropertyProxy< bool > | property_modal ()
| Whether the file chooser dialog is modal. More...
Glib::PropertyProxy_ReadOnly< bool > | property_modal () const
| Whether the file chooser dialog is modal. More...
Glib::PropertyProxy< Glib::RefPtr< Gio::ListModel > > | property_filters ()
| The list of filters. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::ListModel > > | property_filters () const
| The list of filters. More...
Glib::PropertyProxy< Glib::RefPtr< FileFilter > > | property_default_filter ()
| The default filter, that is, the filter that is initially active in the file chooser dialog. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< FileFilter > > | property_default_filter () const
| The default filter, that is, the filter that is initially active in the file chooser dialog. More...
Glib::PropertyProxy< Glib::RefPtr< Gio::File > > | property_initial_file ()
| The inital file, that is, the file that is initially selected in the file chooser dialog. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::File > > | property_initial_file () const
| The inital file, that is, the file that is initially selected in the file chooser dialog. More...
Glib::PropertyProxy< Glib::RefPtr< Gio::File > > | property_initial_folder ()
| The inital folder, that is, the directory that is initially opened in the file chooser dialog. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::File > > | property_initial_folder () const
| The inital folder, that is, the directory that is initially opened in the file chooser dialog. More...
Glib::PropertyProxy< std::string > | property_initial_name ()
| The inital name, that is, the filename that is initially selected in the file chooser dialog. More...
Glib::PropertyProxy_ReadOnly< std::string > | property_initial_name () const
| The inital name, that is, the filename that is initially selected in the file chooser dialog. More...
Glib::PropertyProxy< Glib::ustring > | property_accept_label ()
| Label for the file chooser's accept button. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_accept_label () const
| Label for the file chooser's accept button. More...
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data_with_c_callback (const Quark &key, void *data, GDestroyNotify notify)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
PropertyType | get_property (const Glib::ustring &property_name) const
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< FileDialog > | create ()

## Protected Member Functions
| FileDialog ()
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gtk::FileDialog > | wrap (GtkFileDialog * object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

A Gtk::FileDialog 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 open(), save(), etc. These APIs follow the GIO async pattern, and the result can be obtained by calling the corresponding finish function, for example open_finish().

Since gtkmm 4.10:

## Constructor & Destructor Documentation

## ◆ FileDialog() [1/2]

Gtk::FileDialog::FileDialog | ( | FileDialog && | src | ) |
| noexcept

## ◆ ~FileDialog()

Gtk::FileDialog::~FileDialog | ( |  | ) |
| overridenoexcept

## ◆ FileDialog() [2/2]

Gtk::FileDialog::FileDialog | ( |  | ) |
| protected

## Member Function Documentation

## ◆ create()

static Glib::RefPtr< FileDialog > Gtk::FileDialog::create | ( |  | ) |
| static

## ◆ get_accept_label()

Glib::ustring Gtk::FileDialog::get_accept_label | ( |  | ) | const

Since gtkmm 4.10:

Returns
  The label shown on the file chooser's accept button.

## ◆ get_default_filter() [1/2]

Glib::RefPtr< FileFilter > Gtk::FileDialog::get_default_filter | ( |  | ) |

Gets the filter that will be selected by default in the file chooser dialog.

Since gtkmm 4.10:

Returns
  The current filter.

## ◆ get_default_filter() [2/2]

Glib::RefPtr< const FileFilter > Gtk::FileDialog::get_default_filter | ( |  | ) | const

Gets the filter that will be selected by default in the file chooser dialog.

Since gtkmm 4.10:

Returns
  The current filter.

## ◆ get_filters() [1/2]

Glib::RefPtr< Gio::ListModel > Gtk::FileDialog::get_filters | ( |  | ) |

Gets the filters that will be offered to the user in the file chooser dialog.

Since gtkmm 4.10:

Returns
  The filters, as a `Gio::ListModel` of `Gtk::FileFilters`.

## ◆ get_filters() [2/2]

Glib::RefPtr< const Gio::ListModel > Gtk::FileDialog::get_filters | ( |  | ) | const

Gets the filters that will be offered to the user in the file chooser dialog.

Since gtkmm 4.10:

Returns
  The filters, as a `Gio::ListModel` of `Gtk::FileFilters`.

## ◆ get_initial_file() [1/2]

Glib::RefPtr< Gio::File > Gtk::FileDialog::get_initial_file | ( |  | ) |

Gets the file that will be initially selected in the file chooser dialog.

Since gtkmm 4.10:

Returns
  The file.

## ◆ get_initial_file() [2/2]

Glib::RefPtr< const Gio::File > Gtk::FileDialog::get_initial_file | ( |  | ) | const

Gets the file that will be initially selected in the file chooser dialog.

Since gtkmm 4.10:

Returns
  The file.

## ◆ get_initial_folder() [1/2]

Glib::RefPtr< Gio::File > Gtk::FileDialog::get_initial_folder | ( |  | ) |

Gets the folder that will be set as the initial folder in the file chooser dialog.

Since gtkmm 4.10:

Returns
  The folder.

## ◆ get_initial_folder() [2/2]

Glib::RefPtr< const Gio::File > Gtk::FileDialog::get_initial_folder | ( |  | ) | const

Gets the folder that will be set as the initial folder in the file chooser dialog.

Since gtkmm 4.10:

Returns
  The folder.

## ◆ get_initial_name()

std::string Gtk::FileDialog::get_initial_name | ( |  | ) | const

Gets the name for the file that should be initially set.

Since gtkmm 4.10:

Returns
  The name.

## ◆ get_modal()

bool Gtk::FileDialog::get_modal | ( |  | ) | const

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

Since gtkmm 4.10:

Returns
  `true` if the file chooser dialog is modal.

## ◆ get_title()

Glib::ustring Gtk::FileDialog::get_title | ( |  | ) | const

Returns the title that will be shown on the file chooser dialog.

Since gtkmm 4.10:

Returns
  The title.

## ◆ get_type()

static GType Gtk::FileDialog::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GtkFileDialog * Gtk::FileDialog::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkFileDialog * Gtk::FileDialog::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkFileDialog * Gtk::FileDialog::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ open() [1/2]

void Gtk::FileDialog::open | ( | const Gio::SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Gio::Cancellable > & | cancellable = `{}`
| ) |  |

A open() convenience overload.

## ◆ open() [2/2]

void Gtk::FileDialog::open | ( | Window & | parent,
|  | const Gio::SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Gio::Cancellable > & | cancellable = `{}`
| ) |  |

This function initiates a file selection operation by presenting a file chooser dialog to the user.

The slot will be called when the dialog is dismissed. It should call open_finish() to obtain the result.

Since gtkmm 4.10:

Parameters

  parent | The parent `Gtk::Window`.
  cancellable | A `Cancellable` to cancel the operation.
  slot | A callback to call when the operation is complete.

## ◆ open_finish()

Glib::RefPtr< Gio::File > Gtk::FileDialog::open_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) |

Finishes the open() call and returns the resulting file.

Since gtkmm 4.10:

Parameters

  result | A `Gio::AsyncResult`.

Returns
  The file that was selected. Otherwise, `nullptr` is returned and error is set.

Exceptions

  Gtk::DialogError |

## ◆ open_multiple() [1/2]

void Gtk::FileDialog::open_multiple | ( | const Gio::SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Gio::Cancellable > & | cancellable = `{}`
| ) |  |

A open_multiple() convenience overload.

## ◆ open_multiple() [2/2]

void Gtk::FileDialog::open_multiple | ( | Window & | parent,
|  | const Gio::SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Gio::Cancellable > & | cancellable = `{}`
| ) |  |

This function initiates a multi-file selection operation by presenting a file chooser dialog to the user.

The file chooser will initially be opened in the directory property_initial_folder().

The slot will be called when the dialog is dismissed. It should call open_multiple_finish() to obtain the result.

Since gtkmm 4.10:

Parameters

  parent | The parent `Gtk::Window`.
  cancellable | A `Cancellable` to cancel the operation.
  slot | A callback to call when the operation is complete.

## ◆ open_multiple_finish()

std::vector< Glib::RefPtr< Gio::File > > Gtk::FileDialog::open_multiple_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) |

Finishes the open_multiple() call and returns the resulting files in a std::vector.

Since gtkmm 4.10:

Parameters

  result | A `Gio::AsyncResult`.

Returns
  The files that were selected, as a vector of `Gio::File`s. Otherwise, an exception is thrown.

Exceptions

  Gtk::DialogError |

## ◆ operator=()

FileDialog & Gtk::FileDialog::operator= | ( | FileDialog && | src | ) |
| noexcept

## ◆ property_accept_label() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::FileDialog::property_accept_label | ( |  | ) |

Label for the file chooser's accept button.

Since gtkmm 4.10:

Default value: ""

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_accept_label() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::FileDialog::property_accept_label | ( |  | ) | const

Label for the file chooser's accept button.

Since gtkmm 4.10:

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_default_filter() [1/2]

Glib::PropertyProxy< Glib::RefPtr< FileFilter > > Gtk::FileDialog::property_default_filter | ( |  | ) |

The default filter, that is, the filter that is initially active in the file chooser dialog.

If the default filter is `nullptr`, the first filter of property_filters() is used as the default filter. If that property contains no filter, the dialog will be unfiltered.

If property_filters() is not `nullptr`, the default filter should be part of the list. If it is not, the dialog may choose to not make it available.

Since gtkmm 4.10:

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_default_filter() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< FileFilter > > Gtk::FileDialog::property_default_filter | ( |  | ) | const

The default filter, that is, the filter that is initially active in the file chooser dialog.

If the default filter is `nullptr`, the first filter of property_filters() is used as the default filter. If that property contains no filter, the dialog will be unfiltered.

If property_filters() is not `nullptr`, the default filter should be part of the list. If it is not, the dialog may choose to not make it available.

Since gtkmm 4.10:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_filters() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Gio::ListModel > > Gtk::FileDialog::property_filters | ( |  | ) |

The list of filters.

See property_default_filter() about how those two properties interact.

Since gtkmm 4.10:

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_filters() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::ListModel > > Gtk::FileDialog::property_filters | ( |  | ) | const

The list of filters.

See property_default_filter() about how those two properties interact.

Since gtkmm 4.10:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_initial_file() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Gio::File > > Gtk::FileDialog::property_initial_file | ( |  | ) |

The inital file, that is, the file that is initially selected in the file chooser dialog.

This is a utility property that sets both property_initial_folder() and property_initial_name().

Since gtkmm 4.10:

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_initial_file() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::File > > Gtk::FileDialog::property_initial_file | ( |  | ) | const

The inital file, that is, the file that is initially selected in the file chooser dialog.

This is a utility property that sets both property_initial_folder() and property_initial_name().

Since gtkmm 4.10:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_initial_folder() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Gio::File > > Gtk::FileDialog::property_initial_folder | ( |  | ) |

The inital folder, that is, the directory that is initially opened in the file chooser dialog.

Since gtkmm 4.10:

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_initial_folder() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::File > > Gtk::FileDialog::property_initial_folder | ( |  | ) | const

The inital folder, that is, the directory that is initially opened in the file chooser dialog.

Since gtkmm 4.10:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_initial_name() [1/2]

Glib::PropertyProxy< std::string > Gtk::FileDialog::property_initial_name | ( |  | ) |

The inital name, that is, the filename that is initially selected in the file chooser dialog.

Since gtkmm 4.10:

Default value: ""

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_initial_name() [2/2]

Glib::PropertyProxy_ReadOnly< std::string > Gtk::FileDialog::property_initial_name | ( |  | ) | const

The inital name, that is, the filename that is initially selected in the file chooser dialog.

Since gtkmm 4.10:

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_modal() [1/2]

Glib::PropertyProxy< bool > Gtk::FileDialog::property_modal | ( |  | ) |

Whether the file chooser dialog is modal.

Since gtkmm 4.10:

Default value: `true`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_modal() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::FileDialog::property_modal | ( |  | ) | const

Whether the file chooser dialog is modal.

Since gtkmm 4.10:

Default value: `true`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_title() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::FileDialog::property_title | ( |  | ) |

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

Since gtkmm 4.10:

Default value: ""

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_title() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::FileDialog::property_title | ( |  | ) | const

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

Since gtkmm 4.10:

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ save() [1/2]

void Gtk::FileDialog::save | ( | const Gio::SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Gio::Cancellable > & | cancellable = `{}`
| ) |  |

A save() convenience overload.

## ◆ save() [2/2]

void Gtk::FileDialog::save | ( | Window & | parent,
|  | const Gio::SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Gio::Cancellable > & | cancellable = `{}`
| ) |  |

This function initiates a file save operation by presenting a file chooser dialog to the user.

The slot will be called when the dialog is dismissed. It should call save_finish() to obtain the result.

Since gtkmm 4.10:

Parameters

  parent | The parent `Gtk::Window`.
  cancellable | A `Cancellable` to cancel the operation.
  slot | A callback to call when the operation is complete.

## ◆ save_finish()

Glib::RefPtr< Gio::File > Gtk::FileDialog::save_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) |

Finishes the save() call and returns the resulting file.

Since gtkmm 4.10:

Parameters

  result | A `Gio::AsyncResult`.

Returns
  The file that was selected. Otherwise, `nullptr` is returned and error is set.

Exceptions

  Gtk::DialogError |

## ◆ select_folder() [1/2]

void Gtk::FileDialog::select_folder | ( | const Gio::SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Gio::Cancellable > & | cancellable = `{}`
| ) |  |

A select_folder() convenience overload.

## ◆ select_folder() [2/2]

void Gtk::FileDialog::select_folder | ( | Window & | parent,
|  | const Gio::SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Gio::Cancellable > & | cancellable = `{}`
| ) |  |

This function initiates a directory selection operation by presenting a file chooser dialog to the user.

If you pass initial_folder, the file chooser will initially be opened in the parent directory of that folder, otherwise, it will be in the directory property_initial_folder().

The slot will be called when the dialog is dismissed. It should call select_folder_finish() to obtain the result.

Since gtkmm 4.10:

Parameters

  parent | The parent `Gtk::Window`.
  cancellable | A `Cancellable` to cancel the operation.
  slot | A callback to call when the operation is complete.

## ◆ select_folder_finish()

Glib::RefPtr< Gio::File > Gtk::FileDialog::select_folder_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) |

Finishes the select_folder() call and returns the resulting file.

Since gtkmm 4.10:

Parameters

  result | A `Gio::AsyncResult`.

Returns
  The file that was selected. Otherwise, `nullptr` is returned and error is set.

Exceptions

  Gtk::DialogError |

## ◆ select_multiple_folders() [1/2]

void Gtk::FileDialog::select_multiple_folders | ( | const Gio::SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Gio::Cancellable > & | cancellable = `{}`
| ) |  |

A select_multiple_folders() convenience overload.

## ◆ select_multiple_folders() [2/2]

void Gtk::FileDialog::select_multiple_folders | ( | Window & | parent,
|  | const Gio::SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Gio::Cancellable > & | cancellable = `{}`
| ) |  |

This function initiates a multi-directory selection operation by presenting a file chooser dialog to the user.

The file chooser will initially be opened in the directory property_initial_folder().

The slot will be called when the dialog is dismissed. It should call select_multiple_folders_finish() to obtain the result.

Since gtkmm 4.10:

Parameters

  parent | The parent `Gtk::Window`.
  cancellable | A `Cancellable` to cancel the operation.
  slot | A callback to call when the operation is complete.

## ◆ select_multiple_folders_finish()

std::vector< Glib::RefPtr< Gio::File > > Gtk::FileDialog::select_multiple_folders_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) |

Finishes the select_multiple_folders() call and returns the resulting files in a std::vector.

Since gtkmm 4.10:

Parameters

  result | A Gio::AsyncResult.

Returns
  The files that were selected, as a vector of `Gio::File`s. Otherwise, an exception is thrown.

Exceptions

  Gtk::DialogError |

## ◆ set_accept_label()

void Gtk::FileDialog::set_accept_label | ( | const Glib::ustring & | accept_label | ) |

Sets the label shown on the file chooser's accept button.

Leaving the accept label unset or setting it as `nullptr` will fall back to a default label, depending on what API is used to launch the file dialog.

Since gtkmm 4.10:

Parameters

  accept_label | The new accept label.

## ◆ set_default_filter()

void Gtk::FileDialog::set_default_filter | ( | const Glib::RefPtr< FileFilter > & | filter | ) |

Sets the filter that will be selected by default in the file chooser dialog.

If set to `nullptr`, the first item in property_filters() will be used as the default filter. If that list is empty, the dialog will be unfiltered.

Since gtkmm 4.10:

Parameters

  filter | A `Gtk::FileFilter`.

## ◆ set_filters()

void Gtk::FileDialog::set_filters | ( | const Glib::RefPtr< Gio::ListModel > & | filters | ) |

Sets the filters that will be offered to the user in the file chooser dialog.

Since gtkmm 4.10:

Parameters

  filters | A `Gio::ListModel` of `Gtk::FileFilters`.

## ◆ set_initial_file()

void Gtk::FileDialog::set_initial_file | ( | const Glib::RefPtr< Gio::File > & | file | ) |

Sets the file that will be initially selected in the file chooser dialog.

This function is a shortcut for calling both set_initial_folder() and set_initial_name() with the directory and name of file respectively.

Since gtkmm 4.10:

Parameters

  file | A `Gio::File`.

## ◆ set_initial_folder()

void Gtk::FileDialog::set_initial_folder | ( | const Glib::RefPtr< Gio::File > & | folder | ) |

Sets the folder that will be set as the initial folder in the file chooser dialog.

Since gtkmm 4.10:

Parameters

  folder | A `Gio::File`.

## ◆ set_initial_name()

void Gtk::FileDialog::set_initial_name | ( | const std::string & | name | ) |

Sets the name for the file that should be initially set.

For saving dialogs, this will usually be pre-entered into the name field.

If a file with this name already exists in the directory set via property_initial_folder(), the dialog should preselect it.

Since gtkmm 4.10:

Parameters

  name | A UTF8 string.

## ◆ set_modal()

void Gtk::FileDialog::set_modal | ( | bool | modal = `true` | ) |

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

Since gtkmm 4.10:

Parameters

  modal | The new value.

## ◆ set_title()

void Gtk::FileDialog::set_title | ( | const Glib::ustring & | title | ) |

Sets the title that will be shown on the file chooser dialog.

Since gtkmm 4.10:

Parameters

  title | The new title.

## Friends And Related Function Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::FileDialog > wrap | ( | GtkFileDialog * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.