@@ -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 */
@@ -2056,6 +2056,9 @@ namespace Files {
20562056 ));
20572057 }
20582058
2059+ var bookmark_action = (SimpleAction ) common_actions. lookup_action (" bookmark" );
2060+ var bookmark_list = BookmarkList . get_instance ();
2061+
20592062 if (get_selected_files () != null ) { // Add selection actions
20602063 var cut_menuitem = new Gtk .MenuItem ();
20612064 cut_menuitem. add (new Granite .AccelLabel (
@@ -2211,10 +2214,12 @@ namespace Files {
22112214 menu. add (rename_menuitem);
22122215 }
22132216
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)) {
2217+ var already_bookmarked = bookmark_list . contains (
2218+ new Bookmark .from_uri (selected_files . data . uri, " " )
2219+ );
22172220
2221+ /* Do not offer to bookmark if location is already bookmarked */
2222+ if (common_actions. get_action_enabled (" bookmark" ) && ! already_bookmarked) {
22182223 menu. add (bookmark_menuitem);
22192224 }
22202225
@@ -2271,9 +2276,12 @@ namespace Files {
22712276 menu. add (new SortSubMenuItem ());
22722277 }
22732278
2279+ var already_bookmarked = bookmark_list. contains (
2280+ new Bookmark .from_uri (slot. directory. file. uri, " " )
2281+ );
2282+
22742283 /* 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)) {
2284+ if (common_actions. get_action_enabled (" bookmark" ) && ! already_bookmarked) {
22772285
22782286 menu. add (bookmark_menuitem);
22792287 }
0 commit comments