@@ -76,8 +76,7 @@ namespace Files {
7676 {" new" , on_background_action_new, " s" },
7777 {" create-from" , on_background_action_create_from, " s" },
7878 {" sort-by" , on_background_action_sort_by_changed, " s" , " 'name'" },
79- {" reverse" , on_background_action_reverse_changed, null , " false" },
80- {" folders-first" , on_background_action_folders_first_changed, null , " true" }
79+ {" reverse" , on_background_action_reverse_changed, null , " false" }
8180 };
8281
8382 const GLib . ActionEntry [] COMMON_ENTRIES = {
@@ -456,12 +455,13 @@ namespace Files {
456455 prefs. notify[" show-hidden-files" ]. connect (on_show_hidden_files_changed);
457456 prefs. notify[" show-remote-thumbnails" ]. connect (on_show_thumbnails_changed);
458457 prefs. notify[" show-local-thumbnails" ]. connect (on_show_thumbnails_changed);
459- prefs. notify[" sort-directories-first" ]. connect (on_sort_directories_first_changed);
460458 prefs. notify[" date-format" ]. connect (on_dateformat_changed);
461459
462460 app_settings. bind (" singleclick-select" , this , " singleclick_select" , SettingsBindFlags . DEFAULT );
463461
464- model. set_should_sort_directories_first (Files . Preferences . get_default (). sort_directories_first);
462+ app_settings. changed[" sort-directories-first" ]. connect (on_sort_directories_first_changed);
463+
464+ model. set_should_sort_directories_first (app_settings. get_boolean (" sort-directories-first" ));
465465 model. row_deleted. connect (on_row_deleted);
466466 /* Sort order of model is set after loading */
467467 model. sort_column_changed. connect (on_sort_column_changed);
@@ -1236,11 +1236,6 @@ namespace Files {
12361236 set_sort (null , true );
12371237 }
12381238
1239- private void on_background_action_folders_first_changed (GLib .SimpleAction action , GLib .Variant ? val ) {
1240- var prefs = Files . Preferences . get_default ();
1241- prefs. sort_directories_first = ! prefs. sort_directories_first;
1242- }
1243-
12441239 private void set_sort (string ? col_name , bool reverse ) {
12451240 int sort_column_id;
12461241 Gtk . SortType sort_order;
@@ -1480,9 +1475,8 @@ namespace Files {
14801475 slot. reload ();
14811476 }
14821477
1483- private void on_sort_directories_first_changed (GLib .Object prefs , GLib .ParamSpec pspec ) {
1484- var sort_directories_first = ((Files . Preferences ) prefs). sort_directories_first;
1485- model. set_should_sort_directories_first (sort_directories_first);
1478+ private void on_sort_directories_first_changed (Settings settings , string key ) {
1479+ model. set_should_sort_directories_first (settings. get_boolean (key));
14861480 }
14871481
14881482 private void directory_hidden_changed (Directory dir , bool show ) {
@@ -2343,7 +2337,7 @@ namespace Files {
23432337 reversed_checkitem. action_name = " background.reverse" ;
23442338
23452339 var folders_first_checkitem = new Gtk .CheckMenuItem .with_label (_(" Folders Before Files" ));
2346- folders_first_checkitem. action_name = " background.folders -first" ;
2340+ folders_first_checkitem. action_name = " win.sort-directories -first" ;
23472341
23482342 submenu = new Gtk .Menu ();
23492343 submenu. add (name_radioitem);
@@ -2574,8 +2568,6 @@ namespace Files {
25742568 action_set_state (background_actions, " sort-by" , val);
25752569 val = new GLib .Variant .boolean (sort_order == Gtk . SortType . DESCENDING );
25762570 action_set_state (background_actions, " reverse" , val);
2577- val = new GLib .Variant .boolean (Files . Preferences . get_default (). sort_directories_first);
2578- action_set_state (background_actions, " folders-first" , val);
25792571 } else {
25802572 warning (" Update menu actions sort: The model is unsorted - this should not happen" );
25812573 }
0 commit comments