Commit 99ba79ed authored by Theo Linkspfeifer's avatar Theo Linkspfeifer 💬 Committed by Alexander Schwinn
Browse files

Allow drag-and-drop of multiple files in icon view (Bug #2487)



Fixes a bug introduced by commit
9801a67b
which broke multiple file drag-and-drop in icon and compact view and
single-click mode in details-view

Co-authored-by: default avatarReuben Green <reubengreen73@gmail.com>
parent 79149958
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -104,6 +104,8 @@ struct _ThunarAbstractIconViewPrivate
  gulong gesture_expose_id;
  gulong gesture_motion_id;
  gulong gesture_release_id;

  gboolean button_pressed;
};


@@ -492,14 +494,9 @@ thunar_abstract_icon_view_button_press_event (ExoIconView *view,
  gboolean           in_tab;
  const gchar       *action_name;

  if (event->type == GDK_BUTTON_PRESS && event->button == 1)
    {
      /* we don't unselect all other items if Control or Shift is active */
      if ((event->state & GDK_CONTROL_MASK) == 0 && (event->state & GDK_SHIFT_MASK) == 0)
        exo_icon_view_unselect_all (view);
      return FALSE;
    }
  else if (event->type == GDK_BUTTON_PRESS && event->button == 3)
  abstract_icon_view->priv->button_pressed = TRUE;

  if (event->type == GDK_BUTTON_PRESS && event->button == 3)
    {
      /* open the context menu on right clicks */
      if (exo_icon_view_get_item_at_pos (view, event->x, event->y, &path, NULL))
@@ -698,6 +695,8 @@ thunar_abstract_icon_view_key_press_event (ExoIconView *view,
                                           GdkEventKey            *event,
                                           ThunarAbstractIconView *abstract_icon_view)
{
  abstract_icon_view->priv->button_pressed = FALSE;

  /* popup context menu if "Menu" or "<Shift>F10" is pressed */
  if (event->keyval == GDK_KEY_Menu || ((event->state & GDK_SHIFT_MASK) != 0 && event->keyval == GDK_KEY_F10))
    {
@@ -757,6 +756,13 @@ thunar_abstract_icon_view_item_activated (ExoIconView *view,

  _thunar_return_if_fail (THUNAR_IS_ABSTRACT_ICON_VIEW (abstract_icon_view));

  /* be sure to have only the clicked item selected */
  if (abstract_icon_view->priv->button_pressed)
    {
      exo_icon_view_unselect_all (view);
      exo_icon_view_select_path (view, path);
    }

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
  /* emit the "open" action */
  action = thunar_gtk_ui_manager_get_action_by_name (THUNAR_STANDARD_VIEW (abstract_icon_view)->ui_manager, "open");
+16 −0
Original line number Diff line number Diff line
@@ -131,6 +131,9 @@ struct _ThunarDetailsView

  /* the UI manager merge id for the details view */
  guint              ui_merge_id;

  /* whether the most recent item activation used a mouse button press */
  gboolean           button_pressed;
};


@@ -700,6 +703,8 @@ thunar_details_view_button_press_event (GtkTreeView *tree_view,
    {
      GtkTreePath       *cursor_path;

      details_view->button_pressed = TRUE;

      /* grab the tree view */
      gtk_widget_grab_focus (GTK_WIDGET (tree_view));

@@ -819,6 +824,8 @@ thunar_details_view_key_press_event (GtkTreeView *tree_view,
                                     GdkEventKey       *event,
                                     ThunarDetailsView *details_view)
{
  details_view->button_pressed = FALSE;

  /* popup context menu if "Menu" or "<Shift>F10" is pressed */
  if (event->keyval == GDK_KEY_Menu || ((event->state & GDK_SHIFT_MASK) != 0 && event->keyval == GDK_KEY_F10))
    {
@@ -837,10 +844,19 @@ thunar_details_view_row_activated (GtkTreeView *tree_view,
                                   GtkTreeViewColumn *column,
                                   ThunarDetailsView *details_view)
{
  GtkTreeSelection *selection;
  GtkAction        *action;

  _thunar_return_if_fail (THUNAR_IS_DETAILS_VIEW (details_view));

  /* be sure to have only the clicked item selected */
  if (details_view->button_pressed)
    {
      selection = gtk_tree_view_get_selection (tree_view);
      gtk_tree_selection_unselect_all (selection);
      gtk_tree_selection_select_path (selection, path);
    }

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
  /* emit the "open" action */
  action = thunar_gtk_ui_manager_get_action_by_name (THUNAR_STANDARD_VIEW (details_view)->ui_manager, "open");