Commit 836edd3b authored by Christian Neumair's avatar Christian Neumair Committed by Christian Neumair

Copy thumbnails when copying file metadata. Fixes #45191.

2005-09-19  Christian Neumair  <chris@gnome-de.org>

	* libnautilus-private/nautilus-metafile.c: (copy_file_metadata):
	* libnautilus-private/nautilus-thumbnails.c:
	(nautilus_update_thumbnail_file_copied),
	(nautilus_update_thumbnail_file_renamed),
	(nautilus_remove_thumbnail_for_file):
	* libnautilus-private/nautilus-thumbnails.h:
	Copy thumbnails when copying file metadata. Fixes #45191.
parent 371c3a38
2005-09-19 Christian Neumair <chris@gnome-de.org>
* libnautilus-private/nautilus-metafile.c: (copy_file_metadata):
* libnautilus-private/nautilus-thumbnails.c:
(nautilus_update_thumbnail_file_copied),
(nautilus_update_thumbnail_file_renamed),
(nautilus_remove_thumbnail_for_file):
* libnautilus-private/nautilus-thumbnails.h:
Copy thumbnails when copying file metadata. Fixes #45191.
2005-09-19 Christian Neumair <chris@gnome-de.org>
* src/file-manager/fm-list-view.c: (drag_begin_callback),
......
......@@ -1414,6 +1414,8 @@ copy_file_metadata (NautilusMetafile *source_metafile,
{
xmlNodePtr source_node, node, root;
GHashTable *hash, *changes;
char *source_file_uri;
char *destination_file_uri;
g_return_if_fail (NAUTILUS_IS_METAFILE (source_metafile));
g_return_if_fail (source_file_name != NULL);
......@@ -1457,9 +1459,12 @@ copy_file_metadata (NautilusMetafile *source_metafile,
}
}
/* FIXME: Do we want to copy the thumbnail here like in the
* rename and remove cases?
*/
/* Copy the thumbnail for the file, if any. */
source_file_uri = metafile_get_file_uri (source_metafile, source_file_name);
destination_file_uri = metafile_get_file_uri (destination_metafile, destination_file_name);
nautilus_update_thumbnail_file_copied (source_file_uri, destination_file_uri);
g_free (source_file_uri);
g_free (destination_file_uri);
}
static void
......
......@@ -178,27 +178,28 @@ thumbnail_thread_starter_cb (gpointer data)
}
void
nautilus_update_thumbnail_file_renamed (const char *old_file_uri, const char *new_file_uri)
nautilus_update_thumbnail_file_copied (const char *source_file_uri,
const char *destination_file_uri)
{
char *old_thumbnail_path;
GdkPixbuf *pixbuf;
GnomeVFSFileInfo *file_info;
GnomeThumbnailFactory *factory;
old_thumbnail_path = gnome_thumbnail_path_for_uri (old_file_uri, GNOME_THUMBNAIL_SIZE_NORMAL);
old_thumbnail_path = gnome_thumbnail_path_for_uri (source_file_uri, GNOME_THUMBNAIL_SIZE_NORMAL);
if (old_thumbnail_path != NULL &&
g_file_test (old_thumbnail_path, G_FILE_TEST_EXISTS)) {
file_info = gnome_vfs_file_info_new ();
if (gnome_vfs_get_file_info (new_file_uri,
if (gnome_vfs_get_file_info (destination_file_uri,
file_info,
GNOME_VFS_FILE_INFO_DEFAULT) == GNOME_VFS_OK) {
pixbuf = gdk_pixbuf_new_from_file (old_thumbnail_path, NULL);
if (pixbuf && gnome_thumbnail_has_uri (pixbuf, old_file_uri)) {
if (pixbuf && gnome_thumbnail_has_uri (pixbuf, source_file_uri)) {
factory = nautilus_icon_factory_get_thumbnail_factory ();
gnome_thumbnail_factory_save_thumbnail (factory,
pixbuf,
new_file_uri,
destination_file_uri,
file_info->mtime);
g_object_unref (factory);
}
......@@ -207,7 +208,6 @@ nautilus_update_thumbnail_file_renamed (const char *old_file_uri, const char *ne
g_object_unref (pixbuf);
}
unlink (old_thumbnail_path);
}
gnome_vfs_file_info_unref (file_info);
}
......@@ -215,16 +215,24 @@ nautilus_update_thumbnail_file_renamed (const char *old_file_uri, const char *ne
g_free (old_thumbnail_path);
}
void
nautilus_update_thumbnail_file_renamed (const char *source_file_uri,
const char *destination_file_uri)
{
nautilus_update_thumbnail_file_copied (source_file_uri, destination_file_uri);
nautilus_remove_thumbnail_for_file (source_file_uri);
}
void
nautilus_remove_thumbnail_for_file (const char *old_file_uri)
nautilus_remove_thumbnail_for_file (const char *file_uri)
{
char *old_thumbnail_path;
char *thumbnail_path;
old_thumbnail_path = gnome_thumbnail_path_for_uri (old_file_uri, GNOME_THUMBNAIL_SIZE_NORMAL);
if (old_thumbnail_path != NULL) {
unlink (old_thumbnail_path);
thumbnail_path = gnome_thumbnail_path_for_uri (file_uri, GNOME_THUMBNAIL_SIZE_NORMAL);
if (thumbnail_path != NULL) {
unlink (thumbnail_path);
}
g_free (old_thumbnail_path);
g_free (thumbnail_path);
}
void
......
......@@ -32,9 +32,11 @@
void nautilus_create_thumbnail (NautilusFile *file);
void nautilus_thumbnail_frame_image (GdkPixbuf **pixbuf);
GdkPixbuf *nautilus_thumbnail_load_framed_image (const char *path);
void nautilus_update_thumbnail_file_renamed (const char *old_file_uri,
const char *new_file_uri);
void nautilus_remove_thumbnail_for_file (const char *old_file_uri);
void nautilus_update_thumbnail_file_copied (const char *source_file_uri,
const char *destination_file_uri);
void nautilus_update_thumbnail_file_renamed (const char *source_file_uri,
const char *destination_file_uri);
void nautilus_remove_thumbnail_for_file (const char *file_uri);
/* Queue handling: */
void nautilus_thumbnail_remove_from_queue (const char *file_uri);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment