diff options
author | Andre Miranda <andreldm@xfce.org> | 2021-04-07 19:04:11 -0300 |
---|---|---|
committer | Alexander Schwinn <alexxcons@xfce.org> | 2021-04-08 21:20:33 +0200 |
commit | 1874b86289095f26fedab38f8b2c817700f2c610 (patch) | |
tree | 719a24ca7d51f6051ba963022e93316396dee0b9 | |
parent | c7b297e9e29bb1bb8cbcde7e7af798343947e56f (diff) | |
download | thunar-1874b86289095f26fedab38f8b2c817700f2c610.tar.gz |
Avoid excessively checking whether files are executables (#180)
-rw-r--r-- | thunar/thunar-launcher.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/thunar/thunar-launcher.c b/thunar/thunar-launcher.c index ab342def..f97e05e6 100644 --- a/thunar/thunar-launcher.c +++ b/thunar/thunar-launcher.c @@ -203,10 +203,10 @@ struct _ThunarLauncher gint n_files_to_process; gint n_directories_to_process; - gint n_executables_to_process; gint n_regulars_to_process; gboolean files_to_process_trashable; gboolean files_are_selected; + gboolean files_are_all_executable; gboolean single_directory_to_process; ThunarFile *single_folder; @@ -550,8 +550,8 @@ thunar_launcher_set_selected_files (ThunarComponent *component, launcher->files_to_process_trashable = TRUE; launcher->n_files_to_process = 0; launcher->n_directories_to_process = 0; - launcher->n_executables_to_process = 0; launcher->n_regulars_to_process = 0; + launcher->files_are_all_executable = TRUE; launcher->single_directory_to_process = FALSE; launcher->single_folder = NULL; launcher->parent_folder = NULL; @@ -576,8 +576,8 @@ thunar_launcher_set_selected_files (ThunarComponent *component, } else { - if (thunar_file_is_executable (lp->data)) - ++launcher->n_executables_to_process; + if (launcher->files_are_all_executable && !thunar_file_is_executable (lp->data)) + launcher->files_are_all_executable = FALSE; ++launcher->n_regulars_to_process; } @@ -2824,7 +2824,7 @@ thunar_launcher_append_open_section (ThunarLauncher *launcher, applications = thunar_file_list_get_applications (launcher->files_to_process); /* Execute OR Open OR OpenWith */ - if (G_UNLIKELY (launcher->n_executables_to_process == launcher->n_files_to_process)) + if (G_UNLIKELY (launcher->files_are_all_executable)) thunar_launcher_append_menu_item (launcher, GTK_MENU_SHELL (menu), THUNAR_LAUNCHER_ACTION_EXECUTE, FALSE); else if (G_LIKELY (launcher->n_directories_to_process >= 1)) { |