parent
0c80c5f851
commit
28084ce225
@ -0,0 +1,76 @@
|
||||
From 755cfdce38312dfc6572839a6fdbb1b39e1b4fe6 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Holy <oholy@redhat.com>
|
||||
Date: Wed, 7 Dec 2022 08:51:51 +0100
|
||||
Subject: [PATCH] file: Generate thumbnails when the preview icon is available
|
||||
|
||||
Currently, thumbnails are not shown for MTP/GPhoto2 locations. The
|
||||
backends return `G_FILESYSTEM_PREVIEW_TYPE_NEVER` in order to prevent
|
||||
thumbnailers to make them unresponsive. However, the backends provide
|
||||
preview icons for some file types and the `GnomeDesktopThumbnailFactory`
|
||||
is smart enough not to invoke thumbnailers if the icon is available
|
||||
(see https://bugzilla.gnome.org/show_bug.cgi?id=738503). Let's allow
|
||||
the thumbnail generation from the preview icons if they are available.
|
||||
This should not affect backend responsiveness much.
|
||||
|
||||
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1921
|
||||
---
|
||||
src/nautilus-file-private.h | 3 ++-
|
||||
src/nautilus-file.c | 14 ++++++++++++++
|
||||
2 files changed, 16 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/nautilus-file-private.h b/src/nautilus-file-private.h
|
||||
index d5d26c8b3..e9d49530c 100644
|
||||
--- a/src/nautilus-file-private.h
|
||||
+++ b/src/nautilus-file-private.h
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <eel/eel-glib-extensions.h>
|
||||
|
||||
#define NAUTILUS_FILE_DEFAULT_ATTRIBUTES \
|
||||
- "standard::*,access::*,mountable::*,time::*,unix::*,owner::*,selinux::*,thumbnail::*,id::filesystem,trash::orig-path,trash::deletion-date,metadata::*,recent::*"
|
||||
+ "standard::*,access::*,mountable::*,time::*,unix::*,owner::*,selinux::*,thumbnail::*,id::filesystem,trash::orig-path,trash::deletion-date,metadata::*,recent::*,preview::icon"
|
||||
|
||||
/* These are in the typical sort order. Known things come first, then
|
||||
* things where we can't know, finally things where we don't yet know.
|
||||
@@ -185,6 +185,7 @@ struct NautilusFileDetails
|
||||
eel_boolean_bit start_stop_type : 3; /* GDriveStartStopType */
|
||||
eel_boolean_bit can_poll_for_media : 1;
|
||||
eel_boolean_bit is_media_check_automatic : 1;
|
||||
+ eel_boolean_bit has_preview_icon : 1;
|
||||
|
||||
eel_boolean_bit filesystem_readonly : 1;
|
||||
eel_boolean_bit filesystem_use_preview : 2; /* GFilesystemPreviewType */
|
||||
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
|
||||
index 2999f2fa5..d9d988ccd 100644
|
||||
--- a/src/nautilus-file.c
|
||||
+++ b/src/nautilus-file.c
|
||||
@@ -2914,6 +2914,11 @@ update_info_internal (NautilusFile *file,
|
||||
file->details->trash_orig_path = g_strdup (trash_orig_path);
|
||||
}
|
||||
|
||||
+ if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_PREVIEW_ICON))
|
||||
+ {
|
||||
+ file->details->has_preview_icon = TRUE;
|
||||
+ }
|
||||
+
|
||||
changed |=
|
||||
nautilus_file_update_metadata_from_info (file, info);
|
||||
|
||||
@@ -4836,6 +4841,15 @@ nautilus_file_should_show_thumbnail (NautilusFile *file)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+ if (show_file_thumbs != NAUTILUS_SPEED_TRADEOFF_NEVER &&
|
||||
+ file->details->has_preview_icon)
|
||||
+ {
|
||||
+ /* The thumbnail should be generated if the preview icon is available
|
||||
+ * regardless of the filesystem type (i.e. for MTP/GPhoto2 backends).
|
||||
+ */
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+
|
||||
return get_speed_tradeoff_preference_for_file (file, show_file_thumbs);
|
||||
}
|
||||
|
||||
--
|
||||
2.39.2
|
||||
|
@ -0,0 +1,42 @@
|
||||
From e03d731e3dcb8d0f52ffbc6faa188802b742d1e9 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Holy <oholy@redhat.com>
|
||||
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
|
||||
|
@ -0,0 +1,59 @@
|
||||
From 151af5733a11dc4aceb8ecf4c9eeafcaab188451 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Holy <oholy@redhat.com>
|
||||
Date: Fri, 27 Jan 2023 11:02:22 +0100
|
||||
Subject: [PATCH] pathbar: Do nothing when current location disappears
|
||||
|
||||
The pathbar automatically clear all the buttons when the current location
|
||||
is marked as gone. This was needed earlier, when child folders where shown
|
||||
in some cases, but this is no more needed nowadays. Let's drop that code.
|
||||
---
|
||||
src/nautilus-pathbar.c | 33 +--------------------------------
|
||||
1 file changed, 1 insertion(+), 32 deletions(-)
|
||||
|
||||
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
|
||||
index edc0fff56..4bd9ff5b2 100644
|
||||
--- a/src/nautilus-pathbar.c
|
||||
+++ b/src/nautilus-pathbar.c
|
||||
@@ -1445,38 +1445,7 @@ button_data_file_changed (NautilusFile *file,
|
||||
}
|
||||
else if (nautilus_file_is_gone (file))
|
||||
{
|
||||
- gint idx, position;
|
||||
-
|
||||
- /* if the current or a parent location are gone, clear all the buttons,
|
||||
- * the view will set the new path.
|
||||
- */
|
||||
- current_location = nautilus_file_get_location (current_button_data->file);
|
||||
-
|
||||
- if (g_file_has_prefix (current_location, location) ||
|
||||
- g_file_equal (current_location, location))
|
||||
- {
|
||||
- nautilus_path_bar_clear_buttons (self);
|
||||
- }
|
||||
- else if (g_file_has_prefix (location, current_location))
|
||||
- {
|
||||
- /* remove this and the following buttons */
|
||||
- position = g_list_position (self->button_list,
|
||||
- g_list_find (self->button_list, button_data));
|
||||
-
|
||||
- if (position != -1)
|
||||
- {
|
||||
- for (idx = 0; idx <= position; idx++)
|
||||
- {
|
||||
- ButtonData *data;
|
||||
-
|
||||
- data = BUTTON_DATA (self->button_list->data);
|
||||
-
|
||||
- gtk_container_remove (GTK_CONTAINER (self), data->button);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- g_object_unref (current_location);
|
||||
+ /* Do nothing here, the view will set new path if needed. */
|
||||
g_object_unref (location);
|
||||
return;
|
||||
}
|
||||
--
|
||||
2.40.0
|
||||
|
@ -0,0 +1,37 @@
|
||||
From 87d2f2cfd61baf813aee204be570172b78159281 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Holy <oholy@redhat.com>
|
||||
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
|
||||
|
@ -0,0 +1,43 @@
|
||||
From f68481d2d8393f1ba1a9b0a86a1b28b6ac303a63 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Holy <oholy@redhat.com>
|
||||
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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in new issue