summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Fazakas <alex.fazakas97@yahoo.com>2018-03-20 20:24:19 +0200
committerAlexandru Fazakas <alex.fazakas97@yahoo.com>2018-03-21 23:56:22 +0200
commite3c01df382ac41ed4657463b9d4d60a7e7dff4a3 (patch)
tree21f5a41b2d456dab59c75e8e77b80d2378d4c992
parent9c9eba547b8a54eac606dadd2b4b8bf10581ac5e (diff)
downloadnautilus-e3c01df382ac41ed4657463b9d4d60a7e7dff4a3.tar.gz
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
-rw-r--r--src/nautilus-list-view.c27
1 files 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))
{