void nautilus_remove_thumbnail_for_file (const char *file_uri) { char *thumbnail_path; thumbnail_path = gnome_thumbnail_path_for_uri (file_uri, GNOME_THUMBNAIL_SIZE_NORMAL); if (thumbnail_path != NULL) { unlink (thumbnail_path); } g_free (thumbnail_path); }
char * cache_get_nautilus_cache_name (const char *path) { char *parent; char *resolved_parent; char *resolved_path = NULL; GnomeVFSResult result; GnomeVFSURI *uri; char *uri_txt; char *retval; parent = remove_level_from_path (path); result = resolve_all_symlinks (parent, &resolved_parent); g_free (parent); if (result == GNOME_VFS_OK) resolved_path = g_strconcat (resolved_parent, "/", file_name_from_path (path), NULL); else resolved_path = g_strdup (path); uri = new_uri_from_path (resolved_path); g_free (resolved_path); g_free (resolved_parent); uri_txt = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE); gnome_vfs_uri_unref (uri); if (uri_txt == NULL) return NULL; retval = gnome_thumbnail_path_for_uri (uri_txt, GNOME_THUMBNAIL_SIZE_NORMAL); g_free (uri_txt); return retval; }
void nautilus_update_thumbnail_file_copied (const char *source_file_uri, const char *destination_file_uri) { char *old_thumbnail_path; GdkPixbuf *pixbuf; GFileInfo *file_info; GnomeThumbnailFactory *factory; GFile *destination_file; 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)) { destination_file = g_file_new_for_uri (destination_file_uri); file_info = g_file_query_info (destination_file, G_FILE_ATTRIBUTE_TIME_MODIFIED, 0, NULL, NULL); g_object_unref (destination_file); if (file_info != NULL) { pixbuf = gdk_pixbuf_new_from_file (old_thumbnail_path, NULL); if (pixbuf && gnome_thumbnail_has_uri (pixbuf, source_file_uri)) { factory = get_thumbnail_factory (); gnome_thumbnail_factory_save_thumbnail (factory, pixbuf, destination_file_uri, g_file_info_get_attribute_uint64 (file_info, G_FILE_ATTRIBUTE_TIME_MODIFIED)); } if (pixbuf) { g_object_unref (pixbuf); } g_object_unref (file_info); } } g_free (old_thumbnail_path); }