Skip to content

Commit

Permalink
Add setting to disable auto-expanding of treeview rows during
Browse files Browse the repository at this point in the history
drag-and-drop operations.

This can be frustrating to deal with for folks with accessibility
issues (like this guy).
  • Loading branch information
mtwebster committed Oct 31, 2024
1 parent bc192b6 commit b4f49db
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 8 deletions.
16 changes: 16 additions & 0 deletions gresources/nemo-file-management-properties.glade
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,22 @@ along with . If not, see <http://www.gnu.org/licenses/>.
<property name="position">7</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="expand_row_on_dnd_dwell_checkbutton">
<property name="label" translatable="yes">Automatically expand rows during drag-and-drop</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="use-underline">True</property>
<property name="xalign">0</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">8</property>
</packing>
</child>
</object>
</child>
</object>
Expand Down
1 change: 1 addition & 0 deletions libnemo-private/nemo-global-preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
19 changes: 11 additions & 8 deletions libnemo-private/nemo-tree-view-drag-dest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions libnemo-private/org.nemo.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
<summary>Enables renaming of icons by two times clicking with pause between clicks</summary>
<description>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.</description>
</key>
<key name="expand-row-on-dnd-dwell" type="b">
<default>true</default>
<summary>During drag-and-drop operations, automatically expand rows when hovering them briefly</summary>
</key>
<key name="show-location-entry" type="b">
<default>false</default>
<summary>Show the location entry by default</summary>
Expand Down
5 changes: 5 additions & 0 deletions src/nemo-file-management-properties.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit b4f49db

Please sign in to comment.