gtkmm: Gtk::FileChooser Class Reference

gtkmm 2.24.5

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

Gtk::FileChooser is an interface that can be implemented by file selection widgets. More...

Inheritance diagram for Gtk::FileChooser:
[legend]
Collaboration diagram for Gtk::FileChooser:
[legend]

## Public Member Functions
| FileChooser (FileChooser&& src) noexcept
FileChooser& | operator= (FileChooser&& src) noexcept
| ~FileChooser () noexcept override
GtkFileChooser* | gobj ()
| Provides access to the underlying C GObject. More...
const GtkFileChooser* | gobj () const
| Provides access to the underlying C GObject. More...
void | set_action (FileChooserAction action)
| Sets the type of operation that the chooser is performing; the user interface is adapted to suit the selected action. More...
FileChooserAction | get_action () const
| Gets the type of operation that the file chooser is performing; see set_action(). More...
void | set_local_only (bool local_only=true)
| Sets whether only local files can be selected in the file selector. More...
bool | get_local_only () const
| Gets whether only local files can be selected in the file selector. More...
void | set_select_multiple (bool select_multiple=true)
| Sets whether multiple files can be selected in the file selector. More...
bool | get_select_multiple () const
| Gets whether multiple files can be selected in the file selector. More...
void | set_show_hidden (bool show_hidden=true)
| Sets whether hidden files and folders are displayed in the file selector. More...
bool | get_show_hidden () const
| Gets whether hidden files and folders are displayed in the file selector. More...
void | set_do_overwrite_confirmation (bool do_overwrite_confirmation=true)
| Sets whether a file chooser in Gtk::FILE_CHOOSER_ACTION_SAVE mode will present a confirmation dialog if the user types a file name that already exists. More...
bool | get_do_overwrite_confirmation () const
| Queries whether a file chooser is set to confirm for overwriting when the user types a file name that already exists. More...
void | set_create_folders (bool create_folders=true)
| Sets whether file choser will offer to create new folders. More...
bool | get_create_folders () const
| Gets whether file choser will offer to create new folders. More...
void | set_current_name (const Glib::ustring& name)
| Sets the current name in the file selector, as if entered by the user. More...
Glib::ustring | get_filename () const
| Gets the filename for the currently selected file in the file selector. More...
bool | set_filename (const Glib::ustring& filename)
| Sets filename as the current filename for the file chooser, by changing to the file's parent folder and actually selecting the file in list. More...
bool | select_filename (const Glib::ustring& filename)
| Selects a filename. More...
void | unselect_filename (const Glib::ustring& filename)
| Unselects a currently selected filename. More...
void | select_all ()
| Selects all the files in the current folder of a file chooser. More...
void | unselect_all ()
| Unselects all the files in the current folder of a file chooser. More...
Glib::SListHandle< Glib::ustring > | get_filenames () const
| Lists all the selected files and subfolders in the current folder of chooser. More...
bool | set_current_folder (const Glib::ustring& filename)
| Sets the current folder for chooser from a local filename. More...
Glib::ustring | get_current_folder () const
| Gets the current folder of chooser as a local filename. More...
Glib::ustring | get_uri () const
| Gets the URI for the currently selected file in the file selector. More...
bool | set_uri (const Glib::ustring& uri)
| Sets the file referred to by uri as the current file for the file chooser, by changing to the URI's parent folder and actually selecting the URI in the list. More...
bool | select_uri (const Glib::ustring& uri)
| Selects the file to by uri. More...
void | unselect_uri (const Glib::ustring& uri)
| Unselects the file referred to by uri. More...
Glib::SListHandle< Glib::ustring > | get_uris () const
| Lists all the selected files and subfolders in the current folder of chooser. More...
bool | set_current_folder_uri (const Glib::ustring& uri)
| Sets the current folder for chooser from an URI. More...
Glib::ustring | get_current_folder_uri () const
| Gets the current folder of chooser as an URI. More...
bool | set_file (const Glib::RefPtr< const Gio::File >& uri)
| Sets uri as the current filename for the file chooser, by changing to the file's parent folder and actually selecting the file in list. More...
bool | select_file (const Glib::RefPtr< const Gio::File >& file)
| Selects the file referred to by file. More...
void | unselect_file (const Glib::RefPtr< const Gio::File >& file)
| Unselects the file referred to by file. More...
Glib::SListHandle< Glib::RefPtr< Gio::File > > | get_files ()
| Lists all the selected files and subfolders in the current folder of chooser as File. More...
bool | set_current_folder_file (const Glib::RefPtr< const Gio::File >& file)
| Sets the current folder for chooser from a File. More...
Glib::RefPtr< Gio::File > | get_current_folder_file ()
| Gets the current folder of chooser as File. More...
Glib::RefPtr< Gio::File > | get_file ()
| Gets the File for the currently selected file in the file selector. More...
Glib::RefPtr< const Gio::File > | get_file () const
| Gets the File for the currently selected file in the file selector. More...
void | set_preview_widget (Gtk::Widget& preview_widget)
| Sets an application-supplied widget to use to display a custom preview of the currently selected file. More...
Gtk::Widget* | get_preview_widget ()
| Gets the current preview widget; see set_preview_widget(). More...
const Gtk::Widget* | get_preview_widget () const
| Gets the current preview widget; see set_preview_widget(). More...
void | set_preview_widget_active (bool active=true)
| Sets whether the preview widget set by set_preview_widget() should be shown for the current filename. More...
bool | get_preview_widget_active () const
| Gets whether the preview widget set by set_preview_widget() should be shown for the current filename. More...
void | set_use_preview_label (bool use_label=true)
| Sets whether the file chooser should display a stock label with the name of the file that is being previewed; the default is `true`. More...
bool | get_use_preview_label () const
| Gets whether a stock label should be drawn with the name of the previewed file. More...
Glib::ustring | get_preview_filename () const
| Gets the filename that should be previewed in a custom preview widget. More...
Glib::ustring | get_preview_uri () const
| Gets the URI that should be previewed in a custom preview widget. More...
Glib::RefPtr< Gio::File > | get_preview_file ()
| Gets the File that should be previewed in a custom preview Internal function, see get_preview_uri(). More...
Glib::RefPtr< const Gio::File > | get_preview_file () const
| Gets the File that should be previewed in a custom preview Internal function, see get_preview_uri(). More...
void | set_extra_widget (Gtk::Widget& extra_widget)
| Sets an application-supplied widget to provide extra options to the user. More...
Gtk::Widget* | get_extra_widget ()
| Gets the current preview widget; see set_extra_widget(). More...
const Gtk::Widget* | get_extra_widget () const
| Gets the current preview widget; see set_extra_widget(). More...
void | add_filter (const FileFilter& filter)
| Adds filter to the list of filters that the user can select between. More...
void | remove_filter (const FileFilter& filter)
| Removes filter from the list of filters that the user can select between. More...
Glib::SListHandle< FileFilter*> | list_filters ()
| Lists the current set of user-selectable filters; see add_filter(), remove_filter(). More...
Glib::SListHandle< const FileFilter*> | list_filters () const
| Lists the current set of user-selectable filters; see add_filter(), remove_filter(). More...
void | set_filter (const FileFilter& filter)
| Sets the current filter; only the files that pass the filter will be displayed. More...
FileFilter* | get_filter ()
| Gets the current filter; see set_filter(). More...
const FileFilter* | get_filter () const
| Gets the current filter; see set_filter(). More...
bool | add_shortcut_folder (const Glib::ustring& folder)
| Adds a folder to be displayed with the shortcut folders in a file chooser. More...
bool | remove_shortcut_folder (const Glib::ustring& folder)
| Removes a folder from a file chooser's list of shortcut folders. More...
Glib::SListHandle< Glib::ustring > | list_shortcut_folders () const
| Queries the list of shortcut folders in the file chooser, as set by add_shortcut_folder(). More...
bool | add_shortcut_folder_uri (const Glib::ustring& uri)
| Adds a folder URI to be displayed with the shortcut folders in a file chooser. More...
bool | remove_shortcut_folder_uri (const Glib::ustring& uri)
| Removes a folder URI from a file chooser's list of shortcut folders. More...
Glib::SListHandle< Glib::ustring > | list_shortcut_folder_uris () const
| Queries the list of shortcut folders in the file chooser, as set by add_shortcut_folder_uri(). More...
Glib::SignalProxy< void > | signal_current_folder_changed ()
| This signal is emitted when the current folder in a FileChooser changes. More...
Glib::SignalProxy< void > | signal_selection_changed ()
| This signal is emitted when there is a change in the set of selected files in a #GtkFileChooser. More...
Glib::SignalProxy< void > | signal_update_preview ()
| This signal is emitted when the preview in a file chooser should be regenerated. More...
Glib::SignalProxy< void > | signal_file_activated ()
| This signal is emitted when the user "activates" a file in the file chooser. More...
Glib::SignalProxy< FileChooserConfirmation > | signal_confirm_overwrite ()
Glib::PropertyProxy< FileChooserAction > | property_action ()
| The type of operation that the file selector is performing. More...
Glib::PropertyProxy_ReadOnly< FileChooserAction > | property_action () const
| The type of operation that the file selector is performing. More...
Glib::PropertyProxy< FileFilter*> | property_filter ()
| The current filter for selecting which files are displayed. More...
Glib::PropertyProxy_ReadOnly< FileFilter*> | property_filter () const
| The current filter for selecting which files are displayed. More...
Glib::PropertyProxy< bool > | property_local_only ()
| Whether the selected file(s) should be limited to local file: URLs. More...
Glib::PropertyProxy_ReadOnly< bool > | property_local_only () const
| Whether the selected file(s) should be limited to local file: URLs. More...
Glib::PropertyProxy< Widget*> | property_preview_widget ()
| Application supplied widget for custom previews. More...
Glib::PropertyProxy_ReadOnly< Widget*> | property_preview_widget () const
| Application supplied widget for custom previews. More...
Glib::PropertyProxy< bool > | property_preview_widget_active ()
| Whether the application supplied widget for custom previews should be shown. More...
Glib::PropertyProxy_ReadOnly< bool > | property_preview_widget_active () const
| Whether the application supplied widget for custom previews should be shown. More...
Glib::PropertyProxy< bool > | property_use_preview_label ()
| Whether to display a stock label with the name of the previewed file. More...
Glib::PropertyProxy_ReadOnly< bool > | property_use_preview_label () const
| Whether to display a stock label with the name of the previewed file. More...
Glib::PropertyProxy< Widget*> | property_extra_widget ()
| Application supplied widget for extra options. More...
Glib::PropertyProxy_ReadOnly< Widget*> | property_extra_widget () const
| Application supplied widget for extra options. More...
Glib::PropertyProxy< bool > | property_select_multiple ()
| Whether to allow multiple files to be selected. More...
Glib::PropertyProxy_ReadOnly< bool > | property_select_multiple () const
| Whether to allow multiple files to be selected. More...
Glib::PropertyProxy< bool > | property_show_hidden ()
| Whether the hidden files and folders should be displayed. More...
Glib::PropertyProxy_ReadOnly< bool > | property_show_hidden () const
| Whether the hidden files and folders should be displayed. More...
Glib::PropertyProxy< bool > | property_do_overwrite_confirmation ()
| Whether a file chooser in save mode will present an overwrite confirmation dialog if necessary. More...
Glib::PropertyProxy_ReadOnly< bool > | property_do_overwrite_confirmation () const
| Whether a file chooser in save mode will present an overwrite confirmation dialog if necessary. More...
Glib::PropertyProxy< bool > | property_create_folders ()
| Whether a file chooser not in open mode will offer the user to create new folders. More...
Glib::PropertyProxy_ReadOnly< bool > | property_create_folders () const
| Whether a file chooser not in open mode will offer the user to create new folders. More...
Public Member Functions inherited from Glib::Interface
| Interface ()
| Interface (Interface &&src) noexcept
Interface & | operator= (Interface &&src) noexcept
| Interface (const Glib::Interface_Class &interface_class)
| Interface (GObject *castitem)
| ~Interface () noexcept override
| Interface (const Interface &)=delete
Interface & | operator= (const Interface &)=delete
GObject * | gobj ()
const GObject * | gobj () const
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
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void > &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (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)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const

