cheese r459 - in trunk: . src



Author: jhaitsma
Date: Wed Jan 30 23:15:19 2008
New Revision: 459
URL: http://svn.gnome.org/viewvc/cheese?rev=459&view=rev

Log:
Now all gnome-vfs calls in cheese have been replaced by gio


Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/src/cheese.c
   trunk/src/eog-thumbnail.c
   trunk/src/eog-thumbnail.h
   trunk/wscript

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Wed Jan 30 23:15:19 2008
@@ -62,7 +62,6 @@
 GCONF_REQUIRED=2.16.0
 GSTREAMER_REQUIRED=0.10.15
 CAIRO_REQUIRED=1.2.4
-GNOME_VFS_REQUIRED=2.18.0
 LIBEBOOK_REQUIRED=1.12.0
 DBUS_REQUIRED=1.0
 HAL_REQUIRED=0.5.9
@@ -79,7 +78,6 @@
   gconf-2.0 >= $GCONF_REQUIRED \
   gstreamer-0.10 >= $GSTREAMER_REQUIRED \
   gstreamer-plugins-base-0.10 >= $GSTREAMER_REQUIRED \
-  gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED \
   libebook-1.2 >= $LIBEBOOK_REQUIRED \
   cairo >= $CAIRO_REQUIRED \
   dbus-1 >= $DBUS_REQUIRED \

Modified: trunk/src/cheese.c
==============================================================================
--- trunk/src/cheese.c	(original)
+++ trunk/src/cheese.c	Wed Jan 30 23:15:19 2008
@@ -27,7 +27,6 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <gst/gst.h>
-#include <libgnomevfs/gnome-vfs.h>
 
 #include "cheese-fileutil.h"
 #include "cheese-window.h"
@@ -92,7 +91,6 @@
 
   gtk_init (&argc, &argv);
   gst_init (&argc, &argv);
-  gnome_vfs_init ();
 
   g_set_print_handler ((GPrintFunc) cheese_print_handler);
 

Modified: trunk/src/eog-thumbnail.c
==============================================================================
--- trunk/src/eog-thumbnail.c	(original)
+++ trunk/src/eog-thumbnail.c	Wed Jan 30 23:15:19 2008
@@ -22,175 +22,20 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+/* NOTE this is a stripped version of eog-thumbnail which only contains the 
+ * functions necessary for cheese
+ */
 #ifdef HAVE_CONFIG_H
 #include <cheese-config.h>
 #endif
 
-#include <libgnomeui/libgnomeui.h>
 #include <libart_lgpl/art_rgb.h>
 
 #include "eog-thumbnail.h"
 
-#define THUMB_DEBUG 0 
-#define EOG_THUMB_ERROR eog_thumb_error_quark ()
 
-static GnomeThumbnailFactory *factory = NULL;
 static GdkPixbuf *frame = NULL;
 
