From b4f49db3f57507b226801453860e69a9ac26d487 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Thu, 31 Oct 2024 11:38:27 -0400 Subject: [PATCH] Add setting to disable auto-expanding of treeview rows during drag-and-drop operations. This can be frustrating to deal with for folks with accessibility issues (like this guy). --- .../nemo-file-management-properties.glade | 16 ++++++++++++++++ libnemo-private/nemo-global-preferences.h | 1 + libnemo-private/nemo-tree-view-drag-dest.c | 19 +++++++++++-------- libnemo-private/org.nemo.gschema.xml | 4 ++++ src/nemo-file-management-properties.c | 5 +++++ 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/gresources/nemo-file-management-properties.glade b/gresources/nemo-file-management-properties.glade index 9388dcd51..709a70f02 100644 --- a/gresources/nemo-file-management-properties.glade +++ b/gresources/nemo-file-management-properties.glade @@ -1186,6 +1186,22 @@ along with . If not, see . 7 + + + Automatically expand rows during drag-and-drop + True + True + False + True + 0 + True + + + False + False + 8 + + diff --git a/libnemo-private/nemo-global-preferences.h b/libnemo-private/nemo-global-preferences.h index d3f93b2e1..e1f28f581 100644 --- a/libnemo-private/nemo-global-preferences.h +++ b/libnemo-private/nemo-global-preferences.h @@ -269,6 +269,7 @@ typedef enum #define NEMO_PREFERENCES_NEVER_QUEUE_FILE_OPS "never-queue-file-ops" #define NEMO_PREFERENCES_CLICK_DOUBLE_PARENT_FOLDER "click-double-parent-folder" +#define NEMO_PREFERENCES_EXPAND_ROW_ON_DND_DWELL "expand-row-on-dnd-dwell" #define NEMO_PREFERENCES_SHOW_MIME_MAKE_EXECUTABLE "enable-mime-actions-make-executable" #define NEMO_PREFERENCES_DEFERRED_ATTR_PRELOAD_LIMIT "deferred-attribute-preload-limit" diff --git a/libnemo-private/nemo-tree-view-drag-dest.c b/libnemo-private/nemo-tree-view-drag-dest.c index 035768c34..c09c47093 100644 --- a/libnemo-private/nemo-tree-view-drag-dest.c +++ b/libnemo-private/nemo-tree-view-drag-dest.c @@ -34,6 +34,7 @@ #include "nemo-file-dnd.h" #include "nemo-file-changes-queue.h" +#include "nemo-global-preferences.h" #include "nemo-icon-dnd.h" #include "nemo-link.h" @@ -522,14 +523,16 @@ drag_motion_callback (GtkWidget *widget, gtk_tree_path_compare (old_drop_path, drop_path) != 0)) { remove_expand_timeout (dest); } - if (dest->details->expand_id == 0 && drop_path != NULL) { - gtk_tree_model_get_iter (model, &drop_iter, drop_path); - if (gtk_tree_model_iter_has_child (model, &drop_iter)) { - dest->details->expand_id = g_timeout_add_seconds (HOVER_EXPAND_TIMEOUT, - expand_timeout, - dest); - } - } + if (g_settings_get_boolean (nemo_preferences, NEMO_PREFERENCES_EXPAND_ROW_ON_DND_DWELL)) { + if (dest->details->expand_id == 0 && drop_path != NULL) { + gtk_tree_model_get_iter (model, &drop_iter, drop_path); + if (gtk_tree_model_iter_has_child (model, &drop_iter)) { + dest->details->expand_id = g_timeout_add_seconds (HOVER_EXPAND_TIMEOUT, + expand_timeout, + dest); + } + } + } } else { clear_drag_dest_row (dest); remove_expand_timeout (dest); diff --git a/libnemo-private/org.nemo.gschema.xml b/libnemo-private/org.nemo.gschema.xml index f54c1dde3..3577a610b 100644 --- a/libnemo-private/org.nemo.gschema.xml +++ b/libnemo-private/org.nemo.gschema.xml @@ -97,6 +97,10 @@ Enables renaming of icons by two times clicking with pause between clicks If set to true, then icons in all Nemo windows will be able to get renamed quickly. Users should click two times on icons with a pause time more than double-click time of their system. + + true + During drag-and-drop operations, automatically expand rows when hovering them briefly + false Show the location entry by default diff --git a/src/nemo-file-management-properties.c b/src/nemo-file-management-properties.c index ffc86ad26..6e86fceb4 100644 --- a/src/nemo-file-management-properties.c +++ b/src/nemo-file-management-properties.c @@ -114,6 +114,7 @@ #define NEMO_FILE_MANAGEMENT_PROPERTIES_NEMO_PREFERENCES_SKIP_FILE_OP_QUEUE_WIDGET "skip_file_op_queue_checkbutton" #define NEMO_FILE_MANAGEMENT_PROPERTIES_NEMO_PREFERENCES_CLICK_DBL_PARENT_FOLDER_WIDGET "click_double_parent_folder_checkbutton" +#define NEMO_FILE_MANAGEMENT_PROPERTIES_NEMO_PREFERENCES_EXPAND_ROW_ON_DND_DWELL_WIDGET "expand_row_on_dnd_dwell_checkbutton" /* int enums */ #define NEMO_FILE_MANAGEMENT_PROPERTIES_THUMBNAIL_LIMIT_WIDGET "preview_image_size_combobox" @@ -1100,6 +1101,10 @@ nemo_file_management_properties_dialog_setup (GtkBuilder *builder, NEMO_FILE_MANAGEMENT_PROPERTIES_NEMO_PREFERENCES_CLICK_DBL_PARENT_FOLDER_WIDGET, NEMO_PREFERENCES_CLICK_DOUBLE_PARENT_FOLDER); + bind_builder_bool (builder, nemo_preferences, + NEMO_FILE_MANAGEMENT_PROPERTIES_NEMO_PREFERENCES_EXPAND_ROW_ON_DND_DWELL_WIDGET, + NEMO_PREFERENCES_EXPAND_ROW_ON_DND_DWELL); + setup_tooltip_items (builder); connect_tooltip_items (builder);