@@ -453,12 +453,12 @@ namespace Files {
453453
454454 var prefs = (Files . Preferences . get_default ());
455455 prefs. notify[" show-hidden-files" ]. connect (on_show_hidden_files_changed);
456- prefs. notify[" show-remote-thumbnails" ]. connect (on_show_thumbnails_changed);
457- prefs. notify[" show-local-thumbnails" ]. connect (on_show_thumbnails_changed);
458456 prefs. notify[" date-format" ]. connect (on_dateformat_changed);
459457
460458 app_settings. bind (" singleclick-select" , this , " singleclick_select" , SettingsBindFlags . DEFAULT );
461459
460+ app_settings. changed[" show-remote-thumbnails" ]. connect (on_show_thumbnails_changed);
461+ app_settings. changed[" show-local-thumbnails" ]. connect (on_show_thumbnails_changed);
462462 app_settings. changed[" sort-directories-first" ]. connect (on_sort_directories_first_changed);
463463
464464 model. set_should_sort_directories_first (app_settings. get_boolean (" sort-directories-first" ));
@@ -1204,7 +1204,7 @@ namespace Files {
12041204 location = slot. directory. file. get_target_location ();
12051205 }
12061206
1207- window . bookmark_uri ( location. get_uri ());
1207+ BookmarkList . get_instance () . insert_uri_at_end ( location. get_uri (), " " );
12081208 }
12091209
12101210 /* * Background actions */
@@ -1462,11 +1462,10 @@ namespace Files {
14621462 }
14631463
14641464 private void set_should_thumbnail () {
1465- var prefs = Files . Preferences . get_default ();
14661465 if (slot. directory. is_network) {
1467- should_thumbnail = slot. directory. can_open_files && prefs . show_remote_thumbnails ;
1466+ should_thumbnail = slot. directory. can_open_files && app_settings . get_boolean ( " show-remote-thumbnails " ) ;
14681467 } else {
1469- should_thumbnail = prefs . show_local_thumbnails ;
1468+ should_thumbnail = app_settings . get_boolean ( " show-local-thumbnails " ) ;
14701469 }
14711470 }
14721471
@@ -2056,6 +2055,9 @@ namespace Files {
20562055 ));
20572056 }
20582057
2058+ var bookmark_action = (SimpleAction ) common_actions. lookup_action (" bookmark" );
2059+ var bookmark_list = BookmarkList . get_instance ();
2060+
20592061 if (get_selected_files () != null ) { // Add selection actions
20602062 var cut_menuitem = new Gtk .MenuItem ();
20612063 cut_menuitem. add (new Granite .AccelLabel (
@@ -2211,10 +2213,12 @@ namespace Files {
22112213 menu. add (rename_menuitem);
22122214 }
22132215
2214- /* Do not offer to bookmark if location is already bookmarked */
2215- if (common_actions . get_action_enabled ( " bookmark " ) &&
2216- window . can_bookmark_uri (selected_files . data . uri)) {
2216+ var already_bookmarked = bookmark_list . contains (
2217+ new Bookmark .from_uri (selected_files . data . uri, " " )
2218+ );
22172219
2220+ /* Do not offer to bookmark if location is already bookmarked */
2221+ if (common_actions. get_action_enabled (" bookmark" ) && ! already_bookmarked) {
22182222 menu. add (bookmark_menuitem);
22192223 }
22202224
@@ -2271,9 +2275,12 @@ namespace Files {
22712275 menu. add (new SortSubMenuItem ());
22722276 }
22732277
2278+ var already_bookmarked = bookmark_list. contains (
2279+ new Bookmark .from_uri (slot. directory. file. uri, " " )
2280+ );
2281+
22742282 /* Do not offer to bookmark if location is already bookmarked */
2275- if (common_actions. get_action_enabled (" bookmark" ) &&
2276- window. can_bookmark_uri (slot. directory. file. uri)) {
2283+ if (common_actions. get_action_enabled (" bookmark" ) && ! already_bookmarked) {
22772284
22782285 menu. add (bookmark_menuitem);
22792286 }
@@ -2313,40 +2320,51 @@ namespace Files {
23132320
23142321 private class SortSubMenuItem : Gtk .MenuItem {
23152322 construct {
2316- var name_radioitem = new Gtk .CheckMenuItem .with_label (_(" Name" ));
2317- name_radioitem. action_name = " background.sort-by" ;
2318- name_radioitem. action_target = " name" ;
2319- name_radioitem. draw_as_radio = true ;
2320-
2321- var size_radioitem = new Gtk .CheckMenuItem .with_label (_(" Size" ));
2322- size_radioitem. action_name = " background.sort-by" ;
2323- size_radioitem. action_target = " size" ;
2324- size_radioitem. draw_as_radio = true ;
2325-
2326- var type_radioitem = new Gtk .CheckMenuItem .with_label (_(" Type" ));
2327- type_radioitem. action_name = " background.sort-by" ;
2328- type_radioitem. action_target = " type" ;
2329- type_radioitem. draw_as_radio = true ;
2330-
2331- var date_radioitem = new Gtk .CheckMenuItem .with_label (_(" Date" ));
2332- date_radioitem. action_name = " background.sort-by" ;
2333- date_radioitem. action_target = " modified" ;
2334- date_radioitem. draw_as_radio = true ;
2335-
2336- var reversed_checkitem = new Gtk .CheckMenuItem .with_label (_(" Reversed Order" ));
2337- reversed_checkitem. action_name = " background.reverse" ;
2338-
2339- var folders_first_checkitem = new Gtk .CheckMenuItem .with_label (_(" Folders Before Files" ));
2340- folders_first_checkitem. action_name = " win.sort-directories-first" ;
2341-
2342- submenu = new Gtk .Menu ();
2343- submenu. add (name_radioitem);
2344- submenu. add (size_radioitem);
2345- submenu. add (type_radioitem);
2346- submenu. add (date_radioitem);
2347- submenu. add (new Gtk .SeparatorMenuItem ());
2348- submenu. add (reversed_checkitem);
2349- submenu. add (folders_first_checkitem);
2323+ var name_item = new MenuItem (
2324+ _(" Name" ),
2325+ Action . print_detailed_name (" background.sort-by" , new Variant .string (" name" ))
2326+ );
2327+
2328+ var size_item = new MenuItem (
2329+ _(" Size" ),
2330+ Action . print_detailed_name (" background.sort-by" , new Variant .string (" size" ))
2331+ );
2332+
2333+ var type_item = new MenuItem (
2334+ _(" Type" ),
2335+ Action . print_detailed_name (" background.sort-by" , new Variant .string (" type" ))
2336+ );
2337+
2338+ var date_item = new MenuItem (
2339+ _(" Date" ),
2340+ Action . print_detailed_name (" background.sort-by" , new Variant .string (" modified" ))
2341+ );
2342+
2343+ var reversed_item = new MenuItem (
2344+ _(" Reversed Order" ),
2345+ " background.reverse"
2346+ );
2347+
2348+ var folders_first_item = new MenuItem (
2349+ _(" Folders Before Files" ),
2350+ " win.sort-directories-first"
2351+ );
2352+
2353+ var radio_section = new Menu ();
2354+ radio_section. append_item (name_item);
2355+ radio_section. append_item (size_item);
2356+ radio_section. append_item (type_item);
2357+ radio_section. append_item (date_item);
2358+
2359+ var check_section = new Menu ();
2360+ check_section. append_item (reversed_item);
2361+ check_section. append_item (folders_first_item);
2362+
2363+ var menu_model = new Menu ();
2364+ menu_model. append_section (null , radio_section);
2365+ menu_model. append_section (null , check_section);
2366+
2367+ submenu = new Gtk .Menu .from_model (menu_model);
23502368
23512369 label = _(" Sort by" );
23522370 }
0 commit comments