gtkmm  4.9.1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | 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
 
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::ListModelget_filters ()
 Gets the filters that will be offered to the user in the file chooser dialog. More...
 
Glib::RefPtr< const Gio::ListModelget_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< FileFilterget_current_filter ()
 Gets the filter that will be selected by default in the file chooser dialog. More...
 
Glib::RefPtr< const FileFilterget_current_filter () const
 Gets the filter that will be selected by default in the file chooser dialog. More...
 
void set_current_filter (const Glib::RefPtr< FileFilter > & filter)
 Sets the filters that will be selected by default in the file chooser dialog. More...
 
Glib::RefPtr< Gio::ListModelget_shortcut_folders ()
 Gets the shortcut folders that will be available to the user in the file chooser dialog. More...
 
Glib::RefPtr< const Gio::ListModelget_shortcut_folders () const
 Gets the shortcut folders that will be available to the user in the file chooser dialog. More...
 
void set_shortcut_folders (const Glib::RefPtr< Gio::ListModel > & shortcut_folders)
 Sets the shortcut folders that will be available to the user in the file chooser dialog. More...
 
Glib::RefPtr< Gio::Fileget_current_folder ()
 Gets the folder that will be set as the initial folder in the file chooser dialog. More...
 
Glib::RefPtr< const Gio::Fileget_current_folder () const
 Gets the folder that will be set as the initial folder in the file chooser dialog. More...
 
void set_current_folder (const Glib::RefPtr< Gio::File > & folder)
 Sets the folder that will be set as the initial folder in the file chooser dialog, unless overridden by parameters of the async call. More...
 
void open (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::File > & current_file={}, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const
 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::File > & current_file={}, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const
 A open() convenience overload. More...
 
Glib::RefPtr< Gio::Fileopen_finish (const Glib::RefPtr< Gio::AsyncResult > & result) const
 Finishes the open() call and returns the resulting file. More...
 
void select_folder (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::File > & current_folder={}, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const
 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::File > & current_folder={}, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const
 A select_folder() convenience overload. More...
 
Glib::RefPtr< Gio::Fileselect_folder_finish (const Glib::RefPtr< Gio::AsyncResult > & result) const
 Finishes the select_folder() call and returns the resulting file. More...
 
void save (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::File > & current_file={}, const std::string & current_name={}, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const
 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::File > & current_file={}, const std::string & current_name={}, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const
 A save() convenience overload. More...
 
Glib::RefPtr< Gio::Filesave_finish (const Glib::RefPtr< Gio::AsyncResult > & result) const
 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={}) const
 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={}) const
 A open_multiple() convenience overload. More...
 
Glib::RefPtr< Gio::ListModelopen_multiple_finish (const Glib::RefPtr< Gio::AsyncResult > & result) const
 Finishes the open() call and returns the resulting files in a Gio::ListModel. More...
 
void select_multiple_folders (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const
 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={}) const
 A select_multiple_folders() convenience overload. More...
 
Glib::RefPtr< Gio::ListModelselect_multiple_folders_finish (const Glib::RefPtr< Gio::AsyncResult > & result) const
 Finishes the select_multiple_folders() call and returns the resulting files in a Gio::ListModel. More...
 
Glib::PropertyProxy< Glib::ustringproperty_title ()
 A title that may be shown on the file chooser dialog. More...
 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_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< Gio::ListModel > > property_shortcut_folders ()
 The list of shortcut folders. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::ListModel > > property_shortcut_folders () const
 The list of shortcut folders. More...
 
Glib::PropertyProxy< Glib::RefPtr< FileFilter > > property_current_filter ()
 The current filter, that is, the filter that is initially active in the file chooser dialog. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< FileFilter > > property_current_filter () const
 The current filter, that is, the filter that is initially active in the file chooser dialog. More...
 
Glib::PropertyProxy< Glib::RefPtr< Gio::File > > property_current_folder ()
 The current folder, that is, the directory that is initially opened in the file chooser dialog, unless overridden by parameters of the async call. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::File > > property_current_folder () const
 The current folder, that is, the directory that is initially opened in the file chooser dialog, unless overridden by parameters of the async call. More...
 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
void * get_data (const QueryQuark &key)
 
void set_data (const Quark &key, void *data)
 
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::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
 
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 ()
 
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. More...
 
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 Functions

(Note that these are not member functions.)

Glib::RefPtr< Gtk::FileDialogwrap (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_current_filter() [1/2]

Glib::RefPtr<FileFilter> Gtk::FileDialog::get_current_filter ( )

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

Since gtkmm 4.10:
Returns
The current filter.

◆ get_current_filter() [2/2]

Glib::RefPtr<const FileFilter> Gtk::FileDialog::get_current_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_current_folder() [1/2]

Glib::RefPtr<Gio::File> Gtk::FileDialog::get_current_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_current_folder() [2/2]

Glib::RefPtr<const Gio::File> Gtk::FileDialog::get_current_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_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_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_shortcut_folders() [1/2]

Glib::RefPtr<Gio::ListModel> Gtk::FileDialog::get_shortcut_folders ( )

Gets the shortcut folders that will be available to the user in the file chooser dialog.

Since gtkmm 4.10:
Returns
The shortcut folders, as a Gio::ListModel of Files.

◆ get_shortcut_folders() [2/2]

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

Gets the shortcut folders that will be available to the user in the file chooser dialog.

Since gtkmm 4.10:
Returns
The shortcut folders, as a Gio::ListModel of Files.

◆ 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::File > &  current_file = {},
const Glib::RefPtr< Gio::Cancellable > &  cancellable = {} 
) const

A open() convenience overload.

◆ open() [2/2]

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

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

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

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

Since gtkmm 4.10:
Parameters
parentThe parent Gtk::Window.
current_fileThe file to select initially.
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) const

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

