added set_show_hidden() method to MyFileChooserButton

This commit is contained in:
Alberto Griggio 2017-10-24 11:48:07 +02:00
parent df8b52f978
commit cf75429648
2 changed files with 12 additions and 1 deletions

View File

@ -1172,7 +1172,7 @@ MyFileChooserButton::MyFileChooserButton(const Glib::ustring &title, Gtk::FileCh
title_(title),
action_(action),
lbl_(""),
filename_("")
show_hidden_(false)
{
lbl_.set_ellipsize(Pango::ELLIPSIZE_MIDDLE);
lbl_.set_justify(Gtk::JUSTIFY_LEFT);
@ -1207,6 +1207,7 @@ void MyFileChooserButton::show_chooser()
if (!current_folder_.empty()) {
dlg.set_current_folder(current_folder_);
}
dlg.set_show_hidden(show_hidden_);
int res = dlg.run();
if (res == Gtk::RESPONSE_OK) {
filename_ = dlg.get_filename();
@ -1273,6 +1274,7 @@ bool MyFileChooserButton::set_filename(const std::string &filename)
return true;
}
void MyFileChooserButton::add_filter(const Glib::RefPtr<Gtk::FileFilter> &filter)
{
file_filters_.push_back(filter);
@ -1347,6 +1349,12 @@ void MyFileChooserButton::unselect_filename(const std::string &filename)
}
void MyFileChooserButton::set_show_hidden(bool yes)
{
show_hidden_ = yes;
}
void MyFileChooserButton::set_none()
{
lbl_.set_label(Glib::ustring("(") + M("GENERAL_NONE") + ")");

View File

@ -372,6 +372,7 @@ private:
std::vector<Glib::RefPtr<Gtk::FileFilter>> file_filters_;
Glib::RefPtr<Gtk::FileFilter> cur_filter_;
std::vector<std::string> shortcut_folders_;
bool show_hidden_;
sigc::signal<void> selection_changed_;
protected:
@ -403,6 +404,8 @@ public:
void unselect_all();
void unselect_filename(const std::string &filename);
void set_show_hidden(bool yes);
};
/**