nautilus r13606 - in trunk: . libnautilus-private



Author: alexl
Date: Tue Jan 15 14:10:20 2008
New Revision: 13606
URL: http://svn.gnome.org/viewvc/nautilus?rev=13606&view=rev

Log:
2008-01-15  Alexander Larsson  <alexl redhat com>

        * libnautilus-private/nautilus-directory-async.c:
        * libnautilus-private/nautilus-file-private.h:
        * libnautilus-private/nautilus-file.c:
	Honor mtime specified in thumbnail (#504833)




Modified:
   trunk/ChangeLog
   trunk/libnautilus-private/nautilus-directory-async.c
   trunk/libnautilus-private/nautilus-file-private.h
   trunk/libnautilus-private/nautilus-file.c

Modified: trunk/libnautilus-private/nautilus-directory-async.c
==============================================================================
--- trunk/libnautilus-private/nautilus-directory-async.c	(original)
+++ trunk/libnautilus-private/nautilus-directory-async.c	Tue Jan 15 14:10:20 2008
@@ -3583,6 +3583,9 @@
 		GdkPixbuf *pixbuf,
 		gboolean tried_original)
 {
+	const char *thumb_mtime_str;
+	time_t thumb_mtime;
+	
 	file->details->thumbnail_is_up_to_date = TRUE;
 	file->details->thumbnail_tried_original  = tried_original;
 	if (file->details->thumbnail) {
@@ -3591,7 +3594,17 @@
 	}
 	file->details->thumbnail_size = 0;
 	if (pixbuf) {
-		file->details->thumbnail = g_object_ref (pixbuf);
+		thumb_mtime_str = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::MTime");
+		thumb_mtime = atol (thumb_mtime_str);
+
+		if (thumb_mtime == 0 ||
+		    thumb_mtime == file->details->mtime) {
+			file->details->thumbnail = g_object_ref (pixbuf);
+			file->details->thumbnail_mtime = thumb_mtime;
+		} else {
+			g_free (file->details->thumbnail_path);
+			file->details->thumbnail_path = NULL;
+		}
 	}
 	
 	nautilus_directory_async_state_changed (directory);

Modified: trunk/libnautilus-private/nautilus-file-private.h
==============================================================================
--- trunk/libnautilus-private/nautilus-file-private.h	(original)
+++ trunk/libnautilus-private/nautilus-file-private.h	Tue Jan 15 14:10:20 2008
@@ -105,6 +105,7 @@
 	
 	char *thumbnail_path;
 	GdkPixbuf *thumbnail;
+	time_t thumbnail_mtime;
 	int thumbnail_size; /* 0 means original unframed thumbnail */
 	
 	GList *mime_list; /* If this is a directory, the list of MIME types in it. */

Modified: trunk/libnautilus-private/nautilus-file.c
==============================================================================
--- trunk/libnautilus-private/nautilus-file.c	(original)
+++ trunk/libnautilus-private/nautilus-file.c	Tue Jan 15 14:10:20 2008
@@ -1708,6 +1708,13 @@
 	file->details->ctime = ctime;
 	file->details->mtime = mtime;
 
+	if (file->details->thumbnail != NULL &&
+	    file->details->thumbnail_mtime != 0 &&
+	    file->details->thumbnail_mtime != mtime) {
+		file->details->thumbnail_is_up_to_date = FALSE;
+		changed = TRUE;
+	}
+
 	icon = g_file_info_get_icon (info);
 	if (!g_icon_equal (icon, file->details->icon)) {
 		changed = TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]