[Xfce4-commits] [xfce/thunar] 01/01: Prevent new bookmarks on sidebar when dragging files (Bug #14921)
noreply at xfce.org
noreply at xfce.org
Tue Jun 18 01:51:18 CEST 2019
This is an automated email from the git hooks/post-receive script.
a n d r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/thunar.
commit 40a7dfb607b57e038b638c99985ab6eadbd73efa
Author: Andre Miranda <andreldm at xfce.org>
Date: Mon Jun 17 20:49:46 2019 -0300
Prevent new bookmarks on sidebar when dragging files (Bug #14921)
---
thunar/thunar-shortcuts-view.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/thunar/thunar-shortcuts-view.c b/thunar/thunar-shortcuts-view.c
index 5faabf9..c5d749c 100644
--- a/thunar/thunar-shortcuts-view.c
+++ b/thunar/thunar-shortcuts-view.c
@@ -837,6 +837,11 @@ thunar_shortcuts_view_drag_motion (GtkWidget *widget,
gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (view), path, position);
gtk_tree_path_free (path);
}
+ else
+ {
+ /* remove highlight */
+ gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (view), NULL, position);
+ }
/* tell Gdk whether we can drop here */
gdk_drag_status (context, action, timestamp);
@@ -1439,6 +1444,8 @@ thunar_shortcuts_view_compute_drop_actions (ThunarShortcutsView *view,
GtkTreeIter iter;
ThunarFile *file;
gint cell_y;
+ GList *lp;
+ guint n;
/* determine the shortcuts model */
model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
@@ -1481,6 +1488,30 @@ thunar_shortcuts_view_compute_drop_actions (ThunarShortcutsView *view,
/* check if we cannot drop into the shortcut */
if (G_UNLIKELY (actions == 0))
{
+ /* check if any of the paths is not directory but only up to 100, if
+ * someone drags too many directories it may slowdown or even freeze
+ * Thunar while moving the cursor.
+ */
+ for (lp = view->drop_file_list, n = 0; lp != NULL && n < 100; lp = lp->next, ++n)
+ {
+ GFileInfo *info;
+ gboolean is_directory;
+
+ info = g_file_query_info (lp->data,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ G_FILE_QUERY_INFO_NONE,
+ NULL, NULL);
+
+ if (G_UNLIKELY (info == NULL))
+ return 0;
+
+ is_directory = g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY;
+ g_object_unref (info);
+
+ if (!is_directory)
+ return 0;
+ }
+
/* check the action that should be performed */
if (gdk_drag_context_get_suggested_action (context) == GDK_ACTION_LINK || (gdk_drag_context_get_actions (context) & GDK_ACTION_LINK) != 0)
actions = GDK_ACTION_LINK;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list