gtkmm: Gtk::FileChooserNative Class Reference

gtkmm 3.24.1

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

A native file chooser dialog, suitable for “File/Open” or “File/Save” commands. More...

`#include <gtkmm/filechoosernative.h>`

Inheritance diagram for Gtk::FileChooserNative:
[legend]

## Public Member Functions
| FileChooserNative (FileChooserNative&& src) noexcept
FileChooserNative& | operator= (FileChooserNative&& src) noexcept
| ~FileChooserNative () noexcept override
GtkFileChooserNative* | gobj ()
| Provides access to the underlying C GObject. More...
const GtkFileChooserNative* | gobj () const
| Provides access to the underlying C GObject. More...
GtkFileChooserNative* | 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_accept_label () const
| Retrieves the custom label text for the accept button. More...
void | set_accept_label (const Glib::ustring& accept_label=Glib::ustring())
| Sets the custom label text for the accept button. More...
Glib::ustring | get_cancel_label () const
| Retrieves the custom label text for the cancel button. More...
void | set_cancel_label (const Glib::ustring& cancel_label=Glib::ustring())
| Sets the custom label text for the cancel button. More...
Glib::PropertyProxy< Glib::ustring > | property_accept_label ()
| The text used for the label on the accept button in the dialog, or `nullptr` to use the default text. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_accept_label () const
| The text used for the label on the accept button in the dialog, or `nullptr` to use the default text. More...
Glib::PropertyProxy< Glib::ustring > | property_cancel_label ()
| The text used for the label on the cancel button in the dialog, or `nullptr` to use the default text. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_cancel_label () const
| The text used for the label on the cancel button in the dialog, or `nullptr` to use the default text. More...
Public Member Functions inherited from Gtk::NativeDialog
| NativeDialog (NativeDialog&& src) noexcept
NativeDialog& | operator= (NativeDialog&& src) noexcept
| ~NativeDialog () noexcept override
GtkNativeDialog* | gobj ()
| Provides access to the underlying C GObject. More...
const GtkNativeDialog* | gobj () const
| Provides access to the underlying C GObject. More...
GtkNativeDialog* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
void | show ()
| Shows the dialog on the display, allowing the user to interact with it. More...
void | hide ()
| Hides the dialog if it is visilbe, aborting any interaction. More...
bool | get_visible () const
| Determines whether the dialog is visible. More...
void | set_modal (bool modal=true)
| Sets a dialog modal or non-modal. More...
bool | get_modal () const
| Returns whether the dialog is modal. More...
void | set_title (const Glib::ustring& title)
| Sets the title of the Gtk::NativeDialog. More...
Glib::ustring | get_title () const
| Gets the title of the Gtk::NativeDialog. More...
void | set_transient_for (Window& parent)
| Dialog windows should be set transient for the main application window they were spawned from. More...
void | unset_transient_for ()
| Unsets the current transient window. More...
Window* | get_transient_for ()
| Fetches the transient parent for this window. More...
const Window* | get_transient_for () const
| Fetches the transient parent for this window. More...
int | run ()
| Blocks in a recursive main loop until self emits the Gtk::NativeDialog::signal_response() signal. More...
Glib::PropertyProxy< Glib::ustring > | property_title ()
| The title of the dialog window. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_title () const
| The title of the dialog window. More...
Glib::PropertyProxy< bool > | property_modal ()
| Whether the window should be modal with respect to its transient parent. More...
Glib::PropertyProxy_ReadOnly< bool > | property_modal () const
| Whether the window should be modal with respect to its transient parent. More...
Glib::PropertyProxy< bool > | property_visible ()
| Whether the window is currenlty visible. More...
Glib::PropertyProxy_ReadOnly< bool > | property_visible () const
| Whether the window is currenlty visible. More...
Glib::PropertyProxy< Window* > | property_transient_for ()
| The transient parent of the dialog, or `nullptr` for none. More...
Glib::PropertyProxy_ReadOnly< Window* > | property_transient_for () const
| The transient parent of the dialog, or `nullptr` for none. More...
Glib::SignalProxy< void, int > | signal_response ()
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
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
Public Member Functions inherited from Gtk::FileChooser
| 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_current_name () const
| Gets the current name in the file selector, as entered by the user in the text entry for “Name”. More...
std::string | get_filename () const
| Gets the filename for the currently selected file in the file selector. More...
bool | set_filename (const std::string& 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; all other files will be unselected. More...
bool | select_filename (const std::string& filename)
| Selects a filename. More...
void | unselect_filename (const std::string& 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...
std::vector< std::string > | get_filenames () const
| Lists all the selected files and subfolders in the current folder of chooser. More...
bool | set_current_folder (const std::string& filename)
| Sets the current folder for chooser from a local filename. More...
std::string | 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...
std::vector< 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 >& file)
| Sets file 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...
std::vector< Glib::RefPtr< Gio::File > > | get_files ()
| Lists all the selected files and subfolders in the current folder of chooser as Gio::File. More...
bool | set_current_folder_file (const Glib::RefPtr< const Gio::File >& file)
| Sets the current folder for chooser from a Gio::File. More...
Glib::RefPtr< Gio::File > | get_current_folder_file ()
| Gets the current folder of chooser as Gio::File. More...
Glib::RefPtr< Gio::File > | get_file ()
| Gets the Gio::File for the currently selected file in the file selector. More...
Glib::RefPtr< const Gio::File > | get_file () const
| Gets the Gio::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...
std::string | 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 Gio::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 Gio::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 extra widget; see set_extra_widget(). More...
const Gtk::Widget* | get_extra_widget () const
| Gets the current extra widget; see set_extra_widget(). More...
void | add_filter (const Glib::RefPtr< FileFilter >& filter)
| Adds filter to the list of filters that the user can select between. More...
void | remove_filter (const Glib::RefPtr< FileFilter >& filter)
| Removes filter from the list of filters that the user can select between. More...
std::vector< Glib::RefPtr< FileFilter > > | list_filters ()
| Lists the current set of user-selectable filters; see add_filter(), remove_filter(). More...
std::vector< Glib::RefPtr< const FileFilter > > | list_filters () const
| Lists the current set of user-selectable filters; see add_filter(), remove_filter(). More...
void | set_filter (const Glib::RefPtr< FileFilter >& filter)
| Sets the current filter; only the files that pass the filter will be displayed. More...
Glib::RefPtr< FileFilter > | get_filter ()
| Gets the current filter; see set_filter(). More...
Glib::RefPtr< const FileFilter > | get_filter () const
| Gets the current filter; see set_filter(). More...
bool | add_shortcut_folder (const std::string& folder)
| Adds a folder to be displayed with the shortcut folders in a file chooser. More...
bool | remove_shortcut_folder (const std::string& folder)
| Removes a folder from a file chooser’s list of shortcut folders. More...
std::vector< std::string > | 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...
std::vector< 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...
void | add_choice (const Glib::ustring& id, const Glib::ustring& label, const std::vector< Glib::ustring >& options, const std::vector< Glib::ustring >& option_labels)
| Adds a 'choice' to the file chooser. More...
void | add_choice (const Glib::ustring& id, const Glib::ustring& label)
| Adds a boolean 'choice' to the file chooser. More...
void | remove_choice (const Glib::ustring& id)
| Removes a 'choice' that has been added with add_choice(). More...
void | set_choice (const Glib::ustring& id, const Glib::ustring& option)
| Selects an option in a 'choice' that has been added with add_choice(). More...
Glib::ustring | get_choice (const Glib::ustring& id) const
| Gets the currently selected option in the 'choice' with the given ID. More...
Glib::SignalProxy< void > | signal_current_folder_changed ()
Glib::SignalProxy< void > | signal_selection_changed ()
Glib::SignalProxy< void > | signal_update_preview ()
Glib::SignalProxy< void > | signal_file_activated ()
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< Glib::RefPtr< FileFilter > > | property_filter ()
| The current filter for selecting which files are displayed. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< 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 Gtk::FILE_CHOOSER_ACTION_SAVE mode will present an overwrite confirmation dialog if the user selects a file name that already exists. More...
Glib::PropertyProxy_ReadOnly< bool > | property_do_overwrite_confirmation () const
| Whether a file chooser in Gtk::FILE_CHOOSER_ACTION_SAVE mode will present an overwrite confirmation dialog if the user selects a file name that already exists. More...
Glib::PropertyProxy< bool > | property_create_folders ()
| Whether a file chooser not in Gtk::FILE_CHOOSER_ACTION_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 Gtk::FILE_CHOOSER_ACTION_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

## 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< FileChooserNative > | create (const Glib::ustring& title, Window& parent, FileChooserAction action, const Glib::ustring& accept_label=Glib::ustring(), const Glib::ustring& cancel_label=Glib::ustring())
| Creates a FileChooserNative. More...
static Glib::RefPtr< FileChooserNative > | create (const Glib::ustring& title, FileChooserAction action, const Glib::ustring& accept_label=Glib::ustring(), const Glib::ustring& cancel_label=Glib::ustring())
| A create() convenience overload. More...
Static Public Member Functions inherited from Gtk::NativeDialog
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
Static Public Member Functions inherited from Gtk::FileChooser
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
| FileChooserNative ()
| There is no create() method that corresponds to this constructor, because this constructor shall only be used by derived classes. More...
| FileChooserNative (const Glib::ustring& title, Window& parent, FileChooserAction action, const Glib::ustring& accept_label, const Glib::ustring& cancel_label)
| Constructs a FileChooserNative. More...
| FileChooserNative (const Glib::ustring& title, FileChooserAction action, const Glib::ustring& accept_label, const Glib::ustring& cancel_label)
| Constructs a FileChooserNative. More...
Protected Member Functions inherited from Gtk::NativeDialog
| NativeDialog ()
| There is no create() method that corresponds to this constructor, because only derived classes shall be created. More...
virtual void | on_response (int response_id)
| This is a default handler for the signal signal_response(). More...
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
Protected Member Functions inherited from Gtk::FileChooser
| FileChooser ()
| You should derive from this class to use it. More...

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gtk::FileChooserNative > | wrap (GtkFileChooserNative* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gtk::NativeDialog
Glib::RefPtr< Gtk::NativeDialog > | wrap (GtkNativeDialog* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gtk::FileChooser
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 Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

A native file chooser dialog, suitable for “File/Open” or “File/Save” commands.

FileChooserNative is an abstraction of a dialog box suitable for use with “File/Open” or “File/Save as” commands. By default, this just uses a Gtk::FileChooserDialog to implement the actual dialog. However, on certain platforms, such as Windows, the native platform file chooser is used instead. When the application is running in a sandboxed environment without direct filesystem access (such as Flatpak), FileChooserNative may call the proper APIs (portals) to let the user choose a file and make it available to the application.

While the API of FileChooserNative closely mirrors FileChooserDialog, the main difference is that there is no access to any Gtk::Window or Gtk::Widget for the dialog. This is required, as there may not be one in the case of a platform native dialog. Showing, hiding and running the dialog is handled by the NativeDialog functions.

## Response Codes

FileChooserNative inherits from NativeDialog, which means it will return Gtk::ResponseType::ACCEPT if the user accepted, and Gtk::ResponseType::CANCEL if he pressed cancel. It can also return Gtk::ResponseType::DELETE_EVENT if the window was unexpectedly closed.

## Differences from FileChooserDialog

There are a few things in the FileChooser API that are not possible to use with FileChooserNative, as such use would prohibit the use of a native dialog.

There is no support for the signals that are emitted when the user navigates in the dialog, including:

- FileChooser::signal_current_folder_changed()
- FileChooser::signal_selection_changed()
- FileChooser::signal_file_activated()
- FileChooser::signal_confirm_overwrite()

You can also not use the methods that directly control user navigation:

- FileChooser::unselect_filename()
- FileChooser::select_all()
- FileChooser::unselect_all()

If you need any of the above you will have to use FileChooserDialog directly.

No operations that change the dialog work while the dialog is visible. Set all the properties that are required before showing the dialog.

## Win32 details

On windows the IFileDialog implementation (added in Windows Vista) is used. It supports many of the features that FileChooserDialog does, but there are some things it does not handle:

- Extra widgets added with FileChooser::set_extra_widget().
- Use of custom previews by connecting to FileChooser::signal_update_preview().
- Any Gtk::FileFilter added using a mimetype or custom filter.

If any of these features are used the regular FileChooserDialog will be used in place of the native one.

## Portal details

When the org.freedesktop.portal.FileChooser portal is available on the session bus, it is used to bring up an out-of-process file chooser. Depending on the kind of session the application is running in, this may or may not be a GTK+ file chooser. In this situation, the following things are not supported and will be silently ignored:

- Extra widgets added with FileChooser::set_extra_widget().
- Use of custom previews by connecting to FileChooser::signal_update_preview().
- Any Gtk::FileFilter added with a custom filter.

See also
  Gtk::FileChooser, Gtk::NativeDialog, Gtk::FileChooserDialog

Since gtkmm 3.24:

## Constructor & Destructor Documentation

## ◆ FileChooserNative() [1/4]

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

## ◆ ~FileChooserNative()

Gtk::FileChooserNative::~FileChooserNative | ( |  | ) |
| overridenoexcept

## ◆ FileChooserNative() [2/4]

Gtk::FileChooserNative::FileChooserNative | ( |  | ) |
| protected

There is no create() method that corresponds to this constructor, because this constructor shall only be used by derived classes.

## ◆ FileChooserNative() [3/4]

Gtk::FileChooserNative::FileChooserNative | ( | const Glib::ustring & | title,
|  | Window& | parent,
|  | FileChooserAction | action,
|  | const Glib::ustring & | accept_label,
|  | const Glib::ustring & | cancel_label
| ) |  |
| protected

Constructs a FileChooserNative.

## ◆ FileChooserNative() [4/4]

Gtk::FileChooserNative::FileChooserNative | ( | const Glib::ustring & | title,
|  | FileChooserAction | action,
|  | const Glib::ustring & | accept_label,
|  | const Glib::ustring & | cancel_label
| ) |  |
| protected

Constructs a FileChooserNative.

## Member Function Documentation

## ◆ create() [1/2]

static Glib::RefPtr<FileChooserNative> Gtk::FileChooserNative::create | ( | const Glib::ustring & | title,
|  | Window& | parent,
|  | FileChooserAction | action,
|  | const Glib::ustring & | accept_label = `Glib::ustring()`,
|  | const Glib::ustring & | cancel_label = `Glib::ustring()`
| ) |  |
| static

Creates a FileChooserNative.

Since gtkmm 3.24:

Parameters

  title | Title of the native.
  parent | Transient parent of the native.
  action | Open or save mode for the dialog.
  accept_label | Text to go in the accept button, or empty string for the default.
  cancel_label | Text to go in the cancel button, or empty string for the default.

Returns
  A Glib::RefPtr to a new FileChooserNative.

## ◆ create() [2/2]

static Glib::RefPtr<FileChooserNative> Gtk::FileChooserNative::create | ( | const Glib::ustring & | title,
|  | FileChooserAction | action,
|  | const Glib::ustring & | accept_label = `Glib::ustring()`,
|  | const Glib::ustring & | cancel_label = `Glib::ustring()`
| ) |  |
| static

A create() convenience overload.

## ◆ get_accept_label()

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

Retrieves the custom label text for the accept button.

Since gtkmm 3.24:

Returns
  The custom label, or `nullptr` for the default. This string is owned by GTK+ and should not be modified or freed.

## ◆ get_cancel_label()

Glib::ustring Gtk::FileChooserNative::get_cancel_label | ( |  | ) | const

Retrieves the custom label text for the cancel button.

Since gtkmm 3.24:

Returns
  The custom label, or `nullptr` for the default. This string is owned by GTK+ and should not be modified or freed.

## ◆ get_type()

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

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

## ◆ gobj() [1/2]

GtkFileChooserNative* Gtk::FileChooserNative::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkFileChooserNative* Gtk::FileChooserNative::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkFileChooserNative* Gtk::FileChooserNative::gobj_copy | ( |  | ) |

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

## ◆ operator=()

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

## ◆ property_accept_label() [1/2]

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

The text used for the label on the accept button in the dialog, or `nullptr` to use the default text.

Since gtkmm 3.24:

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::FileChooserNative::property_accept_label | ( |  | ) | const

The text used for the label on the accept button in the dialog, or `nullptr` to use the default text.

Since gtkmm 3.24:

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

Glib::PropertyProxy< Glib::ustring > Gtk::FileChooserNative::property_cancel_label | ( |  | ) |

The text used for the label on the cancel button in the dialog, or `nullptr` to use the default text.

Since gtkmm 3.24:

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

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::FileChooserNative::property_cancel_label | ( |  | ) | const

The text used for the label on the cancel button in the dialog, or `nullptr` to use the default text.

Since gtkmm 3.24:

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.

## ◆ set_accept_label()

void Gtk::FileChooserNative::set_accept_label | ( | const Glib::ustring & | accept_label = `Glib::ustring()` | ) |

Sets the custom label text for the accept button.

If characters in label are preceded by an underscore, they are underlined. If you need a literal underscore character in a label, use “__” (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic. Pressing Alt and that key activates the button.

Since gtkmm 3.24:

Parameters

  accept_label | Custom label or `nullptr` for the default.

## ◆ set_cancel_label()

void Gtk::FileChooserNative::set_cancel_label | ( | const Glib::ustring & | cancel_label = `Glib::ustring()` | ) |

Sets the custom label text for the cancel button.

If characters in label are preceded by an underscore, they are underlined. If you need a literal underscore character in a label, use “__” (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic. Pressing Alt and that key activates the button.

Since gtkmm 3.24:

Parameters

  cancel_label | Custom label or `nullptr` for the default.

## Friends And Related Function Documentation

## ◆ wrap()

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