0001-general-Remove-option-to-bypass-delete-confirmation.patch 9.47 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
From a8b9f51486c9fb9d5d947d8fc4c15f5011fb069e Mon Sep 17 00:00:00 2001
From: Sachin Daluja <30343-sachindaluja@users.noreply.gitlab.gnome.org>
Date: Sun, 24 Jan 2021 11:54:59 -0500
Subject: [PATCH 01/23] general: Remove option to bypass delete confirmation

A gsettings-based option "confirm-trash" existed to determine if a
confirmation dialog should be shown when emptying the trash. This
setting, enabled by default, was misappropriated for the unrelated
"delete directly" operation of files outside Trash. This latter use of
this setting was misleading and unexpected (more discussion on the
linked issue page.)

Remove option "confirm-trash" entirely because neither of the above
mentioned operations are reversible, so they should always require
confirmation.

Add ellipsis to labels for the "empty trash" and "delete permanently"
actions since they now always invoke a confirmation dialog.

Closes https://gitlab.gnome.org/GNOME/nautilus/-/issues/1699
---
 data/org.gnome.nautilus.gschema.xml           |  5 ---
 src/nautilus-file-operations.c                | 32 -------------------
 src/nautilus-global-preferences.h             |  3 --
 src/nautilus-preferences-window.c             |  5 ---
 src/nautilus-trash-bar.c                      |  2 +-
 src/nautilus-window.c                         |  2 +-
 .../ui/nautilus-files-view-context-menus.ui   |  4 +--
 .../ui/nautilus-preferences-window.ui         | 18 +----------
 8 files changed, 5 insertions(+), 66 deletions(-)

diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index 3adf3b54c..edc689e71 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -54,7 +54,6 @@
 #include "nautilus-operations-ui-manager.h"
 #include "nautilus-file-changes-queue.h"
 #include "nautilus-file-private.h"
-#include "nautilus-global-preferences.h"
 #include "nautilus-trash-monitor.h"
 #include "nautilus-file-utilities.h"
 #include "nautilus-file-undo-operations.h"
@@ -1611,19 +1610,6 @@ job_aborted (CommonJob *job)
     return g_cancellable_is_cancelled (job->cancellable);
 }
 
-/* Since this happens on a thread we can't use the global prefs object */
-static gboolean
-should_confirm_trash (void)
-{
-    GSettings *prefs;
-    gboolean confirm_trash;
-
-    prefs = g_settings_new ("org.gnome.nautilus.preferences");
-    confirm_trash = g_settings_get_boolean (prefs, NAUTILUS_PREFERENCES_CONFIRM_TRASH);
-    g_object_unref (prefs);
-    return confirm_trash;
-}
-
 static gboolean
 confirm_delete_from_trash (CommonJob *job,
                            GList     *files)
