[nautilus] nautilus-view: show delete permanently on trash unsupported systems
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] nautilus-view: show delete permanently on trash unsupported systems
- Date: Wed, 13 May 2015 13:22:59 +0000 (UTC)
commit fdef74de4d6966cb86563a8710d863138bd9eaa8
Author: Carlos Soriano <csoriano gnome org>
Date: Wed May 13 13:59:02 2015 +0200
nautilus-view: show delete permanently on trash unsupported systems
We removed the menu item to delete permanently and instead always
allow the shortcut <shift>Delete to do so, thinking that move
to trash will be always available.
The problem is that trash is not supported on some systems, and the user
can be confused if there is no way to delete the item on the menu.
To fix that, still allow always to delete permanently with the shortcut
and show the menu item only when trash is not available.
https://bugzilla.gnome.org/show_bug.cgi?id=748692
src/nautilus-view-context-menus.xml | 5 +++++
src/nautilus-view.c | 18 +++++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-view-context-menus.xml b/src/nautilus-view-context-menus.xml
index a830ba7..7e8cfcb 100644
--- a/src/nautilus-view-context-menus.xml
+++ b/src/nautilus-view-context-menus.xml
@@ -166,6 +166,11 @@
<attribute name="hidden-when">action-disabled</attribute>
</item>
<item>
+ <attribute name="label" translatable="yes">_Delete Permanently</attribute>
+ <attribute name="action">view.delete-permanently-menu-item</attribute>
+ <attribute name="hidden-when">action-disabled</attribute>
+ </item>
+ <item>
<attribute name="label" translatable="yes">Empty Trash</attribute>
<attribute name="action">view.empty-trash</attribute>
<attribute name="hidden-when">action-disabled</attribute>
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index b5e1875..c786886 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -5822,7 +5822,13 @@ const GActionEntry view_entries[] = {
{ "copy-to", action_copy_to},
{ "move-to-trash", action_move_to_trash},
{ "delete-from-trash", action_delete },
- { "delete-permanently", action_delete },
+ /* We separate the shortcut and the menu item since we want the shortcut
+ * to always be available, but we don't want the menu item shown if not
+ * completely necesary. Since the visibility of the menu item is based on
+ * the action enability, we need to split the actions for the menu and the
+ * shortcut. */
+ { "delete-permanently-shortcut", action_delete },
+ { "delete-permanently-menu-item", action_delete },
{ "restore-from-trash", action_restore_from_trash},
{ "paste-into", action_paste_files_into },
{ "rename", action_rename},
@@ -6234,11 +6240,17 @@ real_update_actions_state (NautilusView *view)
can_delete_files && selection_all_in_trash);
action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
- "delete-permanently");
+ "delete-permanently-shortcut");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
can_delete_files);
action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
+ "delete-permanently-menu-item");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+ can_delete_files && !can_trash_files &&
+ !selection_all_in_trash && !selection_contains_recent);
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
"cut");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
can_move_files && !selection_contains_recent);
@@ -7789,7 +7801,7 @@ nautilus_view_init (NautilusView *view)
nautilus_application_add_accelerator (app, "view.open-item-new-window", "<shift><control>w");
nautilus_application_add_accelerator (app, "view.move-to-trash", "Delete");
nautilus_application_add_accelerator (app, "view.delete-from-trash", "Delete");
- nautilus_application_add_accelerator (app, "view.delete-permanently", "<shift>Delete");
+ nautilus_application_add_accelerator (app, "view.delete-permanently-shortcut", "<shift>Delete");
nautilus_application_add_accelerator (app, "view.properties", "<control>i");
nautilus_application_add_accelerator (app, "view.open-item-location", "<control><alt>o");
nautilus_application_add_accelerator (app, "view.rename", "F2");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]