[nautilus] general: Remove option to bypass delete confirmation



commit e96aac1f6526f5373405e071703b5f18b0c728d3
Author: Sachin Daluja <30343-sachindaluja users noreply gitlab gnome org>
Date:   Sun Jan 24 11:54:59 2021 -0500

    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 +--
 src/resources/ui/nautilus-preferences-window.ui    | 18 +-----------
 8 files changed, 5 insertions(+), 66 deletions(-)
---
diff --git a/data/org.gnome.nautilus.gschema.xml b/data/org.gnome.nautilus.gschema.xml
index 7dd6bb2d8..b02c57814 100644
--- a/data/org.gnome.nautilus.gschema.xml
+++ b/data/org.gnome.nautilus.gschema.xml
@@ -109,11 +109,6 @@
       <summary>Whether to show context menu items to create links from copied or selected files</summary>
       <description>If set to true, then Nautilus will show context menu items to create links from the 
copied or selected files.</description>
     </key>
-    <key type="b" name="confirm-trash">
-      <default>true</default>
-      <summary>Whether to ask for confirmation when deleting files, or emptying the Trash</summary>
-      <description>If set to true, then Nautilus will ask for confirmation when you attempt to delete files, 
or empty the Trash.</description>
-    </key>
     <key name="show-directory-item-counts" enum="org.gnome.nautilus.SpeedTradeoff">
       <aliases><alias value='local_only' target='local-only'/></aliases>
       <default>'local-only'</default>
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index 85c42f12f..bb1d04acc 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"
@@ -1639,19 +1638,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)
@@ -1660,12 +1646,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);
 
@@ -1704,12 +1684,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,
@@ -1731,12 +1705,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 87a79e706..0c9e20d9c 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 0d8cd8414..59ab729d3 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 6d7cb817a..807f5c377 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>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]