Fix DirectoryOption set filename

This properly updates the display if the preference changes.
Even with FILE_CHOOSER_ACTION_SELECT_FOLDER the API is
is get/set_filename -- set_current_folder() sets the parent folder.
This commit is contained in:
Robin Gareus 2022-02-01 15:45:07 +01:00
parent c17fbd5abc
commit 34c8307a38
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 5 additions and 2 deletions

View File

@ -916,13 +916,15 @@ DirectoryOption::DirectoryOption (string const & i, string const & n, sigc::slot
{
Gtkmm2ext::add_volume_shortcuts (_file_chooser);
_file_chooser.set_action (Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
_file_chooser.signal_selection_changed().connect (sigc::mem_fun (*this, &DirectoryOption::selection_changed));
_changed_connection = _file_chooser.signal_selection_changed().connect (sigc::mem_fun (*this, &DirectoryOption::selection_changed));
}
void
DirectoryOption::set_state_from_config ()
{
_file_chooser.set_current_folder (poor_mans_glob(_get ()));
_changed_connection.block ();
_file_chooser.set_filename (poor_mans_glob(_get ()));
_changed_connection.unblock ();
}
void

View File

@ -656,6 +656,7 @@ private:
sigc::slot<std::string> _get; ///< slot to get the configuration variable's value
sigc::slot<bool, std::string> _set; ///< slot to set the configuration variable's value
Gtk::FileChooserButton _file_chooser;
sigc::connection _changed_connection;
};
/** Class to represent a single page in an OptionEditor's notebook.