Skip to content

Commit b4f49db

Browse files
committed
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).
1 parent bc192b6 commit b4f49db

5 files changed

+37
-8
lines changed

gresources/nemo-file-management-properties.glade

+16
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,22 @@ along with . If not, see <http://www.gnu.org/licenses/>.
11861186
<property name="position">7</property>
11871187
</packing>
11881188
</child>
1189+
<child>
1190+
<object class="GtkCheckButton" id="expand_row_on_dnd_dwell_checkbutton">
1191+
<property name="label" translatable="yes">Automatically expand rows during drag-and-drop</property>
1192+
<property name="visible">True</property>
1193+
<property name="can-focus">True</property>
1194+
<property name="receives-default">False</property>
1195+
<property name="use-underline">True</property>
1196+
<property name="xalign">0</property>
1197+
<property name="draw-indicator">True</property>
1198+
</object>
1199+
<packing>
1200+
<property name="expand">False</property>
1201+
<property name="fill">False</property>
1202+
<property name="position">8</property>
1203+
</packing>
1204+
</child>
11891205
</object>
11901206
</child>
11911207
</object>

libnemo-private/nemo-global-preferences.h

+1
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ typedef enum
269269
#define NEMO_PREFERENCES_NEVER_QUEUE_FILE_OPS "never-queue-file-ops"
270270

271271
#define NEMO_PREFERENCES_CLICK_DOUBLE_PARENT_FOLDER "click-double-parent-folder"
272+
#define NEMO_PREFERENCES_EXPAND_ROW_ON_DND_DWELL "expand-row-on-dnd-dwell"
272273

273274
#define NEMO_PREFERENCES_SHOW_MIME_MAKE_EXECUTABLE "enable-mime-actions-make-executable"
274275
#define NEMO_PREFERENCES_DEFERRED_ATTR_PRELOAD_LIMIT "deferred-attribute-preload-limit"

libnemo-private/nemo-tree-view-drag-dest.c

+11-8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
#include "nemo-file-dnd.h"
3636
#include "nemo-file-changes-queue.h"
37+
#include "nemo-global-preferences.h"
3738
#include "nemo-icon-dnd.h"
3839
#include "nemo-link.h"
3940

@@ -522,14 +523,16 @@ drag_motion_callback (GtkWidget *widget,
522523
gtk_tree_path_compare (old_drop_path, drop_path) != 0)) {
523524
remove_expand_timeout (dest);
524525
}
525-
if (dest->details->expand_id == 0 && drop_path != NULL) {
526-
gtk_tree_model_get_iter (model, &drop_iter, drop_path);
527-
if (gtk_tree_model_iter_has_child (model, &drop_iter)) {
528-
dest->details->expand_id = g_timeout_add_seconds (HOVER_EXPAND_TIMEOUT,
529-
expand_timeout,
530-
dest);
531-
}
532-
}
526+
if (g_settings_get_boolean (nemo_preferences, NEMO_PREFERENCES_EXPAND_ROW_ON_DND_DWELL)) {
527+
if (dest->details->expand_id == 0 && drop_path != NULL) {
528+
gtk_tree_model_get_iter (model, &drop_iter, drop_path);
529+
if (gtk_tree_model_iter_has_child (model, &drop_iter)) {
530+
dest->details->expand_id = g_timeout_add_seconds (HOVER_EXPAND_TIMEOUT,
531+
expand_timeout,
532+
dest);
533+
}
534+
}
535+
}
533536
} else {
534537
clear_drag_dest_row (dest);
535538
remove_expand_timeout (dest);

libnemo-private/org.nemo.gschema.xml

+4
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@
9797
<summary>Enables renaming of icons by two times clicking with pause between clicks</summary>
9898
<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>
9999
</key>
100+
<key name="expand-row-on-dnd-dwell" type="b">
101+
<default>true</default>
102+
<summary>During drag-and-drop operations, automatically expand rows when hovering them briefly</summary>
103+
</key>
100104
<key name="show-location-entry" type="b">
101105
<default>false</default>
102106
<summary>Show the location entry by default</summary>

src/nemo-file-management-properties.c

+5
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114

115115
#define NEMO_FILE_MANAGEMENT_PROPERTIES_NEMO_PREFERENCES_SKIP_FILE_OP_QUEUE_WIDGET "skip_file_op_queue_checkbutton"
116116
#define NEMO_FILE_MANAGEMENT_PROPERTIES_NEMO_PREFERENCES_CLICK_DBL_PARENT_FOLDER_WIDGET "click_double_parent_folder_checkbutton"
117+
#define NEMO_FILE_MANAGEMENT_PROPERTIES_NEMO_PREFERENCES_EXPAND_ROW_ON_DND_DWELL_WIDGET "expand_row_on_dnd_dwell_checkbutton"
117118

118119
/* int enums */
119120
#define NEMO_FILE_MANAGEMENT_PROPERTIES_THUMBNAIL_LIMIT_WIDGET "preview_image_size_combobox"
@@ -1100,6 +1101,10 @@ nemo_file_management_properties_dialog_setup (GtkBuilder *builder,
11001101
NEMO_FILE_MANAGEMENT_PROPERTIES_NEMO_PREFERENCES_CLICK_DBL_PARENT_FOLDER_WIDGET,
11011102
NEMO_PREFERENCES_CLICK_DOUBLE_PARENT_FOLDER);
11021103

1104+
bind_builder_bool (builder, nemo_preferences,
1105+
NEMO_FILE_MANAGEMENT_PROPERTIES_NEMO_PREFERENCES_EXPAND_ROW_ON_DND_DWELL_WIDGET,
1106+
NEMO_PREFERENCES_EXPAND_ROW_ON_DND_DWELL);
1107+
11031108
setup_tooltip_items (builder);
11041109
connect_tooltip_items (builder);
11051110

0 commit comments

Comments
 (0)