Commit 5dd9c624 authored by John Sullivan's avatar John Sullivan

Fixed bug where icon factory was making a thumbnail for a single file multiple

times.
parent d015748e
2000-03-08 John Sullivan <sullivan@eazel.com>
* libnautilus/nautilus-icon-factory.c:
(compare_thumbnail_info): New function, compares uris of two
NautilusThumbnailInfos.
(nautilus_icon_factory_get_thumbnail_uri): Use compare_thumbnail_info
to avoid putting the same uri in the thumbnail-making queue multiple
times. This may or may not have been the cause of an intermittend
thumbnail-creating problem I was seeing.
2000-03-08 Andy Hertzfeld <andy@eazel.com>
* libnautilus/nautilus-icons-view-icon-item.c:
......
......@@ -696,17 +696,32 @@ make_thumbnail_path (const char *image_uri, gboolean directory_only)
return thumbnail_uri;
}
/* routine that takes a uri of a large image file and returns the uri of its corresponding thumbnail.
If no thumbnail is available, put the image on the thumbnail queue so one is eventually made. */
/* FIXME: Most of this thumbnail machinery belongs in NautilusFile, not here.
*/
/* structure used for making thumbnails, associating a uri with the requesting controller */
typedef struct {
char *thumbnail_uri;
} NautilusThumbnailInfo;
/* GCompareFunc-style function for comparing NautilusThumbnailInfos.
* Returns 0 if they refer to the same uri.
*/
static int
compare_thumbnail_info (gconstpointer a, gconstpointer b)
{
NautilusThumbnailInfo *info_a;
NautilusThumbnailInfo *info_b;
info_a = (NautilusThumbnailInfo *)a;
info_b = (NautilusThumbnailInfo *)b;
return strcmp (info_a->thumbnail_uri, info_b->thumbnail_uri) != 0;
}
/* routine that takes a uri of a large image file and returns the uri of its corresponding thumbnail.
If no thumbnail is available, put the image on the thumbnail queue so one is eventually made. */
/* FIXME: Most of this thumbnail machinery belongs in NautilusFile, not here.
*/
static char *
nautilus_icon_factory_get_thumbnail_uri (NautilusFile *file)
{
......@@ -742,7 +757,9 @@ nautilus_icon_factory_get_thumbnail_uri (NautilusFile *file)
factory = nautilus_get_current_icon_factory ();
if (factory->thumbnails) {
factory->thumbnails = g_list_prepend (factory->thumbnails, info);
if (g_list_find_custom (factory->thumbnails, info, compare_thumbnail_info) == NULL) {
factory->thumbnails = g_list_prepend (factory->thumbnails, info);
}
} else {
factory->thumbnails = g_list_alloc ();
factory->thumbnails->data = info;
......
......@@ -696,17 +696,32 @@ make_thumbnail_path (const char *image_uri, gboolean directory_only)
return thumbnail_uri;
}
/* routine that takes a uri of a large image file and returns the uri of its corresponding thumbnail.
If no thumbnail is available, put the image on the thumbnail queue so one is eventually made. */
/* FIXME: Most of this thumbnail machinery belongs in NautilusFile, not here.
*/
/* structure used for making thumbnails, associating a uri with the requesting controller */
typedef struct {
char *thumbnail_uri;
} NautilusThumbnailInfo;
/* GCompareFunc-style function for comparing NautilusThumbnailInfos.
* Returns 0 if they refer to the same uri.
*/
static int
compare_thumbnail_info (gconstpointer a, gconstpointer b)
{
NautilusThumbnailInfo *info_a;
NautilusThumbnailInfo *info_b;
info_a = (NautilusThumbnailInfo *)a;
info_b = (NautilusThumbnailInfo *)b;
return strcmp (info_a->thumbnail_uri, info_b->thumbnail_uri) != 0;
}
/* routine that takes a uri of a large image file and returns the uri of its corresponding thumbnail.
If no thumbnail is available, put the image on the thumbnail queue so one is eventually made. */
/* FIXME: Most of this thumbnail machinery belongs in NautilusFile, not here.
*/
static char *
nautilus_icon_factory_get_thumbnail_uri (NautilusFile *file)
{
......@@ -742,7 +757,9 @@ nautilus_icon_factory_get_thumbnail_uri (NautilusFile *file)
factory = nautilus_get_current_icon_factory ();
if (factory->thumbnails) {
factory->thumbnails = g_list_prepend (factory->thumbnails, info);
if (g_list_find_custom (factory->thumbnails, info, compare_thumbnail_info) == NULL) {
factory->thumbnails = g_list_prepend (factory->thumbnails, info);
}
} else {
factory->thumbnails = g_list_alloc ();
factory->thumbnails->data = info;
......
......@@ -696,17 +696,32 @@ make_thumbnail_path (const char *image_uri, gboolean directory_only)
return thumbnail_uri;
}
/* routine that takes a uri of a large image file and returns the uri of its corresponding thumbnail.
If no thumbnail is available, put the image on the thumbnail queue so one is eventually made. */
/* FIXME: Most of this thumbnail machinery belongs in NautilusFile, not here.
*/
/* structure used for making thumbnails, associating a uri with the requesting controller */
typedef struct {
char *thumbnail_uri;
} NautilusThumbnailInfo;
/* GCompareFunc-style function for comparing NautilusThumbnailInfos.
* Returns 0 if they refer to the same uri.
*/
static int
compare_thumbnail_info (gconstpointer a, gconstpointer b)
{
NautilusThumbnailInfo *info_a;
NautilusThumbnailInfo *info_b;
info_a = (NautilusThumbnailInfo *)a;
info_b = (NautilusThumbnailInfo *)b;
return strcmp (info_a->thumbnail_uri, info_b->thumbnail_uri) != 0;
}
/* routine that takes a uri of a large image file and returns the uri of its corresponding thumbnail.
If no thumbnail is available, put the image on the thumbnail queue so one is eventually made. */
/* FIXME: Most of this thumbnail machinery belongs in NautilusFile, not here.
*/
static char *
nautilus_icon_factory_get_thumbnail_uri (NautilusFile *file)
{
......@@ -742,7 +757,9 @@ nautilus_icon_factory_get_thumbnail_uri (NautilusFile *file)
factory = nautilus_get_current_icon_factory ();
if (factory->thumbnails) {
factory->thumbnails = g_list_prepend (factory->thumbnails, info);
if (g_list_find_custom (factory->thumbnails, info, compare_thumbnail_info) == NULL) {
factory->thumbnails = g_list_prepend (factory->thumbnails, info);
}
} else {
factory->thumbnails = g_list_alloc ();
factory->thumbnails->data = info;
......
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