eog r4937 - in trunk: . src



Author: friemann
Date: Fri Jan  9 20:10:22 2009
New Revision: 4937
URL: http://svn.gnome.org/viewvc/eog?rev=4937&view=rev

Log:
2009-01-09  Felix Riemann  <friemann svn gnome org>

	* configure.ac: Re-instate gnome-desktop dependency (2.25.1).
	* src/eog-file-chooser.c: (update_preview_cb),
	(eog_file_chooser_add_preview):
	* src/eog-thumbnail.c: (get_valid_thumbnail),
	(create_thumbnail_from_pixbuf), (eog_thumb_data_new),
	(eog_thumbnail_fit_to_size), (eog_thumbnail_load),
	(eog_thumbnail_init):
	Use GnomeDesktopThumbnail from libgnome-desktop instead of
	GnomeThumbnail from libgnomeui for thumbnailing. Part of bug #559500.


Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/src/eog-file-chooser.c
   trunk/src/eog-thumbnail.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Fri Jan  9 20:10:22 2009
@@ -84,6 +84,7 @@
 GTK_REQUIRED=2.13.1
 GLIB_REQUIRED=2.15.3
 LIBGNOMEUI_REQUIRED=2.6.0
+GNOME_DESKTOP_REQUIRED=2.25.1
 GDKPIXBUF_REQUIRED=2.4.0
 GCONF_REQUIRED=2.5.90
 LIBART_REQUIRED=2.3.16
@@ -97,6 +98,7 @@
              glib-2.0 >= $GLIB_REQUIRED \
              gio-2.0 >= $GLIB_REQUIRED \
              libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED \
+             gnome-desktop-2.0 >= $GNOME_DESKTOP_REQUIRED \
              gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED \
              gconf-2.0 >= $GCONF_REQUIRED \
              libart-2.0 >= $LIBART_REQUIRED \

Modified: trunk/src/eog-file-chooser.c
==============================================================================
--- trunk/src/eog-file-chooser.c	(original)
+++ trunk/src/eog-file-chooser.c	Fri Jan  9 20:10:22 2009
@@ -29,9 +29,15 @@
 #include <glib/gi18n.h>
 #include <gio/gio.h>
 #include <gtk/gtk.h>
-#include <libgnomeui/gnome-thumbnail.h>
 #include <gconf/gconf-client.h>
 
+/* We must define GNOME_DESKTOP_USE_UNSTABLE_API to be able
+   to use GnomeDesktopThumbnail */
+#ifndef GNOME_DESKTOP_USE_UNSTABLE_API
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#endif
+#include <libgnomeui/gnome-desktop-thumbnail.h>
+
 static char *last_dir[] = { NULL, NULL, NULL, NULL };
 
 #define FILE_FORMAT_KEY "file-format"
