summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2015-11-25 23:21:22 +0100
committerCarlos Soriano <csoriano@gnome.org>2015-11-26 00:41:23 +0100
commit0e5f6710df593de3455fe0e8b1509cdf2fb55bbe (patch)
tree660441718b5d04c586f633d1d04d9066ae51888e
parent0a86a7392242ce4b6bd231846bd91cb047b940b8 (diff)
downloadnautilus-0e5f6710df593de3455fe0e8b1509cdf2fb55bbe.tar.gz
files-view: add setting for always show delete permanently
Maintenance is not that much as long as we don't show it in any UI, and was requested by several people. https://bugzilla.gnome.org/show_bug.cgi?id=757375
-rw-r--r--libnautilus-private/nautilus-global-preferences.h3
-rw-r--r--libnautilus-private/org.gnome.nautilus.gschema.xml.in5
-rw-r--r--src/nautilus-files-view.c16
-rw-r--r--src/resources/ui/nautilus-files-view-context-menus.ui5
4 files changed, 29 insertions, 0 deletions
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
index ffe1b7685..af59b3f9f 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -162,6 +162,9 @@ typedef enum
/* Switch to list view while searching */
#define NAUTILUS_PREFERENCES_LIST_VIEW_ON_SEARCH "list-view-on-search"
+/* Context menu options */
+#define NAUTILUS_PREFERENCES_SHOW_DELETE_PERMANENTLY "show-delete-permanently"
+
void nautilus_global_preferences_init (void);
char *nautilus_global_preferences_get_default_folder_viewer_preference_as_iid (void);
diff --git a/libnautilus-private/org.gnome.nautilus.gschema.xml.in b/libnautilus-private/org.gnome.nautilus.gschema.xml.in
index c6cf481f3..113ba59fa 100644
--- a/libnautilus-private/org.gnome.nautilus.gschema.xml.in
+++ b/libnautilus-private/org.gnome.nautilus.gschema.xml.in
@@ -75,6 +75,11 @@
<_summary>Whether to enable recursive search or not</_summary>
<_description>Enables or disables recursive search in Nautilus.</_description>
</key>
+ <key name="show-delete-permanently" type="b">
+ <default>false</default>
+ <_summary>Whether to show a context menu item to delete permanently</_summary>
+ <_description>If set to true Nautilus will show a delete permanently context menu item to bypass the trash.</_description>
+ </key>
<key name="confirm-trash" type="b">
<default>true</default>
<_summary>Whether to ask for confirmation when deleting files, or emptying Trash</_summary>
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index cfd4d6482..1bf0d3c17 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -5895,6 +5895,11 @@ const GActionEntry view_entries[] = {
* shortcut. */
{ "delete-permanently-shortcut", action_delete },
{ "delete-permanently-menu-item", action_delete },
+ /* This is only shown when the setting to show always delete permanently
+ * is set and when the common use cases for delete permanently which uses
+ * Delete as a shortcut are not needed. For instance this will be only
+ * present when the setting is true and when it can trash files */
+ { "permanent-delete-permanently-menu-item", action_delete },
{ "remove-from-recent", action_remove_from_recent },
{ "restore-from-trash", action_restore_from_trash},
{ "paste-into", action_paste_files_into },
@@ -6169,6 +6174,7 @@ real_update_actions_state (NautilusFilesView *view)
gboolean show_start;
gboolean show_stop;
gboolean show_detect_media;
+ gboolean settings_show_delete_permanently;
GDriveStartStopType start_stop_type;
view_action_group = view->details->view_action_group;
@@ -6203,6 +6209,8 @@ real_update_actions_state (NautilusFilesView *view)
selection_count == 1 &&
can_paste_into_file (NAUTILUS_FILE (selection->data)));
show_properties = !NAUTILUS_IS_DESKTOP_CANVAS_VIEW (view) || selection_count > 0;
+ settings_show_delete_permanently = g_settings_get_boolean (nautilus_preferences,
+ NAUTILUS_PREFERENCES_SHOW_DELETE_PERMANENTLY);
/* Right click actions */
/* Selection menu actions */
@@ -6313,6 +6321,13 @@ real_update_actions_state (NautilusFilesView *view)
!selection_all_in_trash && !selection_contains_recent);
action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
+ "permanent-delete-permanently-menu-item");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+ can_delete_files && can_trash_files &&
+ settings_show_delete_permanently &&
+ !selection_all_in_trash && !selection_contains_recent);
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
"remove-from-recent");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
selection_contains_recent && selection_count > 0);
@@ -8141,6 +8156,7 @@ nautilus_files_view_init (NautilusFilesView *view)
* the menu item is available, since we never make both the trash and delete-permanently-menu-item
* actions active */
nautilus_application_add_accelerator (app, "view.delete-permanently-menu-item", "Delete");
+ nautilus_application_add_accelerator (app, "view.permanent-delete-permanently-menu-item", "<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");
diff --git a/src/resources/ui/nautilus-files-view-context-menus.ui b/src/resources/ui/nautilus-files-view-context-menus.ui
index df91fb87a..238ac38d2 100644
--- a/src/resources/ui/nautilus-files-view-context-menus.ui
+++ b/src/resources/ui/nautilus-files-view-context-menus.ui
@@ -171,6 +171,11 @@
<attribute name="hidden-when">action-disabled</attribute>
</item>
<item>
+ <attribute name="label" translatable="yes">_Delete Permanently</attribute>
+ <attribute name="action">view.permanent-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>