Use GnomeDesktopThumbnailFactory instead of GnomeThumbnailFactory

http://bugzilla.gnome.org/show_bug.cgi?id=591008
This commit is contained in:
Dan Winship 2009-08-10 13:57:10 -04:00
parent 47af454115
commit e6644b7feb
2 changed files with 12 additions and 15 deletions

View File

@ -43,15 +43,11 @@ fi
AM_CONDITIONAL(BUILD_RECORDER, $build_recorder)
PKG_CHECK_MODULES(MUTTER_PLUGIN, gio-unix-2.0 gtk+-2.0 dbus-glib-1 mutter-plugins gjs-gi-1.0 libgnome-menu $recorder_modules gconf-2.0 gdk-x11-2.0 clutter-x11-1.0 clutter-glx-1.0)
PKG_CHECK_MODULES(MUTTER_PLUGIN, gio-unix-2.0 gtk+-2.0 dbus-glib-1 mutter-plugins gjs-gi-1.0 libgnome-menu $recorder_modules gconf-2.0 gdk-x11-2.0 clutter-x11-1.0 clutter-glx-1.0 gnome-desktop-2.0 >= 2.26)
PKG_CHECK_MODULES(TIDY, clutter-1.0)
PKG_CHECK_MODULES(BIG, clutter-1.0 gtk+-2.0 librsvg-2.0)
PKG_CHECK_MODULES(GDMUSER, dbus-glib-1 gtk+-2.0)
PKG_CHECK_MODULES(TRAY, gtk+-2.0)
# We require libgnomeui for generating thumbnails for recent files with GnomeThumbnailFactory.
# We'll switch to using GnomeDesktopThumbnailFactory once the branch of gnome-desktop that contains
# it becomes stable.
PKG_CHECK_MODULES(LIBGNOMEUI, libgnomeui-2.0)
MUTTER_BIN_DIR=`$PKG_CONFIG --variable=exec_prefix mutter-plugins`/bin
# FIXME: metacity-plugins.pc should point directly to its .gir file

View File

@ -1,7 +1,8 @@
#include "shell-texture-cache.h"
#include "shell-global.h"
#include <gtk/gtk.h>
#include <libgnomeui/gnome-thumbnail.h>
#define GNOME_DESKTOP_USE_UNSTABLE_API
#include <libgnomeui/gnome-desktop-thumbnail.h>
#include <string.h>
typedef struct
@ -20,7 +21,7 @@ typedef struct
struct _ShellTextureCachePrivate
{
GHashTable *keyed_cache; /* CacheKey -> CoglTexture* */
GnomeThumbnailFactory *thumbnails;
GnomeDesktopThumbnailFactory *thumbnails;
};
static void shell_texture_cache_dispose (GObject *object);
@ -129,7 +130,7 @@ shell_texture_cache_init (ShellTextureCache *self)
self->priv = g_new0 (ShellTextureCachePrivate, 1);
self->priv->keyed_cache = g_hash_table_new_full (cache_key_hash, cache_key_equal,
cache_key_destroy, cogl_handle_unref);
self->priv->thumbnails = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL);
self->priv->thumbnails = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
}
static void
@ -403,7 +404,7 @@ impl_load_thumbnail (ShellTextureCache *cache,
guint size,
GError **error)
{
GnomeThumbnailFactory *thumbnail_factory;
GnomeDesktopThumbnailFactory *thumbnail_factory;
GdkPixbuf *pixbuf = NULL;
GFile *file;
GFileInfo *file_info;
@ -423,24 +424,24 @@ impl_load_thumbnail (ShellTextureCache *cache,
thumbnail_factory = cache->priv->thumbnails;
existing_thumbnail = gnome_thumbnail_factory_lookup (thumbnail_factory, uri, mtime);
existing_thumbnail = gnome_desktop_thumbnail_factory_lookup (thumbnail_factory, uri, mtime);
if (existing_thumbnail != NULL)
pixbuf = gdk_pixbuf_new_from_file_at_size (existing_thumbnail, size, size, error);
else if (gnome_thumbnail_factory_has_valid_failed_thumbnail (thumbnail_factory, uri, mtime))
else if (gnome_desktop_thumbnail_factory_has_valid_failed_thumbnail (thumbnail_factory, uri, mtime))
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Has failed thumbnail");
else if (gnome_thumbnail_factory_can_thumbnail (thumbnail_factory, uri, mime_type, mtime))
else if (gnome_desktop_thumbnail_factory_can_thumbnail (thumbnail_factory, uri, mime_type, mtime))
{
pixbuf = gnome_thumbnail_factory_generate_thumbnail (thumbnail_factory, uri, mime_type);
pixbuf = gnome_desktop_thumbnail_factory_generate_thumbnail (thumbnail_factory, uri, mime_type);
if (pixbuf)
{
// we need to save the thumbnail so that we don't need to generate it again in the future
gnome_thumbnail_factory_save_thumbnail (thumbnail_factory, pixbuf, uri, mtime);
gnome_desktop_thumbnail_factory_save_thumbnail (thumbnail_factory, pixbuf, uri, mtime);
}
else
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Failed to generate thumbnail");
gnome_thumbnail_factory_create_failed_thumbnail (thumbnail_factory, uri, mtime);
gnome_desktop_thumbnail_factory_create_failed_thumbnail (thumbnail_factory, uri, mtime);
}
}
return pixbuf;