summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Berla <corey@berla.me>2023-04-22 20:43:10 +0000
committerAntónio Fernandes <antoniof@gnome.org>2023-04-22 20:43:10 +0000
commitf1bb8e43010f7eadec10e95f773333749615f72b (patch)
tree480dd91baf159db548d43d59e50635932cfce135
parentb68219157ab9c5e9b67ae0d949f791e8de7b8944 (diff)
downloadnautilus-f1bb8e43010f7eadec10e95f773333749615f72b.tar.gz
Revert "files-view: Focus view items directly"
This reverts commit 9ecd422cc78efad939d072e61c13e1c3a7726fc9. Its commit message is misleading. Maybe it had such a side effect, but the issue it fixed was actually a GTK bug which got fixed in the meantime: https://gitlab.gnome.org/GNOME/gtk/-/commit/8455b9ac74d5337429a1a14eb> Also, reverting it fixes a new bug: the first item is selected when the item which was selected has been deleted. Next item should be selected instead.
-rw-r--r--src/nautilus-files-view.c42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 2d7ae526b..c022386b2 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -3217,47 +3217,6 @@ slot_active_changed (NautilusWindowSlot *slot,
}
static gboolean
-nautilus_files_view_focus (GtkWidget *widget,
- GtkDirectionType direction)
-{
- NautilusFilesView *view;
- NautilusFilesViewPrivate *priv;
- GtkWidget *focus;
- GtkWidget *main_child;
-
- view = NAUTILUS_FILES_VIEW (widget);
- priv = nautilus_files_view_get_instance_private (view);
- focus = gtk_window_get_focus (GTK_WINDOW (gtk_widget_get_root (widget)));
-
- /* In general, we want to forward focus movement to the main child. However,
- * we must chain up for default focus handling in case the focus in in any
- * other child, e.g. a popover. */
- if (focus != NULL &&
- gtk_widget_is_ancestor (focus, widget) &&
- !gtk_widget_is_ancestor (focus, priv->scrolled_window))
- {
- if (GTK_WIDGET_CLASS (nautilus_files_view_parent_class)->focus (widget, direction))
- {
- return TRUE;
- }
- else
- {
- /* The default handler returns FALSE if a popover has just been
- * closed, because it moves the focus forward. But we want to move
- * focus back into the view's main child. So, fall through. */
- }
- }
-
- main_child = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (priv->scrolled_window));
- if (main_child != NULL)
- {
- return gtk_widget_child_focus (main_child, direction);
- }
-
- return FALSE;
-}
-
-static gboolean
nautilus_files_view_grab_focus (GtkWidget *widget)
{
/* focus the child of the scrolled window if it exists */
@@ -9522,7 +9481,6 @@ nautilus_files_view_class_init (NautilusFilesViewClass *klass)
oclass->get_property = nautilus_files_view_get_property;
oclass->set_property = nautilus_files_view_set_property;
- widget_class->focus = nautilus_files_view_focus;
widget_class->grab_focus = nautilus_files_view_grab_focus;