Since gtkmm 4.10:
Parameters
resultA Gio::AsyncResult.
Returns
The file that was selected. Otherwise, nullptr is returned and error is set.
Exceptions
Glib::Error

◆ open_multiple() [1/2]

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

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

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_current_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
parentThe parent Gtk::Window.
cancellableA Cancellable to cancel the operation.
slotA callback to call when the operation is complete.

◆ open_multiple_finish()

Glib::RefPtr<Gio::ListModel> Gtk::FileDialog::open_multiple_finish ( const Glib::RefPtr< Gio::AsyncResult > &  result) const

Finishes the open() call and returns the resulting files in a Gio::ListModel.

Since gtkmm 4.10:
Parameters
resultA Gio::AsyncResult.
Returns
The file that was selected, as a Gio::ListModel of Files. Otherwise, nullptr is returned and error is set.
Exceptions
Glib::Error

◆ operator=()

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

◆ property_current_filter() [1/2]

Glib::PropertyProxy< Glib::RefPtr<FileFilter> > Gtk::FileDialog::property_current_filter ( )

The current filter, that is, the filter that is initially active 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_current_filter() [2/2]

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

The current filter, that is, the filter that is initially active 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_current_folder() [1/2]

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

The current folder, that is, the directory that is initially opened in the file chooser dialog, unless overridden by parameters of the async call.

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_current_folder() [2/2]

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

The current folder, that is, the directory that is initially opened in the file chooser dialog, unless overridden by parameters of the async call.

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.

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.

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_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_shortcut_folders() [1/2]

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

The list of shortcut folders.

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_shortcut_folders() [2/2]

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

The list of shortcut folders.

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_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::File > &  current_file = {},
const std::string current_name = {},
const Glib::RefPtr< Gio::Cancellable > &  cancellable = {} 
) const

A save() convenience overload.

◆ save() [2/2]

void Gtk::FileDialog::save ( Window parent,
const Gio::SlotAsyncReady &  slot,
const Glib::RefPtr< Gio::File > &  current_file = {},
const std::string current_name = {},
const Glib::RefPtr< Gio::Cancellable > &  cancellable = {} 
) const

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

You should pass either current_file if you have a file to save to, or current_name, if you are creating a new file.

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

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

Since gtkmm 4.10:
Parameters
parentThe parent Gtk::Window.
current_fileThe initial file.
current_nameThe initial filename to offer.
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) const

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

Since gtkmm 4.10:
Parameters
resultA Gio::AsyncResult.
Returns
The file that was selected. Otherwise, nullptr is returned and error is set.
Exceptions
Glib::Error

◆ select_folder() [1/2]

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

A select_folder() convenience overload.

◆ select_folder() [2/2]

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

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

If you pass current_folder, the file chooser will initially be opened in the parent directory of that folder, otherwise, it will be in the directory property_current_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
parentThe parent Gtk::Window.
current_folderThe folder to select initially.
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) const

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

Since gtkmm 4.10:
Parameters
resultA Gio::AsyncResult.
Returns
The file that was selected. Otherwise, nullptr is returned and error is set.
Exceptions
Glib::Error

◆ select_multiple_folders() [1/2]

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

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

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_current_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
parentThe parent Gtk::Window.
cancellableA Cancellable to cancel the operation.
slotA callback to call when the operation is complete.

◆ select_multiple_folders_finish()

Glib::RefPtr<Gio::ListModel> Gtk::FileDialog::select_multiple_folders_finish ( const Glib::RefPtr< Gio::AsyncResult > &  result) const

Finishes the select_multiple_folders() call and returns the resulting files in a Gio::ListModel.

Since gtkmm 4.10:
Parameters
resultA Gio::AsyncResult.
Returns
The file that was selected, as a Gio::ListModel of Files. Otherwise, nullptr is returned and error is set.
Exceptions
Glib::Error

◆ set_current_filter()

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

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

Since gtkmm 4.10:
Parameters
filterA Gtk::FileFilter.

◆ set_current_folder()

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

Sets the folder that will be set as the initial folder in the file chooser dialog, unless overridden by parameters of the async call.

Since gtkmm 4.10:
Parameters
folderA Gio::File.

◆ 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 Gio::ListModel of Gtk::FileFilters.

◆ 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_shortcut_folders()

void Gtk::FileDialog::set_shortcut_folders ( const Glib::RefPtr< Gio::ListModel > &  shortcut_folders)

Sets the shortcut folders that will be available to the user in the file chooser dialog.

Since gtkmm 4.10:
Parameters
shortcut_foldersA Gio::ListModel of Files.

◆ 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 Function 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.