-typedef enum {
-	EOG_THUMB_ERROR_VFS,
-	EOG_THUMB_ERROR_GENERIC,
-	EOG_THUMB_ERROR_UNKNOWN
-} EogThumbError;
-
-typedef struct {
-	char   *uri_str;
-	char   *thumb_path;
-	time_t  mtime;
-	char   *mime_type;
-} EogThumbData;
-
-static GQuark
-eog_thumb_error_quark (void)
-{
-	static GQuark q = 0;
-	if (q == 0)
-		q = g_quark_from_static_string ("eog-thumb-error-quark");
-	
-	return q;
-}
-
-static void
-set_vfs_error (GError **error, GnomeVFSResult result)
-{
-	g_set_error (error, 
-		     EOG_THUMB_ERROR, 
-		     EOG_THUMB_ERROR_VFS,
-		     gnome_vfs_result_to_string (result));
-}
-
-static void
-set_thumb_error (GError **error, int error_id, const char *string) 
-{
-	g_set_error (error, 
-		     EOG_THUMB_ERROR, 
-		     error_id,
-		     string);
-}
-
-static GdkPixbuf*
-get_valid_thumbnail (EogThumbData *data, GError **error)
-{
-	GdkPixbuf *thumb = NULL;
-
-	g_return_val_if_fail (data != NULL, NULL);
-
-	/* does a thumbnail under the path exists? */
-	if (g_file_test (data->thumb_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
-		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)) {
-			g_object_unref (thumb);
-			thumb = NULL;
-#if THUMB_DEBUG
-			g_print ("uri: %s, thumbnail is invalid\n", uri_str);
-#endif
-		}
-	}
-#if THUMB_DEBUG
-	else {
-		g_print ("uri: %s, has no thumbnail file\n", uri_str);
-	}
-#endif
-	return thumb;
-}
-
-static GdkPixbuf* 
-create_thumbnail (EogThumbData *data, GError **error)
-{
-	GdkPixbuf *thumb = NULL;
-	
-#if THUMB_DEBUG
-	g_print ("create thumbnail for uri: %s\n -> mtime: %i\n -> mime_type; %s\n -> thumbpath: %s\n", 
-		 data->uri_str, (int) data->mtime, data->mime_type, data->thumb_path);
-#endif
-	g_assert (factory != NULL);
-	
-	if (gnome_thumbnail_factory_can_thumbnail (factory, data->uri_str, data->mime_type, data->mtime)) 
-	{
-		thumb = gnome_thumbnail_factory_generate_thumbnail (factory, data->uri_str, data->mime_type);
-		
-		if (thumb != NULL) {
-			gnome_thumbnail_factory_save_thumbnail (factory, thumb, data->uri_str, data->mtime);
-		}
-		else {
-			set_thumb_error (error, EOG_THUMB_ERROR_GENERIC, "Thumbnail creation failed");
-		}
-	} 
-	else {
-		set_thumb_error (error, EOG_THUMB_ERROR_GENERIC, "Thumbnail creation failed");
-	}
-	
-	return thumb;
-}
-
-static void
-eog_thumb_data_free (EogThumbData *data)
-{
-	if (data == NULL)
-		return;
-
-	g_free (data->thumb_path);
-	g_free (data->mime_type);
-	g_free (data->uri_str);
-	g_free (data);
-}
-
-static EogThumbData*
-eog_thumb_data_new (GnomeVFSURI *uri, GError **error)
-{
-	EogThumbData *data;
-	GnomeVFSFileInfo *info;
-	GnomeVFSResult result;
-
-	g_return_val_if_fail (uri != NULL, NULL);
-	g_return_val_if_fail (error != NULL && *error == NULL, NULL);
-	
-	data = g_new0 (EogThumbData, 1);
-	
-	data->uri_str    = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
-	data->thumb_path = gnome_thumbnail_path_for_uri (data->uri_str, GNOME_THUMBNAIL_SIZE_NORMAL);
-
-	info    = gnome_vfs_file_info_new ();
-	result  = gnome_vfs_get_file_info_uri (uri, info, 
-					       GNOME_VFS_FILE_INFO_DEFAULT |
-					       GNOME_VFS_FILE_INFO_FOLLOW_LINKS |
-					       GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
-	
-	if (result != GNOME_VFS_OK) {
-		set_vfs_error (error, result);
-	}
-	else if (((info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MTIME) == 0) ||
-		 ((info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE) == 0)) {
-		/* check required info fields */
-		set_thumb_error (error, EOG_THUMB_ERROR_GENERIC, "MTime or mime type not available");
-	}
-	
-	if (*error == NULL) {
-		/* if available, copy data */
-		data->mtime = info->mtime;
-		data->mime_type = g_strdup (info->mime_type);
-	}
-	else {
-		eog_thumb_data_free (data);
-		data = NULL;
-	}
-
-	gnome_vfs_file_info_unref (info);
-
-	return data;
-}
 
 static void
 draw_frame_row (GdkPixbuf *frame_image, 
@@ -414,69 +259,10 @@
 	*thumbnail = result_pixbuf;
 }
 
-void
-eog_thumbnail_fit_to_size (GdkPixbuf **thumbnail, gint dimension)
-{
-	gint width, height;
-
-	width = gdk_pixbuf_get_width (*thumbnail);
-	height = gdk_pixbuf_get_height (*thumbnail);
-
-	if (width > dimension || height > dimension) {
-		GdkPixbuf *result_pixbuf;
-		gfloat factor;
-
-		if (width > height) {
-			factor = (gfloat) dimension / (gfloat) width;
-		} else {
-			factor = (gfloat) dimension / (gfloat) height;			
-		}
-		
-		width  = MAX (width  * factor, 1);
-		height = MAX (height * factor, 1);
-		
-		result_pixbuf = gnome_thumbnail_scale_down_pixbuf (*thumbnail, 
-							           width, height);
-		
-		g_object_unref (*thumbnail);
-
-		*thumbnail = result_pixbuf;
-	}
-}
-
-GdkPixbuf*
-eog_thumbnail_load (GnomeVFSURI *uri, GError **error)
-{
-	GdkPixbuf *thumb = NULL;
-	EogThumbData *data;
-
-	g_return_val_if_fail (uri != NULL, NULL);
-	g_return_val_if_fail (error != NULL && *error == NULL, NULL);
-	
-	data = eog_thumb_data_new (uri, error);
-
-	if (data == NULL)
-		return NULL;
-
-	/* check if there is already a valid thumbnail */
-	thumb = get_valid_thumbnail (data, error);
-
-	if (*error == NULL && thumb == NULL) {
-		thumb = create_thumbnail (data, error);
-	}
-
-	eog_thumb_data_free (data);
-
-	return thumb;
-}
 
 void
 eog_thumbnail_init (void)
 {
-	if (factory == NULL) {
-		factory = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL);
-	}
-
 	if (frame == NULL) {
 		frame = gdk_pixbuf_new_from_file (PACKAGE_DATADIR "/pixmaps/thumbnail-frame.png", NULL);
 	}

Modified: trunk/src/eog-thumbnail.h
==============================================================================
--- trunk/src/eog-thumbnail.h	(original)
+++ trunk/src/eog-thumbnail.h	Wed Jan 30 23:15:19 2008
@@ -25,22 +25,15 @@
 #ifndef _EOG_THUMBNAIL_H_
 #define _EOG_THUMBNAIL_H_
 
-#include <libgnomevfs/gnome-vfs.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 
 G_BEGIN_DECLS
 
 void          eog_thumbnail_init        (void);
 
-void          eog_thumbnail_fit_to_size (GdkPixbuf **thumbnail, 
-					 gint        dimension);
 
 void	      eog_thumbnail_add_frame   (GdkPixbuf **thumbnail);
 
-GdkPixbuf*    eog_thumbnail_load        (GnomeVFSURI *uri, 
-					 GError **error);
-
-
 G_END_DECLS
 
 #endif /* _EOG_THUMBNAIL_H_ */

Modified: trunk/wscript
==============================================================================
--- trunk/wscript	(original)
+++ trunk/wscript	Wed Jan 30 23:15:19 2008
@@ -45,7 +45,6 @@
 	conf.check_pkg('hal', destvar='HAL', vnum='0.5.0', mandatory=True)
 	conf.check_pkg('gstreamer-0.10', destvar='GSTREAMER', vnum='0.10.15', mandatory=True)
 	conf.check_pkg('gstreamer-plugins-base-0.10', destvar='GSTREAMER_PLUGINS_BASE', vnum='0.10.15', mandatory=True)
-	conf.check_pkg('gnome-vfs-2.0', destvar='GNOME_VFS', vnum='2.18.0', mandatory=True)
 	conf.check_pkg('libgnomeui-2.0', destvar='LIBGNOMEUI', vnum='2.20.0', mandatory=True)
 	conf.check_pkg('libebook-1.2', destvar='LIBEBOOK', vnum='1.12.0', mandatory=True)
 	conf.check_pkg('xxf86vm', destvar='XXF86VM', vnum='1.0.0', mandatory=True)



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