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
parent 5b197d1b
......@@ -165,6 +165,11 @@
<attribute name="action">view.delete-from-trash</attribute>
<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>
......
......@@ -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,10 +6240,16 @@ 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),
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment