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

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:
Inheritance graph
[legend]

Public Member Functions

 FileDialog (FileDialog &&src) noexcept
 
FileDialogoperator= (FileDialog &&src) noexcept
 
 ~FileDialog () noexcept override
 
GtkFileDialoggobj ()
 Provides access to the underlying C GObject.
 
const GtkFileDialoggobj () const
 Provides access to the underlying C GObject.
 
GtkFileDialoggobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
 
Glib::ustring get_title () const
 Returns the title that will be shown on the file chooser dialog.
 
void set_title (const Glib::ustring &title)
 Sets the title that will be shown on the file chooser dialog.
 
bool get_modal () const
 Returns whether the file chooser dialog blocks interaction with the parent window while it is presented.
 
void set_modal (bool modal=true)
 Sets whether the file chooser dialog blocks interaction with the parent window while it is presented.
 
Glib::RefPtr< Gio::ListModelget_filters ()
 Gets the filters that will be offered to the user in the file chooser dialog.
 
Glib::RefPtr< const Gio::ListModelget_filters () const
 Gets the filters that will be offered to the user in the file chooser dialog.
 
void set_filters (const Glib::RefPtr< Gio::ListModel > &filters)
 Sets the filters that will be offered to the user in the file chooser dialog.
 
Glib::RefPtr< FileFilterget_default_filter ()
 Gets the filter that will be selected by default in the file chooser dialog.
 
Glib::RefPtr< const FileFilterget_default_filter () const
 Gets the filter that will be selected by default in the file chooser dialog.
 
void set_default_filter (const Glib::RefPtr< FileFilter > &filter)
 Sets the filter that will be selected by default in the file chooser dialog.
 
Glib::RefPtr< Gio::Fileget_initial_folder ()
 Gets the folder that will be set as the initial folder in the file chooser dialog.
 
Glib::RefPtr< const Gio::Fileget_initial_folder () const
 Gets the folder that will be set as the initial folder in the file chooser dialog.
 
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.
 
std::string get_initial_name () const
 Gets the filename that will be initially selected.
 
void set_initial_name (const std::string & name)
 Sets the filename that will be initially selected.
 
Glib::RefPtr< Gio::Fileget_initial_file ()
 Gets the file that will be initially selected in the file chooser dialog.
 
Glib::RefPtr< const Gio::Fileget_initial_file () const
 Gets the file that will be initially selected in the file chooser dialog.
 
void set_initial_file (const Glib::RefPtr< Gio::File > & file)
 Sets the file that will be initially selected in the file chooser dialog.
 
Glib::ustring get_accept_label () const
 Retrieves the text used by the dialog on its accept button.
 
void set_accept_label (const Glib::ustring &accept_label)
 Sets the label shown on the file chooser's accept button.
 
