diff options
author | Martin Wehner <martin.wehner@gmail.com> | 2005-05-08 16:14:51 +0000 |
---|---|---|
committer | Martin Wehner <mwehner@src.gnome.org> | 2005-05-08 16:14:51 +0000 |
commit | 928a29d9a89ae239c379a70e8b23e464573222bc (patch) | |
tree | 92721b6a60f858ea8d2384aa522735d20909a8fe | |
parent | d2af91471b8d77c7e48e55b7a34703ff3c5a8fc9 (diff) | |
download | nautilus-928a29d9a89ae239c379a70e8b23e464573222bc.tar.gz |
Don't try to thumbnail files which have been modified in the last few
2005-05-08 Martin Wehner <martin.wehner@gmail.com>
* libnautilus-private/nautilus-thumbnails.c:
(thumbnail_thread_start):
Don't try to thumbnail files which have been modified in the
last few seconds to avoid constantly re-thumbnailing them.
Current cool-off period is three seconds. Fixes bug #107418.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | libnautilus-private/nautilus-thumbnails.c | 19 |
2 files changed, 27 insertions, 0 deletions
@@ -1,3 +1,11 @@ +2005-05-08 Martin Wehner <martin.wehner@gmail.com> + + * libnautilus-private/nautilus-thumbnails.c: + (thumbnail_thread_start): + Don't try to thumbnail files which have been modified in the + last few seconds to avoid constantly re-thumbnailing them. + Current cool-off period is three seconds. Fixes bug #107418. + 2005-05-03 Martin Wehner <martin.wehner@gmail.com> * src/file-manager/fm-directory-view.[ch]: diff --git a/libnautilus-private/nautilus-thumbnails.c b/libnautilus-private/nautilus-thumbnails.c index 1ef88afa8..4a6e2c5be 100644 --- a/libnautilus-private/nautilus-thumbnails.c +++ b/libnautilus-private/nautilus-thumbnails.c @@ -55,6 +55,9 @@ /* Should never be a reasonable actual mtime */ #define INVALID_MTIME 0 +/* Cool-off period between last file modification time and thumbnail creation */ +#define THUMBNAIL_CREATION_DELAY_SECS 3 + static gpointer thumbnail_thread_start (gpointer data); /* structure used for making thumbnails, associating a uri with where the thumbnail is to be stored */ @@ -493,6 +496,7 @@ thumbnail_thread_start (gpointer data) NautilusThumbnailInfo *info = NULL; GdkPixbuf *pixbuf; time_t current_orig_mtime = 0; + time_t current_time; /* We loop until there are no more thumbails to make, at which point we exit the thread. */ @@ -548,6 +552,21 @@ thumbnail_thread_start (gpointer data) #endif pthread_mutex_unlock (&thumbnails_mutex); + time (¤t_time); + + /* Don't try to create a thumbnail if the file was modified recently. + This prevents constant re-thumbnailing of changing files. */ + if (current_time < current_orig_mtime + THUMBNAIL_CREATION_DELAY_SECS && + current_time >= current_orig_mtime) { +#ifdef DEBUG_THUMBNAILS + g_message ("(Thumbnail Thread) Skipping: %s\n", + info->image_uri); +#endif + /* Reschedule thumbnailing via a change notification */ + g_timeout_add (1000, thumbnail_thread_notify_file_changed, + g_strdup (info->image_uri)); + continue; + } /* Create the thumbnail. */ #ifdef DEBUG_THUMBNAILS |