diff options
author | Corey Berla <corey@berla.me> | 2022-09-29 14:27:37 -0700 |
---|---|---|
committer | Corey Berla <corey@berla.me> | 2022-09-29 14:27:37 -0700 |
commit | 3d9844af9ab304c9bc8cd1cc6eb03f2348d70c4c (patch) | |
tree | 004316c37d63c13f69b9b81e31dbfd181e249136 | |
parent | 5b3bb868c9a49ee0eb21967dee0a3a3b48ca4975 (diff) | |
download | nautilus-3d9844af9ab304c9bc8cd1cc6eb03f2348d70c4c.tar.gz |
thumbnails: Store the desired thumbnail size
When we create the thumbnail factory, we set a size, let's make sure
we use that same size when we retrieve the thumbnails.
-rw-r--r-- | src/nautilus-thumbnails.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/nautilus-thumbnails.c b/src/nautilus-thumbnails.c index 790b4e36f..8515844a7 100644 --- a/src/nautilus-thumbnails.c +++ b/src/nautilus-thumbnails.c @@ -94,6 +94,8 @@ static GHashTable *thumbnails_to_make_hash = NULL; * to avoid adding it again. Lock thumbnails_mutex when accessing this. */ static NautilusThumbnailInfo *currently_thumbnailing = NULL; +static GnomeDesktopThumbnailSize thumbnail_size = -1; + static gboolean get_file_mtime (const char *file_uri, time_t *mtime) @@ -140,29 +142,31 @@ get_thumbnail_factory (void) GdkDisplay *display = gdk_display_get_default (); GListModel *monitors = gdk_display_get_monitors (display); gint max_scale = 1; - GnomeDesktopThumbnailSize size; - for (guint i = 0; i < g_list_model_get_n_items (monitors); i++) + if (thumbnail_size == -1) { - g_autoptr (GdkMonitor) monitor = g_list_model_get_item (monitors, i); + for (guint i = 0; i < g_list_model_get_n_items (monitors); i++) + { + g_autoptr (GdkMonitor) monitor = g_list_model_get_item (monitors, i); - max_scale = MAX (max_scale, gdk_monitor_get_scale_factor (monitor)); - } + max_scale = MAX (max_scale, gdk_monitor_get_scale_factor (monitor)); + } - if (max_scale <= 1) - { - size = GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE; - } - else if (max_scale <= 2) - { - size = GNOME_DESKTOP_THUMBNAIL_SIZE_XLARGE; - } - else - { - size = GNOME_DESKTOP_THUMBNAIL_SIZE_XXLARGE; + if (max_scale <= 1) + { + thumbnail_size = GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE; + } + else if (max_scale <= 2) + { + thumbnail_size = GNOME_DESKTOP_THUMBNAIL_SIZE_XLARGE; + } + else + { + thumbnail_size = GNOME_DESKTOP_THUMBNAIL_SIZE_XXLARGE; + } } - thumbnail_factory = gnome_desktop_thumbnail_factory_new (size); + thumbnail_factory = gnome_desktop_thumbnail_factory_new (thumbnail_size); } return thumbnail_factory; |