!12 Add the ability to create document
From: @ikernel-mryao Reviewed-by: @dwl301 Signed-off-by: @dwl301
This commit is contained in:
commit
1e324cd538
@ -1,6 +1,6 @@
|
||||
Name: nautilus
|
||||
Version: 3.33.90
|
||||
Release: 8
|
||||
Release: 9
|
||||
Summary: Default file manager for GNOME
|
||||
License: GPLv3+ and LGPLv2+
|
||||
URL: https://wiki.gnome.org/Apps/Nautilus
|
||||
@ -20,6 +20,7 @@ Patch02: nautius-3.33.90-translate-English-tips-information-to-chinese.p
|
||||
Patch03: nautius-3.33.90-display-tooltip-content.patch
|
||||
Patch04: nautius-3.33.90-translate-general-and-show-sidebar.patch
|
||||
Patch05: nautius-3.33.90-Add-right-click-sort-function.patch
|
||||
Patch06: nautius-3.33.90-Add-the-ability-to-create-document.patch
|
||||
|
||||
%description
|
||||
It's easier to manage your files for the GNOME desktop. Ability to browse directories on local and remote systems.
|
||||
@ -85,6 +86,12 @@ make test
|
||||
%{_datadir}/metainfo/*
|
||||
|
||||
%changelog
|
||||
* Thu Dec 15 2022 Guangzhong Yao <yaoguangzhong@xfusion.com> - 3.33.90-9
|
||||
- Type:bugfix
|
||||
- Id:NA
|
||||
- SUG:NA
|
||||
- DESC: Add the ability to create document
|
||||
|
||||
* Thu Dec 15 2022 Guangzhong Yao <yaoguangzhong@xfusion.com> - 3.33.90-8
|
||||
- Type:bugfix
|
||||
- Id:NA
|
||||
|
||||
164
nautius-3.33.90-Add-the-ability-to-create-document.patch
Normal file
164
nautius-3.33.90-Add-the-ability-to-create-document.patch
Normal file
@ -0,0 +1,164 @@
|
||||
From dbb570fc748d0c2743c58f601fa7df54515f8ed0 Mon Sep 17 00:00:00 2001
|
||||
From: yangzhuangzhuang <yangzhuangzhuang@xfusion.com>
|
||||
Date: Thu, 1 Sep 2022 17:01:47 +0800
|
||||
Subject: [PATCH] Right-click to add new text document function
|
||||
|
||||
Add the text document button and place the text document and new folder in the New button
|
||||
|
||||
---
|
||||
po/zh_CN.po | 6 +++
|
||||
src/nautilus-files-view.c | 47 +++++++++++++++++++
|
||||
.../ui/nautilus-files-view-context-menus.ui | 23 +++++++--
|
||||
3 files changed, 72 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/po/zh_CN.po b/po/zh_CN.po
|
||||
index 7b484cf..7fbb840 100644
|
||||
--- a/po/zh_CN.po
|
||||
+++ b/po/zh_CN.po
|
||||
@@ -5887,3 +5887,9 @@ msgstr "显示侧边栏(S)"
|
||||
|
||||
msgid "Sort"
|
||||
msgstr "排序"
|
||||
+
|
||||
+msgid "_Document"
|
||||
+msgstr "文本文档"
|
||||
+
|
||||
+msgid "_Create"
|
||||
+msgstr "新建"
|
||||
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
|
||||
index 666fcf3..1b2cf73 100644
|
||||
--- a/src/nautilus-files-view.c
|
||||
+++ b/src/nautilus-files-view.c
|
||||
@@ -2413,6 +2413,16 @@ nautilus_files_view_new_file (NautilusFilesView *directory_view,
|
||||
g_free (container_uri);
|
||||
}
|
||||
|
||||
+static void
|
||||
+action_new_file (GSimpleAction *action,
|
||||
+ GVariant *state,
|
||||
+ gpointer user_data)
|
||||
+{
|
||||
+ g_assert (NAUTILUS_IS_FILES_VIEW (user_data));
|
||||
+
|
||||
+ nautilus_files_view_new_file (NAUTILUS_FILES_VIEW (user_data), NULL, NULL);
|
||||
+}
|
||||
+
|
||||
static void
|
||||
action_new_folder (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
@@ -6955,6 +6965,7 @@ const GActionEntry view_entries[] =
|
||||
{ "paste_accel", action_paste_files_accel },
|
||||
{ "create-link", action_create_links },
|
||||
{ "new-document" },
|
||||
+ { "new-file", action_new_file },
|
||||
/* Selection menu */
|
||||
{ "scripts" },
|
||||
{ "new-folder-with-selection", action_new_folder_with_selection },
|
||||
@@ -7353,6 +7364,11 @@ real_update_actions_state (NautilusFilesView *view)
|
||||
gboolean show_star;
|
||||
gboolean show_unstar;
|
||||
gchar *uri;
|
||||
+ GAppInfo *default_app;
|
||||
+ gboolean can_create_text;
|
||||
+ gboolean can_create_document;
|
||||
+ gboolean can_create_spreadsheet;
|
||||
+ gboolean can_create_presentation;
|
||||
|
||||
priv = nautilus_files_view_get_instance_private (view);
|
||||
|
||||
@@ -7448,6 +7464,32 @@ real_update_actions_state (NautilusFilesView *view)
|
||||
"new-folder");
|
||||
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), can_create_files);
|
||||
|
||||
+ action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
|
||||
+ "new-file");
|
||||
+
|
||||
+ default_app = g_app_info_get_default_for_type ("text/plain", FALSE);
|
||||
+ can_create_text = default_app != NULL;
|
||||
+ g_object_unref (default_app);
|
||||
+
|
||||
+ default_app = g_app_info_get_default_for_type ("application/vnd.oasis.opendocument.text", FALSE);
|
||||
+ can_create_document = default_app != NULL;
|
||||
+ g_object_unref (default_app);
|
||||
+
|
||||
+ default_app = g_app_info_get_default_for_type ("application/vnd.oasis.opendocument.spreadsheet", FALSE);
|
||||
+ can_create_spreadsheet = default_app != NULL;
|
||||
+ g_object_unref (default_app);
|
||||
+
|
||||
+ default_app = g_app_info_get_default_for_type ("application/vnd.oasis.opendocument.presentation", FALSE);
|
||||
+ can_create_presentation = default_app != NULL;
|
||||
+ g_object_unref (default_app);
|
||||
+
|
||||
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
|
||||
+ can_create_files && (
|
||||
+ can_create_text ||
|
||||
+ can_create_document ||
|
||||
+ can_create_spreadsheet ||
|
||||
+ can_create_presentation));
|
||||
+
|
||||
item_opens_in_view = selection_count != 0;
|
||||
|
||||
for (l = selection; l != NULL; l = l->next)
|
||||
@@ -7646,6 +7688,10 @@ real_update_actions_state (NautilusFilesView *view)
|
||||
!selection_contains_starred &&
|
||||
priv->templates_present);
|
||||
|
||||
+ action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
|
||||
+ "new-file");
|
||||
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), can_create_files);
|
||||
+
|
||||
g_object_ref (view); /* Need to keep the object alive until we get the reply */
|
||||
gtk_clipboard_request_text (nautilus_clipboard_get (GTK_WIDGET (view)),
|
||||
on_clipboard_contents_received,
|
||||
@@ -9776,6 +9822,7 @@ nautilus_files_view_init (NautilusFilesView *view)
|
||||
nautilus_application_set_accelerator (app, "view.cut", "<control>x");
|
||||
nautilus_application_set_accelerator (app, "view.copy", "<control>c");
|
||||
nautilus_application_set_accelerator (app, "view.create-link-in-place", "<control><shift>m");
|
||||
+ nautilus_application_set_accelerator (app, "view.new-file", "<control><shift>f");
|
||||
nautilus_application_set_accelerator (app, "view.new-folder", "<control><shift>n");
|
||||
/* Only accesible by shorcuts */
|
||||
nautilus_application_set_accelerator (app, "view.select-pattern", "<control>s");
|
||||
diff --git a/src/resources/ui/nautilus-files-view-context-menus.ui b/src/resources/ui/nautilus-files-view-context-menus.ui
|
||||
index 279646d..420b0b5 100644
|
||||
--- a/src/resources/ui/nautilus-files-view-context-menus.ui
|
||||
+++ b/src/resources/ui/nautilus-files-view-context-menus.ui
|
||||
@@ -1,10 +1,24 @@
|
||||
<?xml version="1.0"?>
|
||||
<interface>
|
||||
<menu id="background-menu">
|
||||
- <item>
|
||||
- <attribute name="label" translatable="yes">New _Folder</attribute>
|
||||
- <attribute name="action">view.new-folder</attribute>
|
||||
- </item>
|
||||
+ <section>
|
||||
+ <submenu>
|
||||
+ <attribute name="label" translatable="yes">_Create</attribute>
|
||||
+ <section>
|
||||
+ <item>
|
||||
+ <attribute name="label" translatable="yes">New _Folder</attribute>
|
||||
+ <attribute name="action">view.new-folder</attribute>
|
||||
+ </item>
|
||||
+ </section>
|
||||
+ <section>
|
||||
+ <item>
|
||||
+ <attribute name="label" translatable="yes">_Document</attribute>
|
||||
+ <attribute name="action">view.new-file</attribute>
|
||||
+ </item>
|
||||
+ </section>
|
||||
+ </submenu>
|
||||
+ </section>
|
||||
+ <section>
|
||||
<submenu>
|
||||
<attribute name="id">templates-submenu</attribute>
|
||||
<attribute name="label" translatable="yes">New _Document</attribute>
|
||||
@@ -46,6 +60,7 @@
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
+ </section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Paste</attribute>
|
||||
--
|
||||
2.27.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user