void open (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 Presents a file chooser dialog to the user.
 
void open (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 A open() convenience overload.
 
Glib::RefPtr< Gio::Fileopen_finish (const Glib::RefPtr< Gio::AsyncResult > &result)
 Finishes the open() call.
 
void select_folder (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 Presents a file chooser dialog to the user.
 
void select_folder (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 A select_folder() convenience overload.
 
Glib::RefPtr< Gio::Fileselect_folder_finish (const Glib::RefPtr< Gio::AsyncResult > &result)
 Finishes the select_folder() call.
 
void save (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 Presents a file chooser dialog to the user.
 
void save (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 A save() convenience overload.
 
Glib::RefPtr< Gio::Filesave_finish (const Glib::RefPtr< Gio::AsyncResult > &result)
 Finishes the save() call.
 
void open_multiple (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 Presents a file chooser dialog to the user.
 
void open_multiple (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 A open_multiple() convenience overload.
 
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.
 
void select_multiple_folders (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 Presents a file chooser dialog to the user.
 
void select_multiple_folders (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 A select_multiple_folders() convenience overload.
 
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.
 
void open_text_file (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 Initiates a file selection operation by presenting a file chooser dialog to the user.
 
void open_text_file (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 A open_text_file() convenience overload.
 
std::tuple< Glib::RefPtr< Gio::File >, Glib::ustringopen_text_file_finish (const Glib::RefPtr< Gio::AsyncResult > &result)
 Finishes the open_text_file() call and returns the resulting file and text encoding.
 
void open_multiple_text_files (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 Presents a file chooser dialog to the user.
 
void open_multiple_text_files (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 A open_multiple_text_files() convenience overload.
 
std::tuple< std::vector< Glib::RefPtr< Gio::File > >, Glib::ustringopen_multiple_text_files_finish (const Glib::RefPtr< Gio::AsyncResult > &result)
 Finishes the open_multiple_text_files() call.
 
void save_text_file (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 Initiates a file save operation by presenting a file chooser dialog to the user.
 
void save_text_file (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 A save_text_file() convenience overload.
 
std::tuple< Glib::RefPtr< Gio::File >, Glib::ustring, Glib::ustringsave_text_file_finish (const Glib::RefPtr< Gio::AsyncResult > &result)
 Finishes the save_text_file() call and returns the resulting file, text encoding and line endings.
 
Glib::PropertyProxy< Glib::ustringproperty_title ()
 A title that may be shown on the file chooser dialog.
 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_title () const
 A title that may be shown on the file chooser dialog.
 
Glib::PropertyProxy< bool > property_modal ()
 Whether the file chooser dialog is modal.
 
Glib::PropertyProxy_ReadOnly< bool > property_modal () const
 Whether the file chooser dialog is modal.
 
Glib::PropertyProxy< Glib::RefPtr< Gio::ListModel > > property_filters ()
 The list of filters.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::ListModel > > property_filters () const
 The list of filters.
 
Glib::PropertyProxy< Glib::RefPtr< FileFilter > > property_default_filter ()
 The default filter.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< FileFilter > > property_default_filter () const
 The default filter.
 
Glib::PropertyProxy< Glib::RefPtr< Gio::File > > property_initial_file ()
 The initial file.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::File > > property_initial_file () const
 The initial file.
 
Glib::PropertyProxy< Glib::RefPtr< Gio::File > > property_initial_folder ()
 The initial folder.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::File > > property_initial_folder () const
 The initial folder.
 
Glib::PropertyProxy< std::stringproperty_initial_name ()
 The initial name.
 
Glib::PropertyProxy_ReadOnly< std::stringproperty_initial_name () const
 The initial name.
 
Glib::PropertyProxy< Glib::ustringproperty_accept_label ()
 Label for the file chooser's accept button.
 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_accept_label () const
 Label for the file chooser's accept button.
 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
voidget_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)
 
voidsteal_data (const QueryQuark &quark)
 
Glib::RefPtr< Glib::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (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
 
GObjectgobj ()
 
const GObjectgobj () const
 
GObjectgobj_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 ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (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.
 
static Glib::RefPtr< FileDialogcreate ()
 

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
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Related Symbols

(Note that these are not member symbols.)

Glib::RefPtr< Gtk::FileDialogwrap (GtkFileDialog *object, bool take_copy=false)
 A Glib::wrap() method for this object.
 

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

Retrieves the text used by the dialog on its accept button.

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 default 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 default 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 list model of Gtk::FileFilter.

◆ 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 list model of Gtk::FileFilter.

◆ 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 filename that will be initially selected.

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 = {} 
)

Presents a file chooser dialog to the user.

The file chooser dialog will be set up to select a single file.

The slot will be called when the dialog is dismissed.

Since gtkmm 4.10:
Parameters
parentThe parent window.
cancellableA cancellable to cancel the operation.
slotA 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.

Since gtkmm 4.10:
Parameters
resultThe result.
Returns
The file that was selected.
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 = {} 
)

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_initial_folder().

The slot will be called when the dialog is dismissed.

Since gtkmm 4.10:
Parameters
parentThe parent window.
cancellableA cancellable to cancel the operation.
slotA 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
resultA Gio::AsyncResult.
Returns
The files that were selected, as a vector of Gio::Files. Otherwise, an exception is thrown.
Exceptions
Gtk::DialogError

◆ open_multiple_text_files() [1/2]

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

A open_multiple_text_files() convenience overload.

◆ open_multiple_text_files() [2/2]

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

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_initial_folder().

In contrast to open(), this function lets the user select the text encoding for the files, if possible.

The slot will be called when the dialog is dismissed.

Since gtkmm 4.18:
Parameters
parentThe parent window.
cancellableA cancellable to cancel the operation.
slotA callback to call when the operation is complete.

◆ open_multiple_text_files_finish()

std::tuple< std::vector< Glib::RefPtr< Gio::File > >, Glib::ustring > Gtk::FileDialog::open_multiple_text_files_finish ( const Glib::RefPtr< Gio::AsyncResult > &  result)

Finishes the open_multiple_text_files() call.

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 an empty string.

Since gtkmm 4.18:
Parameters
resultA Gio::AsyncResult.
Returns
{files, encoding} The files that were selected, as a vector of Gio::Files, and the text encoding to use.
Exceptions
Gtk::DialogError

◆ open_text_file() [1/2]

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

A open_text_file() convenience overload.

◆ open_text_file() [2/2]

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

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

In contrast to open(), this function lets the user select the text encoding for the file, if possible.

The slot will be called when the dialog is dismissed.

Since gtkmm 4.18:
Parameters
parentThe parent Gtk::Window.
cancellableA Cancellable to cancel the operation.
slotA callback to call when the operation is complete.

◆ open_text_file_finish()

std::tuple< Glib::RefPtr< Gio::File >, Glib::ustring > Gtk::FileDialog::open_text_file_finish ( const Glib::RefPtr< Gio::AsyncResult > &  result)

Finishes the 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 an empty string.

Since gtkmm 4.18:
Parameters
resultA Gio::AsyncResult.
Returns
{file, encoding} The file that was selected and the text encoding to use.
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.

This filter 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.

This filter 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 these 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 these 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 initial file.

This file 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 initial file.

This file 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 initial folder.

This 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 initial folder.

This 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 initial name.

This is the name of the file 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 initial name.

This is the name of the file 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 = {} 
)

Presents a file chooser dialog to the user.

The file chooser dialog will be save mode.

The slot will be called when the dialog is dismissed.

Since gtkmm 4.10:
Parameters
parentThe parent window.
cancellableA cancellable to cancel the operation.
slotA 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.

Since gtkmm 4.10:
Parameters
resultThe result.
Returns
The file that was selected.
Exceptions
Gtk::DialogError

◆ save_text_file() [1/2]

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

A save_text_file() convenience overload.

◆ save_text_file() [2/2]

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

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

In contrast to save(), this function lets the user select the text encoding and line endings for the text file, if possible.

The slot will be called when the dialog is dismissed.

Since gtkmm 4.18:
Parameters
parentThe parent Gtk::Window.
cancellableA Cancellable to cancel the operation.
slotA callback to call when the operation is complete.

◆ save_text_file_finish()

std::tuple< Glib::RefPtr< Gio::File >, Glib::ustring, Glib::ustring > Gtk::FileDialog::save_text_file_finish ( const Glib::RefPtr< Gio::AsyncResult > &  result)

Finishes the 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 an empty string.

The line_ending will be set to one of "\\n", "\\r\\n", "\\r" or "", where the latter means to preserve existing line endings.

Since gtkmm 4.18:
Parameters
resultA Gio::AsyncResult.
Returns
{file, encoding, line_ending} The file that was selected, the text encoding to use, and the line endings to use.
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 = {} 
)

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_initial_folder().

The slot will be called when the dialog is dismissed.

Since gtkmm 4.10:
Parameters
parentThe parent window.
cancellableA cancellable to cancel the operation.
slotA 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.

Since gtkmm 4.10:
Parameters
resultThe result.
Returns
The folder that was selected.
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 = {} 
)

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_initial_folder().

The slot will be called when the dialog is dismissed.

Since gtkmm 4.10:
Parameters
parentThe parent window.
cancellableA cancellable to cancel the operation.
slotA 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
resultA Gio::AsyncResult.
Returns
The files that were selected, as a vector of Gio::Files. 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_labelThe 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
filterThe file filter.

◆ 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
filtersA list model of Gtk::FileFilter.

◆ 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
fileA 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
folderA file.

◆ set_initial_name()

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

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_initial_folder(), the dialog will preselect it.

Since gtkmm 4.10:
Parameters
nameA 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
modalThe 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
titleThe new title.

Friends And Related Symbol Documentation

◆ wrap()

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

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

Parameters
objectThe C instance.
take_copyFalse 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.