@@ -1632,12 +1618,6 @@ confirm_delete_from_trash (CommonJob *job,
     int file_count;
     int response;
 
-    /* Just Say Yes if the preference says not to confirm. */
-    if (!should_confirm_trash ())
-    {
-        return TRUE;
-    }
-
     file_count = g_list_length (files);
     g_assert (file_count > 0);
 
@@ -1676,12 +1656,6 @@ confirm_empty_trash (CommonJob *job)
     char *prompt;
     int response;
 
-    /* Just Say Yes if the preference says not to confirm. */
-    if (!should_confirm_trash ())
-    {
-        return TRUE;
-    }
-
     prompt = g_strdup (_("Empty all items from Trash?"));
 
     response = run_warning (job,
@@ -1703,12 +1677,6 @@ confirm_delete_directly (CommonJob *job,
     int file_count;
     int response;
 
-    /* Just Say Yes if the preference says not to confirm. */
-    if (!should_confirm_trash ())
-    {
-        return TRUE;
-    }
-
     file_count = g_list_length (files);
     g_assert (file_count > 0);
 
diff --git a/src/nautilus-global-preferences.h b/src/nautilus-global-preferences.h
index e7e497e3e..fc9e0d0dd 100644
--- a/src/nautilus-global-preferences.h
+++ b/src/nautilus-global-preferences.h
@@ -28,9 +28,6 @@
 
 G_BEGIN_DECLS
 
-/* Trash options */
-#define NAUTILUS_PREFERENCES_CONFIRM_TRASH			"confirm-trash"
-
 /* Display  */
 #define NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES			"show-hidden"
 
diff --git a/src/nautilus-preferences-window.c b/src/nautilus-preferences-window.c
index d75d9dcfa..b49ee3e9a 100644
--- a/src/nautilus-preferences-window.c
+++ b/src/nautilus-preferences-window.c
@@ -59,8 +59,6 @@
     "show_create_link_checkbutton"
 #define NAUTILUS_PREFERENCES_DIALOG_LIST_VIEW_USE_TREE_WIDGET                  \
     "use_tree_view_checkbutton"
-#define NAUTILUS_PREFERENCES_DIALOG_TRASH_CONFIRM_WIDGET                       \
-    "trash_confirm_checkbutton"
 #define NAUTILUS_PREFERENCES_DIALOG_USE_NEW_VIEWS_WIDGET                       \
     "use_new_views_checkbutton"
 
@@ -465,9 +463,6 @@ static void nautilus_preferences_window_setup(GtkBuilder *builder,
     bind_builder_bool (builder, nautilus_window_state,
                        NAUTILUS_PREFERENCS_DIALOG_START_WITH_SIDEBAR,
                        NAUTILUS_WINDOW_STATE_START_WITH_SIDEBAR);
-    bind_builder_bool (builder, nautilus_preferences,
-                       NAUTILUS_PREFERENCES_DIALOG_TRASH_CONFIRM_WIDGET,
-                       NAUTILUS_PREFERENCES_CONFIRM_TRASH);
     bind_builder_bool (builder, nautilus_list_view_preferences,
                        NAUTILUS_PREFERENCES_DIALOG_LIST_VIEW_USE_TREE_WIDGET,
                        NAUTILUS_PREFERENCES_LIST_VIEW_USE_TREE);
diff --git a/src/nautilus-trash-bar.c b/src/nautilus-trash-bar.c
index fefb05cc5..ae7b423be 100644
--- a/src/nautilus-trash-bar.c
+++ b/src/nautilus-trash-bar.c
@@ -213,7 +213,7 @@ nautilus_trash_bar_init (NautilusTrashBar *bar)
 
     w = gtk_info_bar_add_button (GTK_INFO_BAR (bar),
                                  /* Translators: "Empty" is an action (for the trash) , not a state */
-                                 _("_Empty"),
+                                 _("_Empty…"),
                                  TRASH_BAR_RESPONSE_EMPTY);
     gtk_widget_set_tooltip_text (w,
                                  _("Delete all items in the Trash"));
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index c81d150d1..5d5bee44d 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1328,7 +1328,7 @@ places_sidebar_populate_popup_cb (GtkPlacesSidebar *sidebar,
             menu_item = gtk_model_button_new ();
             gtk_actionable_set_action_name (GTK_ACTIONABLE (menu_item),
                                             "win.empty-trash");
-            g_object_set (menu_item, "text", _("Empty _Trash"), NULL);
+            g_object_set (menu_item, "text", _("Empty _Trash…"), NULL);
             gtk_container_add (GTK_CONTAINER (menu), menu_item);
             gtk_widget_show (menu_item);
 
diff --git a/src/resources/ui/nautilus-files-view-context-menus.ui b/src/resources/ui/nautilus-files-view-context-menus.ui
index 6438314a7..0b48f4fc1 100644
--- a/src/resources/ui/nautilus-files-view-context-menus.ui
+++ b/src/resources/ui/nautilus-files-view-context-menus.ui
@@ -158,12 +158,12 @@
         <attribute name="hidden-when">action-disabled</attribute>
       </item>
       <item>
-        <attribute name="label" translatable="yes">_Delete Permanently</attribute>
+        <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">_Delete Permanently</attribute>
+        <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>
diff --git a/src/resources/ui/nautilus-preferences-window.ui b/src/resources/ui/nautilus-preferences-window.ui
index 066b15733..af1c944bc 100644
--- a/src/resources/ui/nautilus-preferences-window.ui
+++ b/src/resources/ui/nautilus-preferences-window.ui
@@ -708,22 +708,6 @@
                         <property name="position">0</property>
                       </packing>
                     </child>
-                    <child>
-                      <object class="GtkCheckButton" id="trash_confirm_checkbutton">
-                        <property name="label" translatable="yes">Ask before _emptying the Trash</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="halign">start</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_indicator">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
                     <child>
                       <object class="GtkCheckButton" id="show_delete_permanently_checkbutton">
                         <property name="label" translatable="yes">Show action to _permanently delete files and folders</property>
@@ -737,7 +721,7 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">False</property>
-                        <property name="position">2</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                     <accessibility>
-- 
2.30.0