3838#include <eel/eel-graphic-effects.h>
3939#include <libnemo-private/nemo-dnd.h>
4040#include <libnemo-private/nemo-file-utilities.h>
41+ #include <libnemo-private/nemo-global-preferences.h>
4142
4243enum {
4344 SUBDIRECTORY_UNLOADED ,
@@ -518,6 +519,13 @@ nemo_list_model_iter_has_child (GtkTreeModel *tree_model, GtkTreeIter *iter)
518519
519520 file_entry = g_sequence_get (iter -> user_data );
520521
522+ /* If the file is a directory and always-show-expander is enabled, always return TRUE */
523+ if (file_entry -> file && nemo_file_is_directory (file_entry -> file )) {
524+ if (nemo_global_preferences_get_always_show_folder_expander ()) {
525+ return TRUE;
526+ }
527+ }
528+
521529 return (file_entry -> files != NULL && g_sequence_get_length (file_entry -> files ) > 0 );
522530}
523531
@@ -1079,7 +1087,9 @@ nemo_list_model_add_file (NemoListModel *model, NemoFile *file,
10791087
10801088 got_count = nemo_file_get_directory_item_count (file , & count , & unreadable );
10811089
1082- if ((!got_count && !unreadable ) || count > 0 ) {
1090+ /* Always add dummy row if always-show-expander is enabled, or if directory has items */
1091+ if (nemo_global_preferences_get_always_show_folder_expander () ||
1092+ (!got_count && !unreadable ) || count > 0 ) {
10831093 add_dummy_row (model , file_entry );
10841094 gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (model ),
10851095 path , & iter );
@@ -1105,7 +1115,9 @@ update_dummy_row (NemoListModel *model,
11051115
11061116 got_count = nemo_file_get_directory_item_count (file , & count , & unreadable );
11071117
1108- if ((got_count && count == 0 ) || (!got_count && unreadable )) {
1118+ /* Only remove dummy row if always-show-expander is disabled and directory is empty */
1119+ if (!nemo_global_preferences_get_always_show_folder_expander () &&
1120+ ((got_count && count == 0 ) || (!got_count && unreadable ))) {
11091121 files = file_entry -> files ;
11101122 if (g_sequence_get_length (files ) == 1 ) {
11111123 GSequenceIter * dummy_ptr = g_sequence_get_iter_at_pos (files , 0 );
@@ -1278,7 +1290,9 @@ nemo_list_model_remove (NemoListModel *model, GtkTreeIter *iter)
12781290
12791291 got_count = nemo_file_get_directory_item_count (parent_file_entry -> file , & count , & unreadable );
12801292
1281- if ((!got_count && !unreadable ) || count > 0 ) {
1293+ /* Always add dummy row if always-show-expander is enabled, or if directory has items */
1294+ if (nemo_global_preferences_get_always_show_folder_expander () ||
1295+ (!got_count && !unreadable ) || count > 0 ) {
12821296 add_dummy_row (model , parent_file_entry );
12831297 }
12841298 }
0 commit comments