[Xfce4-commits] [xfce/thunar] 01/01: Revert "Allow opening of multiple file selections (bug #2487)", because it introduced a regression (Not possible any more to DnD multiple files in icon/compact view)

noreply at xfce.org noreply at xfce.org
Wed Mar 25 16:18:24 CET 2020


This is an automated email from the git hooks/post-receive script.

a   l   e   x       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       x   f   c   e   -   4   .   1   4   
   in repository xfce/thunar.

commit 1b66c2a9ac4b21fb2386df88415eec5031fa9c36
Author: Alexander Schwinn <alexxcons at xfce.org>
Date:   Wed Mar 25 16:05:11 2020 +0100

    Revert "Allow opening of multiple file selections (bug #2487)", because
    it introduced a regression (Not possible any more to DnD multiple files
    in icon/compact view)
    
    This reverts commit 8811c73487a12c42c9cb52c30c4fe870ed7265ea and
    5e58fd17f88476c9ad341e2236c5aead7e1444cd
---
 thunar/thunar-abstract-icon-view.c | 36 +++++-----------------------------
 thunar/thunar-details-view.c       | 40 +++++---------------------------------
 2 files changed, 10 insertions(+), 66 deletions(-)

diff --git a/thunar/thunar-abstract-icon-view.c b/thunar/thunar-abstract-icon-view.c
index f8c9c35..91ee300 100644
--- a/thunar/thunar-abstract-icon-view.c
+++ b/thunar/thunar-abstract-icon-view.c
@@ -85,8 +85,6 @@ static gboolean     thunar_abstract_icon_view_motion_notify_event   (ExoIconView
 static void         thunar_abstract_icon_view_item_activated        (ExoIconView                  *view,
                                                                      GtkTreePath                  *path,
                                                                      ThunarAbstractIconView       *abstract_icon_view);
-static gboolean     thunar_abstract_icon_view_activate_cursor_item  (ExoIconView                  *view,
-                                                                     ThunarAbstractIconView       *abstract_icon_view);
 static void         thunar_abstract_icon_view_sort_column_changed   (GtkTreeSortable              *sortable,
                                                                      ThunarAbstractIconView       *abstract_icon_view);
 static void         thunar_abstract_icon_view_zoom_level_changed    (ThunarAbstractIconView       *abstract_icon_view);
@@ -204,8 +202,6 @@ thunar_abstract_icon_view_init (ThunarAbstractIconView *abstract_icon_view)
   g_signal_connect (G_OBJECT (view), "button-press-event", G_CALLBACK (thunar_abstract_icon_view_button_press_event), abstract_icon_view);
   g_signal_connect (G_OBJECT (view), "key-press-event", G_CALLBACK (thunar_abstract_icon_view_key_press_event), abstract_icon_view);
   g_signal_connect (G_OBJECT (view), "item-activated", G_CALLBACK (thunar_abstract_icon_view_item_activated), abstract_icon_view);
-  g_signal_connect (G_OBJECT (view), "activate-cursor-item", G_CALLBACK (thunar_abstract_icon_view_activate_cursor_item),
-                    abstract_icon_view);
   g_signal_connect_swapped (G_OBJECT (view), "selection-changed", G_CALLBACK (thunar_standard_view_selection_changed), abstract_icon_view);
   gtk_container_add (GTK_CONTAINER (abstract_icon_view), view);
   gtk_widget_show (view);
@@ -496,14 +492,7 @@ 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)
+  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))
@@ -761,6 +750,10 @@ 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 double clicked item selected */
+  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");
@@ -771,25 +764,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
 
 
 
-static gboolean
-thunar_abstract_icon_view_activate_cursor_item (ExoIconView            *view,
-                                                ThunarAbstractIconView *abstract_icon_view)
-{
-  GList *selected_items;
-
-  _thunar_return_val_if_fail (EXO_IS_ICON_VIEW (view), FALSE);
-  _thunar_return_val_if_fail (THUNAR_IS_ABSTRACT_ICON_VIEW (abstract_icon_view), FALSE);
-
-  /* ensure that the cursor in the exo_icon_view so that any selected items do get activated */
-  selected_items = thunar_abstract_icon_view_get_selected_items (THUNAR_STANDARD_VIEW (abstract_icon_view));
-  if(selected_items != NULL)
-    exo_icon_view_set_cursor (view,selected_items->data, NULL, FALSE);
-
-  return TRUE;
-}
-
-
-
 static void
 thunar_abstract_icon_view_sort_column_changed (GtkTreeSortable        *sortable,
                                                ThunarAbstractIconView *abstract_icon_view)
diff --git a/thunar/thunar-details-view.c b/thunar/thunar-details-view.c
index 9967b09..9409663 100644
--- a/thunar/thunar-details-view.c
+++ b/thunar/thunar-details-view.c
@@ -93,9 +93,6 @@ static void         thunar_details_view_row_activated           (GtkTreeView
                                                                  GtkTreePath            *path,
                                                                  GtkTreeViewColumn      *column,
                                                                  ThunarDetailsView      *details_view);
-static gboolean     thunar_details_view_select_cursor_row       (GtkTreeView            *tree_view,
-                                                                 gboolean                editing,
-                                                                 ThunarDetailsView      *details_view);
 static void         thunar_details_view_row_changed             (GtkTreeView            *tree_view,
                                                                  GtkTreePath            *path,
                                                                  GtkTreeViewColumn      *column,
@@ -224,8 +221,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
                     G_CALLBACK (thunar_details_view_key_press_event), details_view);
   g_signal_connect (G_OBJECT (tree_view), "row-activated",
                     G_CALLBACK (thunar_details_view_row_activated), details_view);
-  g_signal_connect (G_OBJECT (tree_view), "select-cursor-row",
-                    G_CALLBACK (thunar_details_view_select_cursor_row), details_view);
   gtk_container_add (GTK_CONTAINER (details_view), tree_view);
   gtk_widget_show (tree_view);
 
@@ -837,38 +832,15 @@ 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));
 
-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");
-  if (G_LIKELY (action != NULL))
-    gtk_action_activate (action);
-G_GNUC_END_IGNORE_DEPRECATIONS
-}
-
-
-
-static gboolean
-thunar_details_view_select_cursor_row (GtkTreeView            *tree_view,
-                                       gboolean                editing,
-                                       ThunarDetailsView      *details_view)
-{
-  /* This function is a work-around to fix bug #2487. The default gtk handler for
-   * the "select-cursor-row" signal changes the selection to just the cursor row,
-   * which prevents multiple file selections being opened. Thus we bypass the gtk
-   * signal handler with g_signal_stop_emission_by_name, and emit the "open" action
-   * directly. A better long-term solution would be to fix exo to avoid using the
-   * default gtk signal handler there.
-   */
-
-  GtkAction        *action;
-
-  _thunar_return_val_if_fail (THUNAR_IS_DETAILS_VIEW (details_view), FALSE);
-
-  g_signal_stop_emission_by_name(tree_view,"select-cursor-row");
+  /* be sure to have only the double clicked item selected */
+  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 */
@@ -876,8 +848,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   if (G_LIKELY (action != NULL))
     gtk_action_activate (action);
 G_GNUC_END_IGNORE_DEPRECATIONS
-
-  return TRUE;
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list