[nautilus: 1/3] list-view: Allow right clicking expanders



commit e3c01df382ac41ed4657463b9d4d60a7e7dff4a3
Author: Alexandru Fazakas <alex fazakas97 yahoo com>
Date:   Tue Mar 20 20:24:19 2018 +0200

    list-view: Allow right clicking expanders
    
    Right now, right clicking an expander opens the context menu
    without changing the selection.
    
    This resulted in the context menu affecting other items than the
    clicked one, which is counterintuitive and should not happen.
    
    We fix this by isolating the case where an expander was clicked
    and we change the selection to the clicked row.
    
    Closes https://gitlab.gnone.org/GNOME/nautilus/issues/286

 src/nautilus-list-view.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index c69f14394..30308aded 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -678,17 +678,26 @@ button_press_callback (GtkWidget      *widget,
     }
     else
     {
-        /* We're going to filter out some situations where
-         * we can't let the default code run because all
-         * but one row would be would be deselected. We don't
-         * want that; we want the right click menu or single
-         * click to apply to everything that's currently selected.
-         */
-        if (event->button == GDK_BUTTON_SECONDARY && path_selected)
+        if (event->button == GDK_BUTTON_SECONDARY)
         {
-            call_parent = FALSE;
+            if (path_selected)
+            {
+                /* We're going to filter out some situations where
+                 * we can't let the default code run because all
+                 * but one row would be would be deselected. We don't
+                 * want that; we want the right click menu or single
+                 * click to apply to everything that's currently selected.
+                 */
+                call_parent = FALSE;
+            }
+            else if (on_expander)
+            {
+                /* If the right click happened on an expander, we should
+                 * fully change the selection on that row solely.
+                 */
+                gtk_tree_view_set_cursor (tree_view, path, NULL, FALSE);
+            }
         }
-
         if ((event->button == GDK_BUTTON_PRIMARY || event->button == GDK_BUTTON_MIDDLE) &&
             ((event->state & GDK_CONTROL_MASK) != 0 || (event->state & GDK_SHIFT_MASK) == 0))
         {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]