gtk: Set show-hidden property for showHiddenFiles

This commit is contained in:
Cheng Zhao 2016-07-11 13:47:24 +09:00
parent f08ac07737
commit 6e0fadbe26

View file

@ -87,12 +87,19 @@ class FileChooserDialog {
AddFilters(filters);
}
virtual ~FileChooserDialog() {
~FileChooserDialog() {
gtk_widget_destroy(dialog_);
if (parent_)
parent_->SetEnabled(true);
}
void SetupProperties(int properties) {
if (properties & FILE_DIALOG_MULTI_SELECTIONS)
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog()), TRUE);
if (properties & FILE_DIALOG_SHOW_HIDDEN_FILES)
g_object_set(dialog(), "show-hidden", TRUE, NULL);
}
void RunAsynchronous() {
g_signal_connect(dialog_, "delete-event",
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
@ -235,9 +242,7 @@ bool ShowOpenDialog(atom::NativeWindow* parent_window,
action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
FileChooserDialog open_dialog(action, parent_window, title, button_label,
default_path, filters);
if (properties & FILE_DIALOG_MULTI_SELECTIONS)
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(open_dialog.dialog()),
TRUE);
open_dialog.SetupProperties(properties);
gtk_widget_show_all(open_dialog.dialog());
int response = gtk_dialog_run(GTK_DIALOG(open_dialog.dialog()));
@ -261,10 +266,7 @@ void ShowOpenDialog(atom::NativeWindow* parent_window,
action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
FileChooserDialog* open_dialog = new FileChooserDialog(
action, parent_window, title, button_label, default_path, filters);
if (properties & FILE_DIALOG_MULTI_SELECTIONS)
gtk_file_chooser_set_select_multiple(
GTK_FILE_CHOOSER(open_dialog->dialog()), TRUE);
open_dialog->SetupProperties(properties);
open_dialog->RunOpenAsynchronous(callback);
}