summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-file.c22
-rw-r--r--libcaja-private/caja-global-preferences.h1
-rw-r--r--libcaja-private/org.mate.caja.gschema.xml5
3 files changed, 28 insertions, 0 deletions
diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c
index c2a463a6..032a4d06 100644
--- a/libcaja-private/caja-file.c
+++ b/libcaja-private/caja-file.c
@@ -4338,6 +4338,7 @@ get_custom_icon (CajaFile *file)
}
static guint64 cached_thumbnail_limit;
+static guint64 cached_thumbnail_directory_limit;
int cached_thumbnail_size;
static int show_image_thumbs;
@@ -4366,6 +4367,12 @@ caja_file_should_show_thumbnail (CajaFile *file)
use_preview = caja_file_get_filesystem_use_preview (file);
+ if (file->details->directory != NULL &&
+ file->details->directory->details->confirmed_file_count > 0 &&
+ (guint64) file->details->directory->details->confirmed_file_count > cached_thumbnail_directory_limit) {
+ return FALSE;
+ }
+
mime_type = file->details->mime_type;
if (mime_type == NULL) {
mime_type = "application/octet-stream";
@@ -8535,6 +8542,16 @@ thumbnail_limit_changed_callback (gpointer user_data)
}
static void
+thumbnail_directory_limit_changed_callback (gpointer user_data)
+{
+ g_settings_get (caja_preferences,
+ CAJA_PREFERENCES_IMAGE_FILE_THUMBNAIL_DIRECTORY_LIMIT,
+ "t", &cached_thumbnail_directory_limit);
+
+ emit_change_signals_for_all_files_in_all_directories ();
+}
+
+static void
thumbnail_size_changed_callback (gpointer user_data)
{
cached_thumbnail_size = g_settings_get_int (caja_icon_view_preferences, CAJA_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE);
@@ -8655,6 +8672,11 @@ caja_file_class_init (CajaFileClass *class)
"changed::" CAJA_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT,
G_CALLBACK (thumbnail_limit_changed_callback),
NULL);
+ thumbnail_directory_limit_changed_callback (NULL);
+ g_signal_connect_swapped (caja_preferences,
+ "changed::" CAJA_PREFERENCES_IMAGE_FILE_THUMBNAIL_DIRECTORY_LIMIT,
+ G_CALLBACK (thumbnail_directory_limit_changed_callback),
+ NULL);
thumbnail_size_changed_callback (NULL);
g_signal_connect_swapped (caja_icon_view_preferences,
"changed::" CAJA_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE,
diff --git a/libcaja-private/caja-global-preferences.h b/libcaja-private/caja-global-preferences.h
index 27059ca7..9fadffd1 100644
--- a/libcaja-private/caja-global-preferences.h
+++ b/libcaja-private/caja-global-preferences.h
@@ -186,6 +186,7 @@ typedef enum
#define CAJA_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS "show-directory-item-counts"
#define CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS "show-image-thumbnails"
#define CAJA_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT "thumbnail-limit"
+#define CAJA_PREFERENCES_IMAGE_FILE_THUMBNAIL_DIRECTORY_LIMIT "thumbnail-directory-limit"
#define CAJA_PREFERENCES_PREVIEW_SOUND "preview-sound"
typedef enum
diff --git a/libcaja-private/org.mate.caja.gschema.xml b/libcaja-private/org.mate.caja.gschema.xml
index 7e9b150e..5f3792b3 100644
--- a/libcaja-private/org.mate.caja.gschema.xml
+++ b/libcaja-private/org.mate.caja.gschema.xml
@@ -165,6 +165,11 @@
<summary>Maximum image size for thumbnailing</summary>
<description>Images over this size (in bytes) won't be thumbnailed. The purpose of this setting is to avoid thumbnailing large images that may take a long time to load or use lots of memory.</description>
</key>
+ <key name="thumbnail-directory-limit" type="t">
+ <default>5000</default>
+ <summary>Maximum number of files in a directory for thumbnailing</summary>
+ <description>Directories with more than this number of files won't show thumbnails. The purpose of this setting is to avoid the performance penalty of generating thumbnails in very large directories. The file count includes hidden files regardless of whether they are displayed.</description>
+ </key>
<key name="preview-sound" enum="org.mate.caja.SpeedTradeoff">
<aliases><alias value='local_only' target='local-only'/></aliases>
<default>'local-only'</default>