From 2eb3624defd4d764a24c2fd6431ca01f152eaefc Mon Sep 17 00:00:00 2001
From: yangzhuangzhuang <yangzhuangzhuang@xfusion.com>
Date: Fri, 26 Aug 2022 12:02:05 +0800
Subject: [PATCH] Add right-click sort function

---
 po/zh_CN.po                                   |  3 ++
 .../ui/nautilus-files-view-context-menus.ui   | 37 ++++++++++++++++++-
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/po/zh_CN.po b/po/zh_CN.po
index 55ce692..7b484cf 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -5884,3 +5884,6 @@ msgstr "常规"
 
 msgid "_Show sidebar"
 msgstr "显示侧边栏(S)"
+
+msgid "Sort"
+msgstr "排序"
diff --git a/src/resources/ui/nautilus-files-view-context-menus.ui b/src/resources/ui/nautilus-files-view-context-menus.ui
index 9f0d238..c9de20e 100644
--- a/src/resources/ui/nautilus-files-view-context-menus.ui
+++ b/src/resources/ui/nautilus-files-view-context-menus.ui
@@ -11,6 +11,41 @@
       <attribute name="action">view.new-document</attribute>
       <attribute name="hidden-when">action-disabled</attribute>
     </submenu>
+    <submenu>
+      <attribute name="label" translatable="yes">Sort</attribute>
+      <section>
+	<item>
+          <attribute name="label" translatable="yes" context="Sort Criterion" comments="This is used to sort by name in the toolbar view menu">_A-Z</attribute>
+          <attribute name="action">view.sort</attribute>
+          <attribute name="target">name</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes" context="Sort Criterion" comments="This is used to sort by name, in descending order in the toolbar view menu">_Z-A</attribute>
+          <attribute name="action">view.sort</attribute>
+          <attribute name="target">name-desc</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">Last _Modified</attribute>
+          <attribute name="action">view.sort</attribute>
+          <attribute name="target">modification-date-desc</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_First Modified</attribute>
+          <attribute name="action">view.sort</attribute>
+          <attribute name="target">modification-date</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Size</attribute>
+          <attribute name="action">view.sort</attribute>
+          <attribute name="target">size</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Type</attribute>
+          <attribute name="action">view.sort</attribute>
+          <attribute name="target">type</attribute>
+        </item>
+      </section>
+    </submenu>
     <section>
       <item>
         <attribute name="label" translatable="yes">_Paste</attribute>
@@ -239,4 +274,4 @@
       </item>
     </section>
   </menu>
-</interface>
\ No newline at end of file
+</interface>
-- 
2.27.0

