[gthumb] Migrate from gnome-thumbnail to gnome-desktop-thumbnail
- From: Michael J. Chudobiak <mjc src gnome org>
- To: svn-commits-list gnome org
- Subject: [gthumb] Migrate from gnome-thumbnail to gnome-desktop-thumbnail
- Date: Wed, 10 Jun 2009 09:41:43 -0400 (EDT)
commit 36840f173acc840fc5cbce7efc0a9985d63258b3
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date: Wed Jun 10 09:41:21 2009 -0400
Migrate from gnome-thumbnail to gnome-desktop-thumbnail
---
NEWS | 2 ++
README | 4 +++-
configure.in | 2 ++
libgthumb/file-utils.c | 22 ++++++++++++----------
libgthumb/file-utils.h | 8 +++++---
libgthumb/image-loader.c | 9 +++++----
libgthumb/image-loader.h | 6 ++++--
libgthumb/thumb-cache.c | 6 ++++--
libgthumb/thumb-loader.c | 28 +++++++++++++++-------------
src/dlg-photo-importer.c | 13 ++++++-------
10 files changed, 58 insertions(+), 42 deletions(-)
diff --git a/NEWS b/NEWS
index eb033d3..8bfff8c 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ trunk, since last 2.10.x
Major Distro-Related Changes:
+ * gThumb now requires gnome-desktop >= 2.25.1
+ * gThumb now requires exiv2 >= 0.18
* gThumb now imports photos using the libgphoto2 backend for gvfs.
It is no longer necessary to unmount any gvfs/libgphoto2 mounts
under ~/.gvfs beforing importing. The import process may be
diff --git a/README b/README
index a5ad44f..6ecc60b 100644
--- a/README
+++ b/README
@@ -15,6 +15,8 @@ Notes:
* versions 2.9.1 and higher are for GNOME 2.16.
+ * versions 2.11.0 and higher are for GNOME 2.26.
+
* more information about gthumb can be found at:
http://gthumb.sourceforge.net
@@ -91,11 +93,11 @@ Compiling
* libgnomeui version >= 2.6.0
* libgnomecanvas version >= 2.6.0
* gnome-vfs version >= 2.6.0
+ * gnome-desktop version >= 2.25.1
* libglade version >= 2.4.0
* intltool version >= 0.35.0
* exiv2 version >= 0.18
* libjpeg
- * gtkunique version >= 0.9.1 (optional)
If the libtiff library is present you can save images in TIFF
format.
diff --git a/configure.in b/configure.in
index d72cc8d..ceaae8d 100644
--- a/configure.in
+++ b/configure.in
@@ -27,6 +27,7 @@ GTK_REQUIRED=2.14.0
LIBXML_REQUIRED=2.4.0
LIBGNOME_REQUIRED=2.6.0
LIBGNOMEUI_REQUIRED=2.6.0
+GNOME_DESKTOP_REQUIRED=2.25.1
LIBGNOMECANVAS_REQUIRED=2.6.0
GIO_REQUIRED=2.16.1
GNOME_VFS_REQUIRED=2.6.0
@@ -61,6 +62,7 @@ PKG_CHECK_MODULES(GTHUMB, \
gtk+-2.0 >= $GTK_REQUIRED \
libgnome-2.0 >= $LIBGNOME_REQUIRED \
libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED \
+ gnome-desktop-2.0 >= $GNOME_DESKTOP_REQUIRED \
libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED \
libbonobo-2.0 >= $BONOBO_REQUIRED \
libbonoboui-2.0 >= $BONOBO_REQUIRED \
diff --git a/libgthumb/file-utils.c b/libgthumb/file-utils.c
index 705e345..0664266 100644
--- a/libgthumb/file-utils.c
+++ b/libgthumb/file-utils.c
@@ -42,7 +42,6 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libgnomeui/gnome-thumbnail.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libgnomevfs/gnome-vfs-handle.h>
#include <libgnomevfs/gnome-vfs-result.h>
@@ -60,6 +59,9 @@
#include "gth-exif-utils.h"
#include "gth-sort-utils.h"
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#include <libgnomeui/gnome-desktop-thumbnail.h>
+
#ifdef HAVE_LIBOPENRAW
#include <libopenraw-gnome/gdkpixbuf.h>
#endif
@@ -706,8 +708,8 @@ delete_thumbnail (const char *path)
fd = file_data_new_from_path (path);
/* delete associated thumbnails, if present */
- large_thumbnail = gnome_thumbnail_path_for_uri (fd->uri, GNOME_THUMBNAIL_SIZE_LARGE);
- normal_thumbnail = gnome_thumbnail_path_for_uri (fd->uri, GNOME_THUMBNAIL_SIZE_NORMAL);
+ large_thumbnail = gnome_desktop_thumbnail_path_for_uri (fd->uri, GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
+ normal_thumbnail = gnome_desktop_thumbnail_path_for_uri (fd->uri, GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
file_unlink (large_thumbnail);
file_unlink (normal_thumbnail);
@@ -2274,7 +2276,7 @@ get_pixbuf_using_external_converter (FileData *file,
/* The output filename, and its persistence, depend on the input file
type, and whether or not a thumbnail has been requested. */
- md5_file = gnome_thumbnail_md5 (file->local_path);
+ md5_file = gnome_desktop_thumbnail_md5 (file->local_path);
if (is_raw && !is_thumbnail)
/* Full-sized converted RAW file */
@@ -2399,14 +2401,14 @@ get_pixbuf_using_external_converter (FileData *file,
static GdkPixbuf*
gth_pixbuf_new_from_video (FileData *file,
- GnomeThumbnailFactory *factory,
+ GnomeDesktopThumbnailFactory *factory,
GError **error,
gboolean resolve_symlinks)
{
GdkPixbuf *pixbuf = NULL;
char *thumbnail_uri;
- thumbnail_uri = gnome_thumbnail_factory_lookup (factory,
+ thumbnail_uri = gnome_desktop_thumbnail_factory_lookup (factory,
file->uri,
file->mtime);
if (thumbnail_uri != NULL) {
@@ -2415,14 +2417,14 @@ gth_pixbuf_new_from_video (FileData *file,
pixbuf = gdk_pixbuf_new_from_file (fd_thumb->local_path, error);
file_data_unref (fd_thumb);
}
- else if (gnome_thumbnail_factory_has_valid_failed_thumbnail (factory,
+ else if (gnome_desktop_thumbnail_factory_has_valid_failed_thumbnail (factory,
file->uri,
file->mtime))
{
pixbuf = NULL;
}
else
- pixbuf = gnome_thumbnail_factory_generate_thumbnail (factory,
+ pixbuf = gnome_desktop_thumbnail_factory_generate_thumbnail (factory,
file->uri,
file->mime_type);
@@ -2446,7 +2448,7 @@ gth_pixbuf_new_from_file (FileData *file,
GError **error,
int requested_width,
int requested_height,
- GnomeThumbnailFactory *factory)
+ GnomeDesktopThumbnailFactory *factory)
{
GdkPixbuf *pixbuf = NULL;
GdkPixbuf *rotated = NULL;
@@ -2546,7 +2548,7 @@ gth_pixbuf_animation_new_from_file (FileData *file,
GError **error,
int requested_width,
int requested_height,
- GnomeThumbnailFactory *factory)
+ GnomeDesktopThumbnailFactory *factory)
{
GdkPixbufAnimation *animation = NULL;
GdkPixbuf *pixbuf = NULL;
diff --git a/libgthumb/file-utils.h b/libgthumb/file-utils.h
index b4d4340..2058707 100644
--- a/libgthumb/file-utils.h
+++ b/libgthumb/file-utils.h
@@ -31,11 +31,13 @@
#include <libgnomevfs/gnome-vfs-file-size.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-#include <libgnomeui/gnome-thumbnail.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "typedefs.h"
#include "file-data.h"
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#include <libgnomeui/gnome-desktop-thumbnail.h>
+
#define SPECIAL_DIR(x) (! strcmp (x, "..") || ! strcmp (x, "."))
#define errno_to_string() (gnome_vfs_result_to_string (gnome_vfs_result_from_errno ()))
@@ -227,12 +229,12 @@ GdkPixbuf* gth_pixbuf_new_from_file (FileData *file,
GError **error,
int requested_width,
int requested_height,
- GnomeThumbnailFactory *factory);
+ GnomeDesktopThumbnailFactory *factory);
GdkPixbufAnimation* gth_pixbuf_animation_new_from_file (FileData *file,
GError **error,
int requested_width,
int requested_height,
- GnomeThumbnailFactory *factory);
+ GnomeDesktopThumbnailFactory *factory);
char * xdg_user_dir_lookup (const char *type);
diff --git a/libgthumb/image-loader.c b/libgthumb/image-loader.c
index 26a3098..a9af6d8 100644
--- a/libgthumb/image-loader.c
+++ b/libgthumb/image-loader.c
@@ -27,7 +27,6 @@
#include <errno.h>
#include <fcntl.h>
#include <gtk/gtk.h>
-#include <libgnomeui/gnome-thumbnail.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <sys/stat.h>
#include "image-loader.h"
@@ -39,6 +38,8 @@
#include "pixbuf-utils.h"
#include "preferences.h"
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#include <libgnomeui/gnome-desktop-thumbnail.h>
#define DEF_THUMB_SIZE 128
#define THUMBNAIL_NORMAL_SIZE 128
@@ -52,7 +53,7 @@ struct _ImageLoaderPrivateData {
GdkPixbuf *pixbuf;
GdkPixbufAnimation *animation;
- GnomeThumbnailFactory *thumb_factory;
+ GnomeDesktopThumbnailFactory *thumb_factory;
gboolean as_animation; /* Whether to load the image in a
* GdkPixbufAnimation structure. */
@@ -335,9 +336,9 @@ image_loader_new (gboolean as_animation)
size = eel_gconf_get_integer (PREF_THUMBNAIL_SIZE, DEF_THUMB_SIZE);
if (size <= THUMBNAIL_NORMAL_SIZE)
- priv->thumb_factory = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL);
+ priv->thumb_factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
else
- priv->thumb_factory = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_LARGE);
+ priv->thumb_factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
return G_OBJECT (il);
}
diff --git a/libgthumb/image-loader.h b/libgthumb/image-loader.h
index 8fefaf6..8b744d3 100644
--- a/libgthumb/image-loader.h
+++ b/libgthumb/image-loader.h
@@ -25,10 +25,12 @@
#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libgnomeui/gnome-thumbnail.h>
#include "typedefs.h"
#include "file-data.h"
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#include <libgnomeui/gnome-desktop-thumbnail.h>
+
#define IMAGE_LOADER_TYPE (image_loader_get_type ())
#define IMAGE_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IMAGE_LOADER_TYPE, ImageLoader))
#define IMAGE_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IMAGE_LOADER_TYPE, ImageLoaderClass))
@@ -58,7 +60,7 @@ struct _ImageLoaderClass
float percent);
};
-typedef GdkPixbufAnimation * (*LoaderFunc) (FileData *file, GError **error, GnomeThumbnailFactory *, gpointer data);
+typedef GdkPixbufAnimation * (*LoaderFunc) (FileData *file, GError **error, GnomeDesktopThumbnailFactory *, gpointer data);
GType image_loader_get_type (void);
GObject * image_loader_new (gboolean as_animation);
diff --git a/libgthumb/thumb-cache.c b/libgthumb/thumb-cache.c
index eab2a63..cbdc33e 100644
--- a/libgthumb/thumb-cache.c
+++ b/libgthumb/thumb-cache.c
@@ -32,7 +32,6 @@
#include <png.h>
#include <glib/gi18n.h>
-#include <libgnomeui/gnome-thumbnail.h>
#include <gtk/gtk.h>
#include "typedefs.h"
@@ -42,6 +41,9 @@
#include "file-data.h"
#include "gtk-utils.h"
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#include <libgnomeui/gnome-desktop-thumbnail.h>
+
#define PROCESS_DELAY 25
#define PROCESS_MAX_FILES 33
@@ -53,7 +55,7 @@ cache_get_nautilus_cache_name (const char *path)
FileData *fd;
fd = file_data_new_from_path (path);
- retval = gnome_thumbnail_path_for_uri (fd->uri, GNOME_THUMBNAIL_SIZE_NORMAL);
+ retval = gnome_desktop_thumbnail_path_for_uri (fd->uri, GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
file_data_unref (fd);
return retval;
diff --git a/libgthumb/thumb-loader.c b/libgthumb/thumb-loader.c
index ce943f5..be6949d 100644
--- a/libgthumb/thumb-loader.c
+++ b/libgthumb/thumb-loader.c
@@ -28,7 +28,6 @@
#include <unistd.h>
#include <gtk/gtk.h>
-#include <libgnomeui/gnome-thumbnail.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "gthumb-init.h"
@@ -42,6 +41,9 @@
#include "glib-utils.h"
#include "gthumb-marshal.h"
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#include <libgnomeui/gnome-desktop-thumbnail.h>
+
#define DEFAULT_MAX_FILE_SIZE (4*1024*1024)
#define THUMBNAIL_LARGE_SIZE 256
@@ -51,7 +53,7 @@ struct _ThumbLoaderPrivateData
{
FileData *file;
ImageLoader *il;
- GnomeThumbnailFactory *thumb_factory;
+ GnomeDesktopThumbnailFactory *thumb_factory;
GdkPixbuf *pixbuf; /* Contains the final (scaled
* if necessary) image when
* done. */
@@ -63,7 +65,7 @@ struct _ThumbLoaderPrivateData
int max_h;
int cache_max_w;
int cache_max_h;
- GnomeThumbnailSize thumb_size;
+ GnomeDesktopThumbnailSize thumb_size;
goffset max_file_size; /* If the file size is greater
* than this the thumbnail
* will not be created, for
@@ -219,7 +221,7 @@ thumb_loader_get_type (void)
static GdkPixbufAnimation*
thumb_loader (FileData *file,
GError **error,
- GnomeThumbnailFactory *thumb_factory,
+ GnomeDesktopThumbnailFactory *thumb_factory,
gpointer data)
{
ThumbLoader *tl = data;
@@ -271,14 +273,14 @@ thumb_loader_set_thumb_size (ThumbLoader *tl,
if ((width <= THUMBNAIL_NORMAL_SIZE) && (height <= THUMBNAIL_NORMAL_SIZE)) {
tl->priv->cache_max_w = tl->priv->cache_max_h = THUMBNAIL_NORMAL_SIZE;
- tl->priv->thumb_size = GNOME_THUMBNAIL_SIZE_NORMAL;
+ tl->priv->thumb_size = GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL;
}
else {
tl->priv->cache_max_w = tl->priv->cache_max_h = THUMBNAIL_LARGE_SIZE;
- tl->priv->thumb_size = GNOME_THUMBNAIL_SIZE_LARGE;
+ tl->priv->thumb_size = GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE;
}
- tl->priv->thumb_factory = gnome_thumbnail_factory_new (tl->priv->thumb_size);
+ tl->priv->thumb_factory = gnome_desktop_thumbnail_factory_new (tl->priv->thumb_size);
tl->priv->max_w = width;
tl->priv->max_h = height;
@@ -374,12 +376,12 @@ thumb_loader_start__step2 (ThumbLoader *tl)
}
if ((tl->priv->use_cache && ((time (NULL) - tl->priv->file->mtime) > (time_t) 5))) {
- cache_path = gnome_thumbnail_factory_lookup (tl->priv->thumb_factory,
+ cache_path = gnome_desktop_thumbnail_factory_lookup (tl->priv->thumb_factory,
tl->priv->file->uri,
tl->priv->file->mtime);
if ((cache_path == NULL)
- && gnome_thumbnail_factory_has_valid_failed_thumbnail (tl->priv->thumb_factory,
+ && gnome_desktop_thumbnail_factory_has_valid_failed_thumbnail (tl->priv->thumb_factory,
tl->priv->file->uri,
tl->priv->file->mtime))
{
@@ -470,7 +472,7 @@ thumb_loader_save_to_cache (ThumbLoader *tl)
g_free (cache_base_uri);
}
- cache_file = gnome_thumbnail_path_for_uri (tl->priv->file->uri, tl->priv->thumb_size);
+ cache_file = gnome_desktop_thumbnail_path_for_uri (tl->priv->file->uri, tl->priv->thumb_size);
if (cache_file == NULL)
return FALSE;
@@ -478,7 +480,7 @@ thumb_loader_save_to_cache (ThumbLoader *tl)
g_free (cache_file);
if (ensure_dir_exists (cache_dir))
- gnome_thumbnail_factory_save_thumbnail (tl->priv->thumb_factory,
+ gnome_desktop_thumbnail_factory_save_thumbnail (tl->priv->thumb_factory,
tl->priv->pixbuf,
tl->priv->file->uri,
tl->priv->file->mtime);
@@ -506,7 +508,7 @@ thumb_loader_done_cb (ImageLoader *il,
pixbuf = image_loader_get_pixbuf (priv->il);
if (pixbuf == NULL) {
- gnome_thumbnail_factory_create_failed_thumbnail (priv->thumb_factory,
+ gnome_desktop_thumbnail_factory_create_failed_thumbnail (priv->thumb_factory,
priv->file->uri,
priv->file->mtime);
g_signal_emit (G_OBJECT (tl), thumb_loader_signals[THUMB_ERROR], 0);
@@ -584,7 +586,7 @@ thumb_loader_error_cb (ImageLoader *il,
priv->pixbuf = NULL;
}
- gnome_thumbnail_factory_create_failed_thumbnail (priv->thumb_factory,
+ gnome_desktop_thumbnail_factory_create_failed_thumbnail (priv->thumb_factory,
priv->file->uri,
priv->file->mtime);
diff --git a/src/dlg-photo-importer.c b/src/dlg-photo-importer.c
index 0320fdc..17b6a7e 100644
--- a/src/dlg-photo-importer.c
+++ b/src/dlg-photo-importer.c
@@ -32,9 +32,6 @@
#include <gtk/gtk.h>
#include <glade/glade.h>
-/* FIXME */
-#include <libgnomeui/gnome-thumbnail.h>
-
#include "gth-utils.h"
#include "gtk-utils.h"
#include "gth-window.h"
@@ -52,6 +49,9 @@
#include "rotation-utils.h"
#include "main.h"
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#include <libgnomeui/gnome-desktop-thumbnail.h>
+
#define GLADE_FILE "gthumb_camera.glade"
#define TAGS_GLADE_FILE "gthumb_comment.glade"
#define TAG_SEPARATOR ";"
@@ -135,8 +135,7 @@ struct _DialogData {
gboolean dcim_dirs_only;
GFile *gfile_import_from;
-/* FIXME */
- GnomeThumbnailFactory *factory;
+ GnomeDesktopThumbnailFactory *factory;
};
@@ -714,7 +713,7 @@ gfile_get_preview (DialogData *data,
if (data->generate_previews) {
uri = g_file_get_uri (gfile);
- pixbuf = gnome_thumbnail_factory_generate_thumbnail (data->factory, uri, mime_type); /* FIXME */
+ pixbuf = gnome_desktop_thumbnail_factory_generate_thumbnail (data->factory, uri, mime_type);
g_free (uri);
if (pixbuf) {
@@ -1591,7 +1590,7 @@ dlg_photo_importer (GthBrowser *browser,
return;
}
- data->factory = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL); /* FIXME */
+ data->factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
data->tags_list = NULL;
data->delete_list = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]