Try current location even if it is marked as gone

Resolves: rhbz#2100426
This commit is contained in:
Ondrej Holy 2023-04-05 13:27:39 +02:00
parent d431d2fdba
commit fdf4938190
2 changed files with 79 additions and 1 deletions

View File

@ -8,7 +8,7 @@
Name: nautilus
Version: 3.28.1
Release: 23%{?dist}
Release: 24%{?dist}
Summary: File manager for GNOME
License: GPLv3+
@ -89,6 +89,9 @@ Patch42: Revert-application-add-common-startup-code.patch
Patch43: application-Export-FileManager1-iface-from-dbus_regi.patch
Patch44: freedesktop-dbus-Try-to-own-the-name-until-after-exp.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2100426
Patch45: window-slot-Try-current-location-even-if-it-is-marke.patch
BuildRequires: gtk-doc
BuildRequires: meson
BuildRequires: gcc
@ -201,6 +204,9 @@ desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/*.desktop
%{_datadir}/gir-1.0/*.gir
%changelog
* Wed Apr 05 2023 Ondrej Holy <oholy@redhat.com> - 3.28.1-24
- Try current location even if it is marked as gone (#2100426)
* Thu Feb 23 2023 Ondrej Holy <oholy@redhat.com> - 3.28.1-23
- Try to own the name until after exporting skeleton (#2150894)

View File

@ -0,0 +1,72 @@
From b0e28bc19c065b4bc1d6fdea922ae2c09115b0e6 Mon Sep 17 00:00:00 2001
From: Ondrej Holy <oholy@redhat.com>
Date: Tue, 24 Jan 2023 12:13:15 +0100
Subject: [PATCH] window-slot: Try current location even if it is marked as
gone
When the current location is marked as gone, Nautilus jumps to the
first existing parent currently (except for non-native locations and
mount roots). This is fine in most cases, but not for autofs locations
as Nautilus jumps to parent everytime autofs mount timeouted. It would
be better to stay in the same folder in this case. Let's try the current
location first even if it is marked as gone to ensure that. It would be
perhaps even better to prevent autofs locations somehow from timeouting
at all, or avoid immediate remounting at least, but those solutions
don't look easy to implement.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1514
---
src/nautilus-window-slot.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index c06dc3432..a1af61887 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -1442,11 +1442,10 @@ viewed_file_changed_callback (NautilusFile *file,
if (priv->viewed_file_seen)
{
GFile *go_to_file;
- GFile *parent;
GFile *location;
GMount *mount;
+ gboolean find_existing = FALSE;
- parent = NULL;
location = nautilus_file_get_location (file);
if (g_file_is_native (location))
@@ -1455,16 +1454,18 @@ viewed_file_changed_callback (NautilusFile *file,
if (mount == NULL)
{
- parent = g_file_get_parent (location);
+ find_existing = TRUE;
}
g_clear_object (&mount);
}
- if (parent != NULL)
+ if (find_existing)
{
- /* auto-show existing parent */
- go_to_file = nautilus_find_existing_uri_in_hierarchy (parent);
+ /* Verify also the current location to prevent jumps to parent
+ * in case of autofs.
+ */
+ go_to_file = nautilus_find_existing_uri_in_hierarchy (location);
}
else
{
@@ -1473,7 +1474,6 @@ viewed_file_changed_callback (NautilusFile *file,
nautilus_window_slot_open_location_full (self, go_to_file, 0, NULL);
- g_clear_object (&parent);
g_object_unref (go_to_file);
g_object_unref (location);
}
--
2.39.2