[nautilus/wip/corey/thumbnail-large: 2/2] thumbnail: Use new glib attributes to get the thumbnails for x/xx large
- From: Corey Berla <coreyberla src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/corey/thumbnail-large: 2/2] thumbnail: Use new glib attributes to get the thumbnails for x/xx large
- Date: Thu, 29 Sep 2022 21:33:10 +0000 (UTC)
commit f6409af73f5c93bb632a4a3b8abce231aeb7acb7
Author: Corey Berla <corey berla me>
Date: Thu Sep 29 14:28:53 2022 -0700
thumbnail: Use new glib attributes to get the thumbnails for x/xx large
When in the introduction of x-large and xx-large thumbnails in
278435e3c20244b48986c6cd8b72c5317668c72d, we no longers retrieved the
thumbnails correctly, because glib/gio was only looking for normal and
large thumbnail paths.
glib!2918 introduces new attributes for x-large and xx-large
thumbnails paths. Produce the correct file attribute depending
on the size thumbnail we are generating.
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2918/
src/nautilus-file.c | 2 +-
src/nautilus-thumbnails.c | 30 ++++++++++++++++++++++++++++++
src/nautilus-thumbnails.h | 7 ++++++-
3 files changed, 37 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 02e8307b0..818b4510f 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -2830,7 +2830,7 @@ update_info_internal (NautilusFile *file,
file->details->icon = g_object_ref (icon);
}
- thumbnail_path = g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH);
+ thumbnail_path = g_file_info_get_attribute_byte_string (info, get_thumbnail_path_attribute ());
if (g_strcmp0 (file->details->thumbnail_path, thumbnail_path) != 0)
{
changed = TRUE;
diff --git a/src/nautilus-thumbnails.c b/src/nautilus-thumbnails.c
index 8515844a7..e40147e1d 100644
--- a/src/nautilus-thumbnails.c
+++ b/src/nautilus-thumbnails.c
@@ -132,6 +132,36 @@ free_thumbnail_info (NautilusThumbnailInfo *info)
g_free (info);
}
+const char*
+get_thumbnail_path_attribute (void)
+{
+ switch (thumbnail_size)
+ {
+ case GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE:
+ {
+ return G_FILE_ATTRIBUTE_THUMBNAIL_PATH_LARGE;
+ }
+ break;
+
+ case GNOME_DESKTOP_THUMBNAIL_SIZE_XLARGE:
+ {
+ return G_FILE_ATTRIBUTE_THUMBNAIL_PATH_XLARGE;
+ }
+ break;
+
+ case GNOME_DESKTOP_THUMBNAIL_SIZE_XXLARGE:
+ {
+ return G_FILE_ATTRIBUTE_THUMBNAIL_PATH_XXLARGE;
+ }
+ break;
+
+ default:
+ {
+ return G_FILE_ATTRIBUTE_THUMBNAIL_PATH;
+ }
+ }
+}
+
static GnomeDesktopThumbnailFactory *
get_thumbnail_factory (void)
{
diff --git a/src/nautilus-thumbnails.h b/src/nautilus-thumbnails.h
index 6babe6848..8ff73360c 100644
--- a/src/nautilus-thumbnails.h
+++ b/src/nautilus-thumbnails.h
@@ -21,7 +21,10 @@
#pragma once
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libgnome-desktop/gnome-desktop-thumbnail.h>
#include "nautilus-file.h"
/* Returns NULL if there's no thumbnail yet. */
@@ -32,4 +35,6 @@ gboolean nautilus_thumbnail_is_mimetype_limited_by_size
/* Queue handling: */
void nautilus_thumbnail_remove_from_queue (const char *file_uri);
-void nautilus_thumbnail_prioritize (const char *file_uri);
\ No newline at end of file
+void nautilus_thumbnail_prioritize (const char *file_uri);
+
+const char* get_thumbnail_path_attribute (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]