## Static Public Member Functions
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...

## Protected Member Functions
| FileChooser ()
| You should derive from this class to use it. More...
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::FileChooser > | wrap (GtkFileChooser* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

Gtk::FileChooser is an interface that can be implemented by file selection widgets.

In gtkmm, the main objects that implement this interface are FileChooserWidget and FileChooserDialog. You do not need to write an object that implements the FileChooser interface unless you are trying to adapt an existing file selector to expose a standard programming interface.

File Names and Encodings
  When the user is finished selecting files in a FileChooser, your program can get the selected names either as filenames or as URIs. For URIs, the normal escaping rules are applied if the URI contains non-ASCII characters. However, filenames are always returned in the character set specified by the G_FILENAME_ENCODING environment variable. Please see the Glib documentation for more details about this variable.

Important
  This means that while you can pass the result of FileChooser::get_filename() to `open(2)` or `fopen(3)`, you may not be able to directly set it as the text of a Gtk::Label widget unless you convert it first to UTF-8, which all gtkmm widgets expect. You should use Glib::filename_to_utf8() to convert filenames into strings that can be passed to gtkmm widgets.

Note
  The gtkmm FileChooser API is broken in that methods return Glib::ustring even though the returned string is not necessarily UTF-8 encoded. Any FileChooser method that takes or returns a filename (not a URI) should have std::string as parameter or return type. Fortunately this mistake doesn't prevent you from handling filenames correctly in your application. Just pretend that the API uses std::string and call Glib::filename_to_utf8() or Glib::filename_from_utf8() as appropriate.

See http://bugzilla.gnome.org/show_bug.cgi?id=142138 for more information.

## Constructor & Destructor Documentation

## ◆ FileChooser() [1/2]

Gtk::FileChooser::FileChooser | ( |  | ) |
| protected

You should derive from this class to use it.

## ◆ FileChooser() [2/2]

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

## ◆ ~FileChooser()

Gtk::FileChooser::~FileChooser | ( |  | ) |
| overridenoexcept

## Member Function Documentation

## ◆ add_filter()

void Gtk::FileChooser::add_filter | ( | const FileFilter& | filter | ) |

Adds filter to the list of filters that the user can select between.

When a filter is selected, only files that are passed by that filter are displayed.

Note that the chooser takes ownership of the filter, so you have to ref and sink it if you want to keep a reference.

Since gtkmm 2.4:

Parameters

  filter | A Gtk::FileFilter.

## ◆ add_interface()

static void Gtk::FileChooser::add_interface | ( | GType | gtype_implementer | ) |
| static

## ◆ add_shortcut_folder()

bool Gtk::FileChooser::add_shortcut_folder | ( | const Glib::ustring & | folder | ) |

Adds a folder to be displayed with the shortcut folders in a file chooser.

Note that shortcut folders do not get saved, as they are provided by the application. For example, you can use this to add a "/usr/share/mydrawprogram/Clipart" folder to the volume list.

Since gtkmm 2.4:

Parameters

  folder | Filename of the folder to add.

Returns
  `true` if the folder could be added successfully, `false` otherwise. In the latter case, the error will be set as appropriate.

## ◆ add_shortcut_folder_uri()

bool Gtk::FileChooser::add_shortcut_folder_uri | ( | const Glib::ustring & | uri | ) |

Adds a folder URI to be displayed with the shortcut folders in a file chooser.

Note that shortcut folders do not get saved, as they are provided by the application. For example, you can use this to add a "file:///usr/share/mydrawprogram/Clipart" folder to the volume list.

Since gtkmm 2.4:

Parameters

  uri | URI of the folder to add.

Returns
  `true` if the folder could be added successfully, `false` otherwise. In the latter case, the error will be set as appropriate.

## ◆ get_action()

FileChooserAction Gtk::FileChooser::get_action | ( |  | ) | const

Gets the type of operation that the file chooser is performing; see set_action().

Since gtkmm 2.4:

Returns
  The action that the file selector is performing.

## ◆ get_create_folders()

bool Gtk::FileChooser::get_create_folders | ( |  | ) | const

Gets whether file choser will offer to create new folders.

See set_create_folders().

Since gtkmm 2.18:

Returns
  `true` if the New Folder button should be displayed.

## ◆ get_current_folder()

Glib::ustring Gtk::FileChooser::get_current_folder | ( |  | ) | const

Gets the current folder of chooser as a local filename.

See set_current_folder().

Returns
  The full path of the current folder, possibly empty if the current path cannot be represented as a local filename. This function may also return and empty string if the file chooser was unable to load the last folder that was requested from it; for example, as would be for calling set_current_folder() on a nonexistent folder.

Since gtkmm 2.4:

## ◆ get_current_folder_file()

Glib::RefPtr<Gio::File> Gtk::FileChooser::get_current_folder_file | ( |  | ) |

Gets the current folder of chooser as File.

See get_current_folder_uri().

Since gtkmm 2.14:

Returns
  The File for the current folder.

## ◆ get_current_folder_uri()

Glib::ustring Gtk::FileChooser::get_current_folder_uri | ( |  | ) | const

Gets the current folder of chooser as an URI.

See set_current_folder_uri().

Note that this is the folder that the file chooser is currently displaying (e.g. "file:///home/username/Documents"), which is not the same as the currently-selected folder if the chooser is in Gtk::FILE_CHOOSER_SELECT_FOLDER mode (e.g. "file:///home/username/Documents/selected-folder/". To get the currently-selected folder in that mode, use get_uri() as the usual way to get the selection.

Since gtkmm 2.4:

Returns
  The URI for the current folder.

## ◆ get_do_overwrite_confirmation()

bool Gtk::FileChooser::get_do_overwrite_confirmation | ( |  | ) | const

Queries whether a file chooser is set to confirm for overwriting when the user types a file name that already exists.

Since gtkmm 2.8:

Returns
  `true` if the file chooser will present a confirmation dialog; `false` otherwise.

## ◆ get_extra_widget() [1/2]

Gtk::Widget* Gtk::FileChooser::get_extra_widget | ( |  | ) |

Gets the current preview widget; see set_extra_widget().

Since gtkmm 2.4:

Returns
  The current extra widget, or `nullptr`.

## ◆ get_extra_widget() [2/2]

const Gtk::Widget* Gtk::FileChooser::get_extra_widget | ( |  | ) | const

Gets the current preview widget; see set_extra_widget().

Since gtkmm 2.4:

Returns
  The current extra widget, or `nullptr`.

## ◆ get_file() [1/2]

Glib::RefPtr<Gio::File> Gtk::FileChooser::get_file | ( |  | ) |

Gets the File for the currently selected file in the file selector.

If multiple files are selected, one of the files will be returned at random.

If the file chooser is in folder mode, this function returns the selected folder.

Since gtkmm 2.14:

Returns
  A selected File. You own the returned file; use Glib::object_unref() to release it.

## ◆ get_file() [2/2]

Glib::RefPtr<const Gio::File> Gtk::FileChooser::get_file | ( |  | ) | const

Gets the File for the currently selected file in the file selector.

If multiple files are selected, one of the files will be returned at random.

If the file chooser is in folder mode, this function returns the selected folder.

Since gtkmm 2.14:

Returns
  A selected File. You own the returned file; use Glib::object_unref() to release it.

## ◆ get_filename()

Glib::ustring Gtk::FileChooser::get_filename | ( |  | ) | const

Gets the filename for the currently selected file in the file selector.

If multiple files are selected, one of the filenames will be returned at random.

If the file chooser is in folder mode, this function returns the selected folder.

Since gtkmm 2.4:

Returns
  The currently selected filename, or an empty string if no file is selected, or the selected file can't be represented with a local filename.

## ◆ get_filenames()

Glib::SListHandle<Glib::ustring> Gtk::FileChooser::get_filenames | ( |  | ) | const

Lists all the selected files and subfolders in the current folder of chooser.

The returned names are full absolute paths. If files in the current folder cannot be represented as local filenames they will be ignored. (See get_uris())

Returns
  A list containing the filenames of all selected files and subfolders in the current folder.

Since gtkmm 2.4:

## ◆ get_files()

Glib::SListHandle< Glib::RefPtr<Gio::File> > Gtk::FileChooser::get_files | ( |  | ) |

Lists all the selected files and subfolders in the current folder of chooser as File.

An internal function, see get_uris().

Since gtkmm 2.14:

Returns
  A SList containing a File for each selected file and subfolder in the current folder.

## ◆ get_filter() [1/2]

FileFilter* Gtk::FileChooser::get_filter | ( |  | ) |

Gets the current filter; see set_filter().

Since gtkmm 2.4:

Returns
  The current filter, or `nullptr`.

## ◆ get_filter() [2/2]

const FileFilter* Gtk::FileChooser::get_filter | ( |  | ) | const

Gets the current filter; see set_filter().

Since gtkmm 2.4:

Returns
  The current filter, or `nullptr`.

## ◆ get_local_only()

bool Gtk::FileChooser::get_local_only | ( |  | ) | const

Gets whether only local files can be selected in the file selector.

See set_local_only()

Since gtkmm 2.4:

Returns
  `true` if only local files can be selected.

## ◆ get_preview_file() [1/2]

Glib::RefPtr<Gio::File> Gtk::FileChooser::get_preview_file | ( |  | ) |

Gets the File that should be previewed in a custom preview Internal function, see get_preview_uri().

Since gtkmm 2.14:

Returns
  The File for the file to preview, or `nullptr` if no file is selected. Free with Glib::object_unref().

## ◆ get_preview_file() [2/2]

Glib::RefPtr<const Gio::File> Gtk::FileChooser::get_preview_file | ( |  | ) | const

Gets the File that should be previewed in a custom preview Internal function, see get_preview_uri().

Since gtkmm 2.14:

Returns
  The File for the file to preview, or `nullptr` if no file is selected. Free with Glib::object_unref().

## ◆ get_preview_filename()

Glib::ustring Gtk::FileChooser::get_preview_filename | ( |  | ) | const

Gets the filename that should be previewed in a custom preview widget.

See set_preview_widget().

Since gtkmm 2.4:

Returns
  The filename to preview, or an empty string if no file is selected, or if the selected file cannot be represented as a local filename.

## ◆ get_preview_uri()

Glib::ustring Gtk::FileChooser::get_preview_uri | ( |  | ) | const

Gets the URI that should be previewed in a custom preview widget.

See set_preview_widget().

Since gtkmm 2.4:

Returns
  The URI for the file to preview, or an empty string if no file is selected.

## ◆ get_preview_widget() [1/2]

Gtk::Widget* Gtk::FileChooser::get_preview_widget | ( |  | ) |

Gets the current preview widget; see set_preview_widget().

Since gtkmm 2.4:

Returns
  The current preview widget, or `nullptr`.

## ◆ get_preview_widget() [2/2]

const Gtk::Widget* Gtk::FileChooser::get_preview_widget | ( |  | ) | const

Gets the current preview widget; see set_preview_widget().

Since gtkmm 2.4:

Returns
  The current preview widget, or `nullptr`.

## ◆ get_preview_widget_active()

bool Gtk::FileChooser::get_preview_widget_active | ( |  | ) | const

Gets whether the preview widget set by set_preview_widget() should be shown for the current filename.

See set_preview_widget_active().

Since gtkmm 2.4:

Returns
  `true` if the preview widget is active for the current filename.

## ◆ get_select_multiple()

bool Gtk::FileChooser::get_select_multiple | ( |  | ) | const

Gets whether multiple files can be selected in the file selector.

See set_select_multiple().

Since gtkmm 2.4:

Returns
  `true` if multiple files can be selected.

## ◆ get_show_hidden()

bool Gtk::FileChooser::get_show_hidden | ( |  | ) | const

Gets whether hidden files and folders are displayed in the file selector.

See set_show_hidden().

Since gtkmm 2.6:

Returns
  `true` if hidden files and folders are displayed.

## ◆ get_type()

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

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

## ◆ get_uri()

Glib::ustring Gtk::FileChooser::get_uri | ( |  | ) | const

Gets the URI for the currently selected file in the file selector.

If multiple files are selected, one of the filenames will be returned at random.

If the file chooser is in folder mode, this function returns the selected folder.

Since gtkmm 2.4:

Returns
  The currently selected URI, or an empty string if no file is selected.

## ◆ get_uris()

Glib::SListHandle<Glib::ustring> Gtk::FileChooser::get_uris | ( |  | ) | const

Lists all the selected files and subfolders in the current folder of chooser.

The returned names are full absolute URIs.

Returns
  A list containing the URIs of all selected files and subfolders in the current folder.

Since gtkmm 2.4:

## ◆ get_use_preview_label()

bool Gtk::FileChooser::get_use_preview_label | ( |  | ) | const

Gets whether a stock label should be drawn with the name of the previewed file.

See set_use_preview_label().

Returns
  `true` if the file chooser is set to display a label with the name of the previewed file, `false` otherwise.

## ◆ gobj() [1/2]

GtkFileChooser* Gtk::FileChooser::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkFileChooser* Gtk::FileChooser::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ list_filters() [1/2]

Glib::SListHandle< FileFilter* > Gtk::FileChooser::list_filters | ( |  | ) |

Lists the current set of user-selectable filters; see add_filter(), remove_filter().

Returns
  A list containing the current set of user selectable filters.

Since gtkmm 2.4:

## ◆ list_filters() [2/2]

Glib::SListHandle< const FileFilter* > Gtk::FileChooser::list_filters | ( |  | ) | const

Lists the current set of user-selectable filters; see add_filter(), remove_filter().

Returns
  A list containing the current set of user selectable filters.

Since gtkmm 2.4:

## ◆ list_shortcut_folder_uris()

Glib::SListHandle<Glib::ustring> Gtk::FileChooser::list_shortcut_folder_uris | ( |  | ) | const

Queries the list of shortcut folders in the file chooser, as set by add_shortcut_folder_uri().

Returns
  A list of folder URIs

Since gtkmm 2.4:

## ◆ list_shortcut_folders()

Glib::SListHandle<Glib::ustring> Gtk::FileChooser::list_shortcut_folders | ( |  | ) | const

Queries the list of shortcut folders in the file chooser, as set by add_shortcut_folder().

Since gtkmm 2.4:

Returns
  A list of folder filenames, if there are any shortcut folders..

## ◆ operator=()

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

## ◆ property_action() [1/2]

Glib::PropertyProxy< FileChooserAction > Gtk::FileChooser::property_action | ( |  | ) |

The type of operation that the file selector is performing.

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

Glib::PropertyProxy_ReadOnly< FileChooserAction > Gtk::FileChooser::property_action | ( |  | ) | const

The type of operation that the file selector is performing.

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

Glib::PropertyProxy< bool > Gtk::FileChooser::property_create_folders | ( |  | ) |

Whether a file chooser not in open mode will offer the user to create new folders.

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

Glib::PropertyProxy_ReadOnly< bool > Gtk::FileChooser::property_create_folders | ( |  | ) | const

Whether a file chooser not in open mode will offer the user to create new folders.

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

Glib::PropertyProxy< bool > Gtk::FileChooser::property_do_overwrite_confirmation | ( |  | ) |

Whether a file chooser in save mode will present an overwrite confirmation dialog if necessary.

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

Glib::PropertyProxy_ReadOnly< bool > Gtk::FileChooser::property_do_overwrite_confirmation | ( |  | ) | const

Whether a file chooser in save mode will present an overwrite confirmation dialog if necessary.

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

Glib::PropertyProxy< Widget* > Gtk::FileChooser::property_extra_widget | ( |  | ) |

Application supplied widget for extra options.

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

Glib::PropertyProxy_ReadOnly< Widget* > Gtk::FileChooser::property_extra_widget | ( |  | ) | const

Application supplied widget for extra options.

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

Glib::PropertyProxy< FileFilter* > Gtk::FileChooser::property_filter | ( |  | ) |

The current filter for selecting which files are displayed.

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

Glib::PropertyProxy_ReadOnly< FileFilter* > Gtk::FileChooser::property_filter | ( |  | ) | const

The current filter for selecting which files are displayed.

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

Glib::PropertyProxy< bool > Gtk::FileChooser::property_local_only | ( |  | ) |

Whether the selected file(s) should be limited to local file: URLs.

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

Glib::PropertyProxy_ReadOnly< bool > Gtk::FileChooser::property_local_only | ( |  | ) | const

Whether the selected file(s) should be limited to local file: URLs.

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

Glib::PropertyProxy< Widget* > Gtk::FileChooser::property_preview_widget | ( |  | ) |

Application supplied widget for custom previews.

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

Glib::PropertyProxy_ReadOnly< Widget* > Gtk::FileChooser::property_preview_widget | ( |  | ) | const

Application supplied widget for custom previews.

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

Glib::PropertyProxy< bool > Gtk::FileChooser::property_preview_widget_active | ( |  | ) |

Whether the application supplied widget for custom previews should be shown.

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

Glib::PropertyProxy_ReadOnly< bool > Gtk::FileChooser::property_preview_widget_active | ( |  | ) | const

Whether the application supplied widget for custom previews should be shown.

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

Glib::PropertyProxy< bool > Gtk::FileChooser::property_select_multiple | ( |  | ) |

Whether to allow multiple files to be selected.

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

Glib::PropertyProxy_ReadOnly< bool > Gtk::FileChooser::property_select_multiple | ( |  | ) | const

Whether to allow multiple files to be selected.

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

Glib::PropertyProxy< bool > Gtk::FileChooser::property_show_hidden | ( |  | ) |

Whether the hidden files and folders should be displayed.

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

Glib::PropertyProxy_ReadOnly< bool > Gtk::FileChooser::property_show_hidden | ( |  | ) | const

Whether the hidden files and folders should be displayed.

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

Glib::PropertyProxy< bool > Gtk::FileChooser::property_use_preview_label | ( |  | ) |

Whether to display a stock label with the name of the previewed file.

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

Glib::PropertyProxy_ReadOnly< bool > Gtk::FileChooser::property_use_preview_label | ( |  | ) | const

Whether to display a stock label with the name of the previewed file.

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

## ◆ remove_filter()

void Gtk::FileChooser::remove_filter | ( | const FileFilter& | filter | ) |

Removes filter from the list of filters that the user can select between.

Since gtkmm 2.4:

Parameters

  filter | A Gtk::FileFilter.

## ◆ remove_shortcut_folder()

bool Gtk::FileChooser::remove_shortcut_folder | ( | const Glib::ustring & | folder | ) |

Removes a folder from a file chooser's list of shortcut folders.

Since gtkmm 2.4:

Parameters

  folder | Filename of the folder to remove.

Returns
  `true` if the operation succeeds, `false` otherwise. In the latter case, the error will be set as appropriate.

See also: add_shortcut_folder().

## ◆ remove_shortcut_folder_uri()

bool Gtk::FileChooser::remove_shortcut_folder_uri | ( | const Glib::ustring & | uri | ) |

Removes a folder URI from a file chooser's list of shortcut folders.

Since gtkmm 2.4:

Parameters

  uri | URI of the folder to remove.

Returns
  `true` if the operation succeeds, `false` otherwise. In the latter case, the error will be set as appropriate.

See also: add_shortcut_folder_uri().

## ◆ select_all()

void Gtk::FileChooser::select_all | ( |  | ) |

Selects all the files in the current folder of a file chooser.

Since gtkmm 2.4:

## ◆ select_file()

bool Gtk::FileChooser::select_file | ( | const Glib::RefPtr< const Gio::File > & | file | ) |

Selects the file referred to by file.

An internal function. See _gtk_file_chooser_select_uri().

Since gtkmm 2.14:

Parameters

  file | The file to select.

Returns
  `true` if both the folder could be changed and the path was selected successfully, `false` otherwise.

## ◆ select_filename()

bool Gtk::FileChooser::select_filename | ( | const Glib::ustring & | filename | ) |

Selects a filename.

If the file name isn't in the current folder of chooser, then the current folder of chooser will be changed to the folder containing filename.

Since gtkmm 2.4:

Parameters

  filename | The filename to select.

Returns
  `true` if both the folder could be changed and the file was selected successfully, `false` otherwise.

## ◆ select_uri()

bool Gtk::FileChooser::select_uri | ( | const Glib::ustring & | uri | ) |

Selects the file to by uri.

If the URI doesn't refer to a file in the current folder of chooser, then the current folder of chooser will be changed to the folder containing filename.

Since gtkmm 2.4:

Parameters

  uri | The URI to select.

Returns
  `true` if both the folder could be changed and the URI was selected successfully, `false` otherwise.

## ◆ set_action()

void Gtk::FileChooser::set_action | ( | FileChooserAction | action | ) |

Sets the type of operation that the chooser is performing; the user interface is adapted to suit the selected action.

For example, an option to create a new folder might be shown if the action is Gtk::FILE_CHOOSER_ACTION_SAVE but not if the action is Gtk::FILE_CHOOSER_ACTION_OPEN.

Since gtkmm 2.4:

Parameters

  action | The action that the file selector is performing.

## ◆ set_create_folders()

void Gtk::FileChooser::set_create_folders | ( | bool | create_folders = `true` | ) |

Sets whether file choser will offer to create new folders.

This is only relevant if the action is not set to be Gtk::FILE_CHOOSER_ACTION_OPEN.

Since gtkmm 2.18:

Parameters

  create_folders | `true` if the New Folder button should be displayed.

## ◆ set_current_folder()

bool Gtk::FileChooser::set_current_folder | ( | const Glib::ustring & | filename | ) |

Sets the current folder for chooser from a local filename.

The user will be shown the full contents of the current folder, plus user interface elements for navigating to other folders.

Since gtkmm 2.4:

Parameters

  filename | The full path of the new current folder.

Returns
  `true` if the folder could be changed successfully, `false` otherwise.

## ◆ set_current_folder_file()

bool Gtk::FileChooser::set_current_folder_file | ( | const Glib::RefPtr< const Gio::File > & | file | ) |

Sets the current folder for chooser from a File.

Internal function, see set_current_folder_uri().

Since gtkmm 2.14:

Parameters

  file | The File for the new folder.

Returns
  `true` if the folder could be changed successfully, `false` otherwise.

## ◆ set_current_folder_uri()

bool Gtk::FileChooser::set_current_folder_uri | ( | const Glib::ustring & | uri | ) |

Sets the current folder for chooser from an URI.

The user will be shown the full contents of the current folder, plus user interface elements for navigating to other folders.

Since gtkmm 2.4:

Parameters

  uri | The URI for the new current folder.

Returns
  `true` if the folder could be changed successfully, `false` otherwise.

## ◆ set_current_name()

void Gtk::FileChooser::set_current_name | ( | const Glib::ustring & | name | ) |

Sets the current name in the file selector, as if entered by the user.

Note that the name passed in here is a UTF-8 string rather than a filename. This function is meant for such uses as a suggested name in a "Save As..." dialog.

If you want to preselect a particular existing file, you should use set_filename() or set_uri() instead. Please see the documentation for those functions for an example of using set_current_name() as well.

Since gtkmm 2.4:

Parameters

  name | The filename to use, as a UTF-8 string.

## ◆ set_do_overwrite_confirmation()

void Gtk::FileChooser::set_do_overwrite_confirmation | ( | bool | do_overwrite_confirmation = `true` | ) |

Sets whether a file chooser in Gtk::FILE_CHOOSER_ACTION_SAVE mode will present a confirmation dialog if the user types a file name that already exists.

This is `false` by default.

Regardless of this setting, the chooser will emit the Gtk::FileChooser::signal_confirm_overwrite() signal when appropriate.

If all you need is the stock confirmation dialog, set this property to `true`. You can override the way confirmation is done by actually handling the Gtk::FileChooser::signal_confirm_overwrite() signal; please refer to its documentation for the details.

Since gtkmm 2.8:

Parameters

  do_overwrite_confirmation | Whether to confirm overwriting in save mode.

## ◆ set_extra_widget()

void Gtk::FileChooser::set_extra_widget | ( | Gtk::Widget& | extra_widget | ) |

Sets an application-supplied widget to provide extra options to the user.

Since gtkmm 2.4:

Parameters

  extra_widget | Widget for extra options.

## ◆ set_file()

bool Gtk::FileChooser::set_file | ( | const Glib::RefPtr< const Gio::File > & | uri | ) |

Sets uri as the current filename for the file chooser, by changing to the file's parent folder and actually selecting the file in list.

If the chooser is in Gtk::FILE_CHOOSER_ACTION_SAVE mode, the file's base name will also appear in the dialog's file name entry.

If the file name isn't in the current folder of chooser, then the current folder of chooser will be changed to the folder containing filename. This is equivalent to a sequence of unselect_all() followed by select_filename().

Note that the file must exist, or nothing will be done except for the directory change.

If you are implementing a `File/Save As...` dialog, you should use this function if you already have a file name to which the user may save; for example, when the user opens an existing file and then does `File/Save As...` on it. If you don't have a file name already — for example, if the user just created a new file and is saving it for the first time, do not call this function. Instead, use something similar to this:

[C example ellipted]

Since gtkmm 2.14:

Parameters

  uri | The File to set as current.

Returns
  `true` if both the folder could be changed and the file was selected successfully, `false` otherwise.

## ◆ set_filename()

bool Gtk::FileChooser::set_filename | ( | const Glib::ustring & | filename | ) |

Sets filename as the current filename for the file chooser, by changing to the file's parent folder and actually selecting the file in list.

If the chooser is in Gtk::FILE_CHOOSER_ACTION_SAVE mode, the file's base name will also appear in the dialog's file name entry.

If the file name isn't in the current folder of chooser, then the current folder of chooser will be changed to the folder containing filename. This is equivalent to a sequence of unselect_all() followed by select_filename().

Note that the file must exist, or nothing will be done except for the directory change.

If you are implementing a `File/Save As...` dialog, you should use this function if you already have a file name to which the user may save; for example, when the user opens an existing file and then does `File/Save As...` on it. If you don't have a file name already — for example, if the user just created a new file and is saving it for the first time, do not call this function. Instead, use something similar to this:

[C example ellipted]

Since gtkmm 2.4:

Parameters

  filename | The filename to set as current.

Returns
  `true` if both the folder could be changed and the file was selected successfully, `false` otherwise.

## ◆ set_filter()

void Gtk::FileChooser::set_filter | ( | const FileFilter& | filter | ) |

Sets the current filter; only the files that pass the filter will be displayed.

If the user-selectable list of filters is non-empty, then the filter should be one of the filters in that list. Setting the current filter when the list of filters is empty is useful if you want to restrict the displayed set of files without letting the user change it.

Since gtkmm 2.4:

Parameters

  filter | A Gtk::FileFilter.

## ◆ set_local_only()

void Gtk::FileChooser::set_local_only | ( | bool | local_only = `true` | ) |

Sets whether only local files can be selected in the file selector.

If local_only is `true` (the default), then the selected file are files are guaranteed to be accessible through the operating systems native file file system and therefore the application only needs to worry about the filename functions in Gtk::FileChooser, like get_filename(), rather than the URI functions like get_uri(),

Since gtkmm 2.4:

Parameters

  local_only | `true` if only local files can be selected.

## ◆ set_preview_widget()

void Gtk::FileChooser::set_preview_widget | ( | Gtk::Widget& | preview_widget | ) |

Sets an application-supplied widget to use to display a custom preview of the currently selected file.

To implement a preview, after setting the preview widget, you connect to the Gtk::FileChooser::signal_update_preview() signal, and call get_preview_filename() or get_preview_uri() on each change. If you can display a preview of the new file, update your widget and set the preview active using set_preview_widget_active(). Otherwise, set the preview inactive.

When there is no application-supplied preview widget, or the application-supplied preview widget is not active, the file chooser may display an internally generated preview of the current file or it may display no preview at all.

Since gtkmm 2.4:

Parameters

  preview_widget | Widget for displaying preview.

## ◆ set_preview_widget_active()

void Gtk::FileChooser::set_preview_widget_active | ( | bool | active = `true` | ) |

Sets whether the preview widget set by set_preview_widget() should be shown for the current filename.

When active is set to false, the file chooser may display an internally generated preview of the current file or it may display no preview at all. See set_preview_widget() for more details.

Since gtkmm 2.4:

Parameters

  active | Whether to display the user-specified preview widget.

## ◆ set_select_multiple()

void Gtk::FileChooser::set_select_multiple | ( | bool | select_multiple = `true` | ) |

Sets whether multiple files can be selected in the file selector.

This is only relevant if the action is set to be Gtk::FILE_CHOOSER_ACTION_OPEN or Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER.

Since gtkmm 2.4:

Parameters

  select_multiple | `true` if multiple files can be selected.

## ◆ set_show_hidden()

void Gtk::FileChooser::set_show_hidden | ( | bool | show_hidden = `true` | ) |

Sets whether hidden files and folders are displayed in the file selector.

Since gtkmm 2.6:

Parameters

  show_hidden | `true` if hidden files and folders should be displayed.

## ◆ set_uri()

bool Gtk::FileChooser::set_uri | ( | const Glib::ustring & | uri | ) |

Sets the file referred to by uri as the current file for the file chooser, by changing to the URI's parent folder and actually selecting the URI in the list.

If the chooser is Gtk::FILE_CHOOSER_ACTION_SAVE mode, the URI's base name will also appear in the dialog's file name entry.

If the URI isn't in the current folder of chooser, then the current folder of chooser will be changed to the folder containing uri. This is equivalent to a sequence of unselect_all() followed by select_uri().

Note that the URI must exist, or nothing will be done except for the directory change. If you are implementing a `File/Save As...` dialog, you should use this function if you already have a file name to which the user may save; for example, when the user opens an existing file and then does `File/Save As...` on it. If you don't have a file name already — for example, if the user just created a new file and is saving it for the first time, do not call this function. Instead, use something similar to this:

[C example ellipted]

Since gtkmm 2.4:

Parameters

  uri | The URI to set as current.

Returns
  `true` if both the folder could be changed and the URI was selected successfully, `false` otherwise.

## ◆ set_use_preview_label()

void Gtk::FileChooser::set_use_preview_label | ( | bool | use_label = `true` | ) |

Sets whether the file chooser should display a stock label with the name of the file that is being previewed; the default is `true`.

Applications that want to draw the whole preview area themselves should set this to `false` and display the name themselves in their preview widget.

See also: set_preview_widget()

Since gtkmm 2.4:

Parameters

  use_label | Whether to display a stock label with the name of the previewed file.

## ◆ signal_confirm_overwrite()

Glib::SignalProxy< FileChooserConfirmation > Gtk::FileChooser::signal_confirm_overwrite | ( |  | ) |

Slot Prototype:
  `FileChooserConfirmation on_my_confirm_overwrite()`

## ◆ signal_current_folder_changed()

Glib::SignalProxy< void > Gtk::FileChooser::signal_current_folder_changed | ( |  | ) |

This signal is emitted when the current folder in a FileChooser changes.

This can happen due to the user performing some action that changes folders, such as selecting a bookmark or visiting a folder on the file list. It can also happen as a result of calling a function to explicitly change the current folder in a file chooser.

Normally you do not need to connect to this signal, unless you need to keep track of which folder a file chooser is showing.

See also
  set_current_folder(), get_current_folder(), set_current_folder_uri(), get_current_folder_uri().

Slot Prototype:
  `void on_my_current_folder_changed()`

## ◆ signal_file_activated()

Glib::SignalProxy< void > Gtk::FileChooser::signal_file_activated | ( |  | ) |

This signal is emitted when the user "activates" a file in the file chooser.

This can happen by double-clicking on a file in the file list, or by pressing <keycap>Enter</keycap>.

Normally you do not need to connect to this signal. It is used internally by FileChooserDialog to know when to activate the default button in the dialog.

See also
  get_filename(), get_filenames(), get_uri(), get_uris().

Slot Prototype:
  `void on_my_file_activated()`

## ◆ signal_selection_changed()

Glib::SignalProxy< void > Gtk::FileChooser::signal_selection_changed | ( |  | ) |

This signal is emitted when there is a change in the set of selected files in a #GtkFileChooser.

This can happen when the user modifies the selection with the mouse or the keyboard, or when explicitly calling functions to change the selection.

Normally you do not need to connect to this signal, as it is easier to wait for the file chooser to finish running, and then to get the list of selected files using the functions mentioned below.

See also
  select_filename(), unselect_filename(), get_filename(), get_filenames(), select_uri(), unselect_uri(), get_uri(), get_uris().

Slot Prototype:
  `void on_my_selection_changed()`

## ◆ signal_update_preview()

Glib::SignalProxy< void > Gtk::FileChooser::signal_update_preview | ( |  | ) |

This signal is emitted when the preview in a file chooser should be regenerated.

For example, this can happen when the currently selected file changes. You should use this signal if you want your file chooser to have a preview widget.

Once you have installed a preview widget with set_preview_widget(), you should update it when this signal is emitted. You can use the functions get_preview_filename() or get_preview_uri() to get the name of the file to preview. Your widget may not be able to preview all kinds of files; your signal handler must call set_preview_wiget_active() to inform the file chooser about whether the preview was generated successfully or not.

See also
  set_preview_widget(), set_preview_widget_active(), set_use_preview_label(), get_preview_filename(), get_preview_uri().

Slot Prototype:
  `void on_my_update_preview()`

## ◆ unselect_all()

void Gtk::FileChooser::unselect_all | ( |  | ) |

Unselects all the files in the current folder of a file chooser.

Since gtkmm 2.4:

## ◆ unselect_file()

void Gtk::FileChooser::unselect_file | ( | const Glib::RefPtr< const Gio::File > & | file | ) |

Unselects the file referred to by file.

If the file is not in the current directory, does not exist, or is otherwise not currently selected, does nothing.

Since gtkmm 2.14:

Parameters

  file | A File.

## ◆ unselect_filename()

void Gtk::FileChooser::unselect_filename | ( | const Glib::ustring & | filename | ) |

Unselects a currently selected filename.

If the filename is not in the current directory, does not exist, or is otherwise not currently selected, does nothing.

Since gtkmm 2.4:

Parameters

  filename | The filename to unselect.

## ◆ unselect_uri()

void Gtk::FileChooser::unselect_uri | ( | const Glib::ustring & | uri | ) |

Unselects the file referred to by uri.

If the file is not in the current directory, does not exist, or is otherwise not currently selected, does nothing.

Since gtkmm 2.4:

Parameters

  uri | The URI to unselect.

## Friends And Related Function Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::FileChooser > wrap | ( | GtkFileChooser * | 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.

The documentation for this class was generated from the following file:

- gtkmm/filechooser.h