[nautilus/wip/antoniof/new-list-view-without-expanders: 7/23] files-view: Use custom attribute to mark menu item




commit 245fe76233cd2da66a06a480747fa2e7001b2390
Author: António Fernandes <antoniof gnome org>
Date:   Sun Feb 13 23:13:41 2022 +0000

    files-view: Use custom attribute to mark menu item
    
    This is more flexible than assuming the "target" is a string.
    
    This prepares for the view.sort action to take a tuple target.

 src/nautilus-files-view.c                      | 2 +-
 src/resources/ui/nautilus-toolbar-view-menu.ui | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index ba08f2254..12c08dd3b 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -8062,7 +8062,7 @@ nautilus_files_view_reset_view_menu (NautilusFilesView *view)
      * attribute set to "action-disabled", and that an inexistant action is
      * treated as a disabled action. */
     trashed_action = nautilus_file_is_in_trash (file) ? "view.sort" : "doesnt-exist";
-    i = nautilus_g_menu_model_find_by_string (sort_section, "target", "trash-time");
+    i = nautilus_g_menu_model_find_by_string (sort_section, "nautilus-menu-item", "last_trashed");
     g_return_if_fail (i != -1);
     nautilus_g_menu_replace_string_in_item (G_MENU (sort_section), i,
                                             "action", trashed_action);
diff --git a/src/resources/ui/nautilus-toolbar-view-menu.ui b/src/resources/ui/nautilus-toolbar-view-menu.ui
index 291408b11..fb9dac220 100644
--- a/src/resources/ui/nautilus-toolbar-view-menu.ui
+++ b/src/resources/ui/nautilus-toolbar-view-menu.ui
@@ -43,6 +43,7 @@
       <attribute name="target">trash-time</attribute>
       <attribute name="label" translatable="yes">Last _Trashed</attribute>
       <attribute name="hidden-when">action-disabled</attribute>
+      <attribute name="nautilus-menu-item">last_trashed</attribute>
     </item>
   </menu>
 </interface>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]