@@ -42,7 +48,7 @@
 
 struct _EogFileChooserPrivate
 {
-	GnomeThumbnailFactory *thumb_factory;
+	GnomeDesktopThumbnailFactory *thumb_factory;
 
 	GtkWidget *image;
 	GtkWidget *size_label;
@@ -341,9 +347,7 @@
 
 		mtime = g_file_info_get_attribute_uint64 (file_info,
 							  G_FILE_ATTRIBUTE_TIME_MODIFIED);
-		thumb_path = gnome_thumbnail_factory_lookup (priv->thumb_factory,
-							     uri,
-							     mtime);
+		thumb_path = gnome_desktop_thumbnail_factory_lookup (priv->thumb_factory, uri, mtime);
 		if (thumb_path == NULL) {
 			/* read files smaller than 100kb directly */
 			if (g_file_info_get_size (file_info) <= 100000) {
@@ -406,7 +410,7 @@
 	gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (widget), vbox);
 	gtk_file_chooser_set_preview_widget_active (GTK_FILE_CHOOSER (widget), FALSE);
 
-	priv->thumb_factory = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL);
+	priv->thumb_factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
 
 	g_signal_connect (widget, "update-preview",
 			  G_CALLBACK (update_preview_cb), NULL);

Modified: trunk/src/eog-thumbnail.c
==============================================================================
--- trunk/src/eog-thumbnail.c	(original)
+++ trunk/src/eog-thumbnail.c	Fri Jan  9 20:10:22 2009
@@ -26,7 +26,12 @@
 #include <config.h>
 #endif
 
-#include <libgnomeui/libgnomeui.h>
+/* We must define GNOME_DESKTOP_USE_UNSTABLE_API to be able
+   to use GnomeDesktopThumbnail */
+#ifndef GNOME_DESKTOP_USE_UNSTABLE_API
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#endif
+#include <libgnomeui/gnome-desktop-thumbnail.h>
 #include <libart_lgpl/art_rgb.h>
 
 #include "eog-thumbnail.h"
@@ -35,7 +40,7 @@
 
 #define EOG_THUMB_ERROR eog_thumb_error_quark ()
 
-static GnomeThumbnailFactory *factory = NULL;
+static GnomeDesktopThumbnailFactory *factory = NULL;
 static GdkPixbuf *frame = NULL;
 
 typedef enum {
@@ -94,7 +99,7 @@
 		thumb = gdk_pixbuf_new_from_file (data->thumb_path, error);
 
 		/* is this thumbnail file up to date? */
-		if (thumb != NULL && !gnome_thumbnail_is_valid (thumb, data->uri_str, data->mtime)) {
+		if (thumb != NULL && !gnome_desktop_thumbnail_is_valid (thumb, data->uri_str, data->mtime)) {
 			g_object_unref (thumb);
 			thumb = NULL;
 		}
@@ -119,8 +124,9 @@
 
 	perc = CLAMP (128.0/(MAX (width, height)), 0, 1);
 
-	thumb = gnome_thumbnail_scale_down_pixbuf (pixbuf,
-						   width*perc, height*perc);
+	thumb = gnome_desktop_thumbnail_scale_down_pixbuf (pixbuf,
+							   width*perc,
+							   height*perc);
 
 	return thumb;
 }
@@ -151,7 +157,7 @@
 	data = g_slice_new0 (EogThumbData);
 
 	data->uri_str    = g_file_get_uri (file);
-	data->thumb_path = gnome_thumbnail_path_for_uri (data->uri_str, GNOME_THUMBNAIL_SIZE_NORMAL);
+	data->thumb_path = gnome_desktop_thumbnail_path_for_uri (data->uri_str, GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
 
 	file_info = g_file_query_info (file,
 				       G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
@@ -436,8 +442,7 @@
 		width  = MAX (width  * factor, 1);
 		height = MAX (height * factor, 1);
 
-		result_pixbuf = gnome_thumbnail_scale_down_pixbuf (*thumbnail,
-							           width, height);
+		result_pixbuf = gnome_desktop_thumbnail_scale_down_pixbuf (*thumbnail, width, height);
 
 		g_object_unref (*thumbnail);
 
@@ -464,7 +469,7 @@
 		return NULL;
 
 	if (!data->can_read ||
-	    (data->failed_thumb_exists && gnome_thumbnail_factory_has_valid_failed_thumbnail (factory, data->uri_str, data->mtime))) {
+	    (data->failed_thumb_exists && gnome_desktop_thumbnail_factory_has_valid_failed_thumbnail (factory, data->uri_str, data->mtime))) {
 		eog_debug_message (DEBUG_THUMBNAIL, "%s: bad permissions or valid failed thumbnail present",data->uri_str);
 		set_thumb_error (error, EOG_THUMB_ERROR_GENERIC, "Thumbnail creation failed");
 		return NULL;
@@ -475,7 +480,7 @@
 
 	if (thumb != NULL) {
 		eog_debug_message (DEBUG_THUMBNAIL, "%s: loaded from cache",data->uri_str);
-	} else if (gnome_thumbnail_factory_can_thumbnail (factory, data->uri_str, data->mime_type, data->mtime)) {
+	} else if (gnome_desktop_thumbnail_factory_can_thumbnail (factory, data->uri_str, data->mime_type, data->mtime)) {
 		pixbuf = eog_image_get_pixbuf (image);
 
 		if (pixbuf != NULL) {
@@ -487,16 +492,16 @@
 		} else {
 			/* generate a thumbnail from the file */
 			eog_debug_message (DEBUG_THUMBNAIL, "%s: creating from file",data->uri_str);
-			thumb = gnome_thumbnail_factory_generate_thumbnail (factory, data->uri_str, data->mime_type);
+			thumb = gnome_desktop_thumbnail_factory_generate_thumbnail (factory, data->uri_str, data->mime_type);
 		}
 
 		if (thumb != NULL) {
 			/* Save the new thumbnail */
-			gnome_thumbnail_factory_save_thumbnail (factory, thumb, data->uri_str, data->mtime);
+			gnome_desktop_thumbnail_factory_save_thumbnail (factory, thumb, data->uri_str, data->mtime);
 			eog_debug_message (DEBUG_THUMBNAIL, "%s: normal thumbnail saved",data->uri_str);
 		} else {
 			/* Save a failed thumbnail, to stop further thumbnail attempts */
-			gnome_thumbnail_factory_create_failed_thumbnail (factory, data->uri_str, data->mtime);
+			gnome_desktop_thumbnail_factory_create_failed_thumbnail (factory, data->uri_str, data->mtime);
 			eog_debug_message (DEBUG_THUMBNAIL, "%s: failed thumbnail saved",data->uri_str);
 			set_thumb_error (error, EOG_THUMB_ERROR_GENERIC, "Thumbnail creation failed");
 		}
@@ -511,7 +516,7 @@
 eog_thumbnail_init (void)
 {
 	if (factory == NULL) {
-		factory = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL);
+		factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
 	}
 
 	if (frame == NULL) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]