From acea9d1576aeb9c59a3b5a6d92aa70281c0de384 Mon Sep 17 00:00:00 2001 From: "trop[bot]" Date: Fri, 2 Nov 2018 13:43:26 -0700 Subject: [PATCH] fix: honor properties.showHiddenFiles on Linux (#15506) Previously the code only set the GtkFileChooser's property if `properties.showHiddenFiles` was set. This PR unconditionally sets the GtkFileChooser's property so that hidden files will be hidden if `properties.showHiddenFiles` was not set. --- atom/browser/ui/file_dialog_gtk.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/atom/browser/ui/file_dialog_gtk.cc b/atom/browser/ui/file_dialog_gtk.cc index dad4fabde9f70..cd9c496e65b54 100644 --- a/atom/browser/ui/file_dialog_gtk.cc +++ b/atom/browser/ui/file_dialog_gtk.cc @@ -94,10 +94,14 @@ class FileChooserDialog { } 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); + const auto hasProp = [properties](FileDialogProperty prop) { + return gboolean((properties & prop) != 0); + }; + auto* file_chooser = GTK_FILE_CHOOSER(dialog()); + gtk_file_chooser_set_select_multiple(file_chooser, + hasProp(FILE_DIALOG_MULTI_SELECTIONS)); + gtk_file_chooser_set_show_hidden(file_chooser, + hasProp(FILE_DIALOG_SHOW_HIDDEN_FILES)); } void RunAsynchronous() {