diff --git a/.nautilus.metadata b/.nautilus.metadata deleted file mode 100644 index 57a13a4..0000000 --- a/.nautilus.metadata +++ /dev/null @@ -1 +0,0 @@ -f5fb5185ad922f906a22bc0aeae4cc76a243200d SOURCES/nautilus-3.28.1.tar.xz diff --git a/SOURCES/file-utilities-Prevent-passing-NULL-to-g_object_unre.patch b/SOURCES/file-utilities-Prevent-passing-NULL-to-g_object_unre.patch new file mode 100644 index 0000000..3bce483 --- /dev/null +++ b/SOURCES/file-utilities-Prevent-passing-NULL-to-g_object_unre.patch @@ -0,0 +1,42 @@ +From e03d731e3dcb8d0f52ffbc6faa188802b742d1e9 Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Thu, 26 Jan 2023 13:20:51 +0100 +Subject: [PATCH] file-utilities: Prevent passing NULL to g_object_unref + +The `nautilus_find_existing_uri_in_hierarchy` function calls the +`g_object_unref` with a `NULL` pointer when `g_file_query_info` fails. +This leads to a crash e.g. when parent directory of the currently +opened location is removed. Let's port the code to use `g_autoptr` to +avoid that. +--- + src/nautilus-file-utilities.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/nautilus-file-utilities.c b/src/nautilus-file-utilities.c +index e8f1ca2fb..1c913dbad 100644 +--- a/src/nautilus-file-utilities.c ++++ b/src/nautilus-file-utilities.c +@@ -598,7 +598,6 @@ nautilus_generate_unique_file_in_directory (GFile *directory, + GFile * + nautilus_find_existing_uri_in_hierarchy (GFile *location) + { +- GFileInfo *info; + GFile *tmp; + + g_assert (location != NULL); +@@ -606,10 +605,11 @@ nautilus_find_existing_uri_in_hierarchy (GFile *location) + location = g_object_ref (location); + while (location != NULL) + { ++ g_autoptr (GFileInfo) info = NULL; ++ + info = g_file_query_info (location, + G_FILE_ATTRIBUTE_STANDARD_NAME, + 0, NULL, NULL); +- g_object_unref (info); + if (info != NULL) + { + return location; +-- +2.40.0 + diff --git a/SOURCES/pathbar-Do-nothing-when-current-location-disappears.patch b/SOURCES/pathbar-Do-nothing-when-current-location-disappears.patch new file mode 100644 index 0000000..8c79fd3 --- /dev/null +++ b/SOURCES/pathbar-Do-nothing-when-current-location-disappears.patch @@ -0,0 +1,16 @@ +diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c +index 630b8ed33..2fe88fe1d 100644 +--- a/src/nautilus-pathbar.c ++++ b/src/nautilus-pathbar.c +@@ -2033,7 +2033,7 @@ button_data_file_changed (NautilusFile *file, + if (g_file_has_prefix (current_location, location) || + g_file_equal (current_location, location)) + { +- nautilus_path_bar_clear_buttons (self); ++ /* Do nothing here, the view will set new path if needed. */ + } + else if (g_file_has_prefix (location, current_location)) + { +-- +2.40.0 + diff --git a/SOURCES/window-slot-Fix-conditions-to-restore-selection-when.patch b/SOURCES/window-slot-Fix-conditions-to-restore-selection-when.patch new file mode 100644 index 0000000..d902d64 --- /dev/null +++ b/SOURCES/window-slot-Fix-conditions-to-restore-selection-when.patch @@ -0,0 +1,37 @@ +From 87d2f2cfd61baf813aee204be570172b78159281 Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Wed, 14 Jun 2023 12:52:02 +0200 +Subject: [PATCH] window-slot: Fix conditions to restore selection when + reloading + +Currently, the `nautilus_window_slot_force_reload` function doesn't +preserve selection or position. However, there is a code that should do +it. The code is executed only when `new_content_view != NULL`, but it +is based on the `content_view` property. This seems to be a regression +caused by the commit 9806d70e. Let's fix that condition in order to +ensure that the selection and position are restored. +--- + src/nautilus-window-slot.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c +index 2bfb3f3ce..8ceac9562 100644 +--- a/src/nautilus-window-slot.c ++++ b/src/nautilus-window-slot.c +@@ -2376,11 +2376,11 @@ nautilus_window_slot_force_reload (NautilusWindowSlot *self) + g_object_ref (location); + current_pos = NULL; + +- if (priv->new_content_view) ++ if (priv->content_view) + { + selection = nautilus_view_get_selection (priv->content_view); + +- if (NAUTILUS_IS_FILES_VIEW (priv->new_content_view)) ++ if (NAUTILUS_IS_FILES_VIEW (priv->content_view)) + { + current_pos = nautilus_files_view_get_first_visible_file (NAUTILUS_FILES_VIEW (priv->content_view)); + } +-- +2.40.0 + diff --git a/SOURCES/window-slot-Force-reload-current-location-when-it-re.patch b/SOURCES/window-slot-Force-reload-current-location-when-it-re.patch new file mode 100644 index 0000000..8e3780c --- /dev/null +++ b/SOURCES/window-slot-Force-reload-current-location-when-it-re.patch @@ -0,0 +1,43 @@ +From f68481d2d8393f1ba1a9b0a86a1b28b6ac303a63 Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Wed, 24 May 2023 13:09:35 +0200 +Subject: [PATCH] window-slot: Force reload current location when it reappears + +When the currently opened location disappears, nautilus tries to +reopen it thanks to the commit b0e28bc1. However, the +`nautilus_window_slot_open_location_full` function doesn't begin the +location change when the old location is the same as the new one. This +is a problem because the old `NautilusFile` object is marked as gone +and thus monitoring and perhaps some other stuff won't work. Let's use +the `nautilus_window_slot_force_reload` function instead, in this case, +to ensure that the underlying `NautilusFile` is updated. +--- + src/nautilus-window-slot.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c +index 811152a21..561b34f12 100644 +--- a/src/nautilus-window-slot.c ++++ b/src/nautilus-window-slot.c +@@ -1458,7 +1458,17 @@ viewed_file_changed_callback (NautilusFile *file, + go_to_file = g_file_new_for_path (g_get_home_dir ()); + } + +- nautilus_window_slot_open_location_full (self, go_to_file, 0, NULL); ++ if (g_file_equal (location, go_to_file)) ++ { ++ /* Path gone by time out may have been remounted by ++ * `nautilus_find_existing_uri_in_hierarchy()`. ++ */ ++ nautilus_window_slot_force_reload (self); ++ } ++ else ++ { ++ nautilus_window_slot_open_location_full (self, go_to_file, 0, NULL); ++ } + + g_object_unref (go_to_file); + g_object_unref (location); +-- +2.40.0 + diff --git a/SOURCES/window-slot-Try-current-location-even-if-it-is-marke.patch b/SOURCES/window-slot-Try-current-location-even-if-it-is-marke.patch new file mode 100644 index 0000000..768afdd --- /dev/null +++ b/SOURCES/window-slot-Try-current-location-even-if-it-is-marke.patch @@ -0,0 +1,72 @@ +From b0e28bc19c065b4bc1d6fdea922ae2c09115b0e6 Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +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 + diff --git a/SPECS/nautilus.spec b/SPECS/nautilus.spec index 5d868e7..c83312b 100644 --- a/SPECS/nautilus.spec +++ b/SPECS/nautilus.spec @@ -8,7 +8,7 @@ Name: nautilus Version: 3.28.1 -Release: 23%{?dist} +Release: 25%{?dist} Summary: File manager for GNOME License: GPLv3+ @@ -89,6 +89,13 @@ 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 +Patch46: window-slot-Force-reload-current-location-when-it-re.patch +Patch47: pathbar-Do-nothing-when-current-location-disappears.patch +Patch48: file-utilities-Prevent-passing-NULL-to-g_object_unre.patch +Patch49: window-slot-Fix-conditions-to-restore-selection-when.patch + BuildRequires: gtk-doc BuildRequires: meson BuildRequires: gcc @@ -201,6 +208,12 @@ desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/*.desktop %{_datadir}/gir-1.0/*.gir %changelog +* Wed Jun 14 2023 Ondrej Holy - 3.28.1-25 +- Force reload current location when it reappears (#2100426) + +* Wed Apr 05 2023 Ondrej Holy - 3.28.1-24 +- Try current location even if it is marked as gone (#2100426) + * Thu Feb 23 2023 Ondrej Holy - 3.28.1-23 - Try to own the name until after exporting skeleton (#2150894)