From 44ba536ad0b22b3f89799e99edcecbf9f84820d4 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Tue, 17 Mar 2020 14:38:42 +0800
Subject: [PATCH] add open terminal when clicking right key in desktop

---
 po/zh_CN.po                                   |  5 ++++
 .../caja-desktop-icon-view-ui.xml             |  1 +
 src/file-manager/fm-desktop-icon-view.c       | 25 +++++++++++++++++++
 3 files changed, 31 insertions(+)

diff --git a/po/zh_CN.po b/po/zh_CN.po
index 38cd51a..7f20991 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -3696,6 +3696,11 @@ msgstr "创建新启动器"
 msgid "Change Desktop _Background"
 msgstr "更改桌面背景(_B)"
 
+#. label, accelerator
+#: ../src/file-manager/fm-desktop-icon-view.c:778
+msgid "Open Terminal..."
+msgstr "打开终端"
+
 #. tooltip
 #: ../src/file-manager/fm-desktop-icon-view.c:774
 msgid ""
diff --git a/src/file-manager/caja-desktop-icon-view-ui.xml b/src/file-manager/caja-desktop-icon-view-ui.xml
index d437801..5654e4c 100644
--- a/src/file-manager/caja-desktop-icon-view-ui.xml
+++ b/src/file-manager/caja-desktop-icon-view-ui.xml
@@ -9,6 +9,7 @@
         </placeholder>
         <placeholder name="After Zoom Items">
                 <placeholder name="Background Items">
+                        <menuitem name="Open Terminal" action="Open Terminal"/>
                         <menuitem name="Change Background" action="Change Background"/>
                 </placeholder>
         </placeholder>
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c
index 9205edc..fba954d 100644
--- a/src/file-manager/fm-desktop-icon-view.c
+++ b/src/file-manager/fm-desktop-icon-view.c
@@ -652,6 +652,22 @@ action_new_launcher_callback (GtkAction *action, gpointer data)
 
 }
 
+action_open_terminal_callback (GtkAction *action, gpointer data)
+{
+    char *desktop_directory;
+
+    g_assert (FM_DIRECTORY_VIEW (data));
+
+    desktop_directory = caja_get_desktop_directory ();
+
+    caja_launch_application_from_command (gtk_widget_get_screen (GTK_WIDGET (data)),
+                                          "Mate Terminal",
+                                          "mate-terminal",
+                                          FALSE,
+                                          NULL, desktop_directory, NULL);
+    g_free (desktop_directory);
+
+}
 static void
 action_change_background_callback (GtkAction *action,
                                    gpointer data)
@@ -756,6 +772,15 @@ static const GtkActionEntry desktop_view_entries[] =
         G_CALLBACK (action_new_launcher_callback)
     },
     /* name, stock id */
+    {
+        "Open Terminal", NULL,
+        /* label, accelerator */
+        N_("Open Terminal..."), NULL,
+        /* tooltip */
+        N_("Mate Terminal"),
+        G_CALLBACK (action_open_terminal_callback)
+    },
+    /* name, stock id */
     {
         "Change Background", NULL,
         /* label, accelerator */
-- 
2.23.0

