f-spot r4601 - in trunk: . libeog libfspot src/Imaging
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4601 - in trunk: . libeog libfspot src/Imaging
- Date: Thu, 20 Nov 2008 11:17:30 +0000 (UTC)
Author: sdelcroix
Date: Thu Nov 20 11:17:29 2008
New Revision: 4601
URL: http://svn.gnome.org/viewvc/f-spot?rev=4601&view=rev
Log:
port GnomeVFS to Gio, fix headers inclusion.
2008-11-20 Stephane Delcroix <sdelcroix novell com>
* configure.in: check for gio-2.0
* libeog/Makefile.am:
* libfspot/Makefile.am: add the G_*_DISABLE_SINGLE_INCLUDES and
DISABLE_DEPRECATED flags to fullfill GnomeGoals.
* libfspot/*:
* libeog/*: fix the build for the new flags, move the GnomeVFS
code to Gio.
* src/Imaging/JpegUtils.cs: comment out never used methods.
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/libeog/Makefile.am
trunk/libeog/cursors.h
trunk/libeog/eog-image.c
trunk/libeog/eog-image.h
trunk/libeog/image-view.c
trunk/libeog/image-view.h
trunk/libeog/ui-image.c
trunk/libeog/ui-image.h
trunk/libfspot/Makefile.am
trunk/libfspot/f-jpeg-utils.c
trunk/libfspot/f-jpeg-utils.h
trunk/libfspot/f-pixbuf-utils.c
trunk/libfspot/f-utils.c
trunk/src/Imaging/JpegUtils.cs
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Thu Nov 20 11:17:29 2008
@@ -58,6 +58,7 @@
LIBGNOMEUI_REQUIRED=2.2
LIBEXIF_REQUIRED_MIN=0.5.7
LIBEXIF_REQUIRED_MAX=0.7.0
+GIO_REQUIRED=2.16.0
GTKSHARP_REQUIRED=2.10
MONO_REQUIRED=1.2.4
GTK_REQUIRED=2.10
@@ -69,7 +70,7 @@
LCMS_REQUIRED=1.12
dnl -- LIBGPHOTO2_REQUIRED=2.1.4
-PKG_CHECK_MODULES(F, libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libexif >= $LIBEXIF_REQUIRED_MIN libexif < $LIBEXIF_REQUIRED_MAX glade-sharp-2.0 >= $GTKSHARP_REQUIRED gnome-vfs-sharp-2.0 >= $GTKSHARP_REQUIRED gtk+-2.0 >= $GTK_REQUIRED mono >= $MONO_REQUIRED mono-cairo >= $MONO_CAIRO_REQUIRED)
+PKG_CHECK_MODULES(F, libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libexif >= $LIBEXIF_REQUIRED_MIN libexif < $LIBEXIF_REQUIRED_MAX glade-sharp-2.0 >= $GTKSHARP_REQUIRED gnome-vfs-sharp-2.0 >= $GTKSHARP_REQUIRED gtk+-2.0 >= $GTK_REQUIRED mono >= $MONO_REQUIRED mono-cairo >= $MONO_CAIRO_REQUIRED gio-2.0 >= $GIO_REQUIRED)
AC_SUBST(F_CFLAGS)
AC_SUBST(F_LIBS)
Modified: trunk/libeog/Makefile.am
==============================================================================
--- trunk/libeog/Makefile.am (original)
+++ trunk/libeog/Makefile.am Thu Nov 20 11:17:29 2008
@@ -4,6 +4,11 @@
-DG_LOG_DOMAIN=\"libfspoteog\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEOG_ETTORE_CHANGES=1 \
+ -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED \
+ -DG_DISABLE_SINGLE_INCLUDES \
+ -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES \
+ -DGTK_DISABLE_SINGLE_INCLUDES \
-I$(srcdir) -I$(top_srcdir) \
-I$(top_srcdir)/src \
-I$(top_builddir) \
Modified: trunk/libeog/cursors.h
==============================================================================
--- trunk/libeog/cursors.h (original)
+++ trunk/libeog/cursors.h Thu Nov 20 11:17:29 2008
@@ -22,7 +22,7 @@
#ifndef CURSORS_H
#define CURSORS_H
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
typedef enum {
CURSOR_HAND_OPEN,
Modified: trunk/libeog/eog-image.c
==============================================================================
--- trunk/libeog/eog-image.c (original)
+++ trunk/libeog/eog-image.c Thu Nov 20 11:17:29 2008
@@ -1,10 +1,8 @@
#include <glib/gi18n.h>
-#include <glib/gthread.h>
-#include <glib/gqueue.h>
+#include <glib.h>
#include <libgnomeui/gnome-thumbnail.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs.h>
#include "libeog-marshal.h"
#include "eog-image.h"
@@ -18,7 +16,7 @@
static GStaticMutex jobs_mutex = G_STATIC_MUTEX_INIT;
struct _EogImagePrivate {
- GnomeVFSURI *uri;
+ GFile *uri;
EogImageLoadMode mode;
GdkPixbuf *image;
@@ -101,6 +99,26 @@
return TRUE;
}
+//partly from libsoup/soup-date.c
+static time_t
+g_time_val_to_time_t (GTimeVal *timeval)
+{
+ GDate *date = g_date_new ();
+ GDate *epoch = g_date_new_dmy (1, 1, 1970);
+ g_date_set_time_val (date, timeval);
+
+ if (date->year < 1970)
+ return 0;
+
+ if (sizeof (time_t) == 4 && date->year > 2038)
+ return (time_t)0x7fffffff;
+
+ time_t tt = 24 * 3600 * g_date_days_between (epoch, date);
+ g_free (date);
+ g_free (epoch);
+ return tt;
+}
+
static gpointer
create_thumbnails (gpointer data)
{
@@ -128,7 +146,7 @@
priv = image->priv;
- uri_str = gnome_vfs_uri_to_string (priv->uri, GNOME_VFS_URI_HIDE_NONE);
+ uri_str = g_file_get_uri (priv->uri);
#if THUMB_DEBUG
g_message ("uri: %s", uri_str);
#endif
@@ -143,31 +161,33 @@
}
else {
GnomeThumbnailFactory *factory;
- GnomeVFSFileInfo *info;
- GnomeVFSResult result;
-
- info = gnome_vfs_file_info_new ();
- result = gnome_vfs_get_file_info_uri (priv->uri, info,
- GNOME_VFS_FILE_INFO_DEFAULT |
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
-
- if (result == GNOME_VFS_OK &&
- (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MTIME) != 0 &&
- (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE) != 0)
- {
+ GFileInfo *info;
+ GError *err = NULL;
+
+ info = g_file_query_info (priv->uri,
+ "standard::fast-content-type,time::modified",
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ &err);
+
+ if (err == NULL) {
#if THUMB_DEBUG
g_print ("uri: %s, mtime: %i, mime_type %s\n", uri_str, info->mtime, info->mime_type);
#endif
factory = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL);
+ GTimeVal *mtime;
+ g_file_info_get_modification_time (info, mtime);
+ time_t mtime_t = g_time_val_to_time_t (mtime);
+ g_free (mtime);
- if (!gnome_thumbnail_factory_has_valid_failed_thumbnail (factory, uri_str, info->mtime) &&
- gnome_thumbnail_factory_can_thumbnail (factory, uri_str, info->mime_type, info->mtime))
+ if (!gnome_thumbnail_factory_has_valid_failed_thumbnail (factory, uri_str, mtime_t) &&
+ gnome_thumbnail_factory_can_thumbnail (factory, uri_str, g_file_info_get_content_type (info), mtime_t))
{
- priv->thumbnail = gnome_thumbnail_factory_generate_thumbnail (factory, uri_str, info->mime_type);
+ priv->thumbnail = gnome_thumbnail_factory_generate_thumbnail (factory, uri_str, g_file_info_get_content_type(info));
if (priv->thumbnail != NULL) {
- gnome_thumbnail_factory_save_thumbnail (factory, priv->thumbnail, uri_str, info->mtime);
+ gnome_thumbnail_factory_save_thumbnail (factory, priv->thumbnail, uri_str, mtime_t);
}
}
@@ -179,7 +199,7 @@
#endif
}
- gnome_vfs_file_info_unref (info);
+ g_object_unref (info);
}
g_free (uri_str);
@@ -256,7 +276,7 @@
priv = EOG_IMAGE (object)->priv;
if (priv->uri) {
- gnome_vfs_uri_unref (priv->uri);
+ g_object_unref (priv->uri);
priv->uri = NULL;
}
@@ -382,7 +402,7 @@
}
EogImage*
-eog_image_new_uri (GnomeVFSURI *uri, EogImageLoadMode mode)
+eog_image_new_uri (GFile *uri, EogImageLoadMode mode)
{
EogImage *img;
EogImagePrivate *priv;
@@ -390,7 +410,7 @@
img = EOG_IMAGE (g_object_new (EOG_TYPE_IMAGE, NULL));
priv = img->priv;
- priv->uri = gnome_vfs_uri_ref (uri);
+ priv->uri = g_object_ref (uri);
priv->mode = mode;
priv->modified = FALSE;
@@ -400,12 +420,12 @@
EogImage*
eog_image_new (const char *txt_uri, EogImageLoadMode mode)
{
- GnomeVFSURI *uri;
+ GFile *uri;
EogImage *image;
- uri = gnome_vfs_uri_new (txt_uri);
+ uri = g_file_new_for_uri (txt_uri);
image = eog_image_new_uri (uri, mode);
- gnome_vfs_uri_unref (uri);
+ g_object_unref (uri);
return image;
}
@@ -468,11 +488,11 @@
EogImage *img;
EogImagePrivate *priv;
GdkPixbufLoader *loader;
- GnomeVFSResult result;
- GnomeVFSHandle *handle;
guchar *buffer;
- GnomeVFSFileSize bytes_read;
+ gssize bytes_read;
gboolean failed;
+ GError *err = NULL;
+ GFileInputStream *inputstream;
img = EOG_IMAGE (data);
priv = img->priv;
@@ -483,10 +503,11 @@
g_assert (priv->image == NULL);
- result = gnome_vfs_open_uri (&handle, priv->uri, GNOME_VFS_OPEN_READ);
- if (result != GNOME_VFS_OK) {
- g_signal_emit (G_OBJECT (img), eog_image_signals [SIGNAL_LOADING_FAILED], 0, gnome_vfs_result_to_string (result));
- g_print ("VFS Error: %s\n", gnome_vfs_result_to_string (result));
+
+ inputstream = g_file_read (priv->uri, NULL, &err);
+ if (err == NULL) {
+ g_signal_emit (G_OBJECT (img), eog_image_signals [SIGNAL_LOADING_FAILED], 0, err->message);
+ g_print ("g_file_read error: %s\n", err->message);
return FALSE;
}
@@ -500,11 +521,12 @@
}
while (TRUE) {
- result = gnome_vfs_read (handle, buffer, 4096, &bytes_read);
- if (result == GNOME_VFS_ERROR_EOF || bytes_read == 0) {
+ bytes_read = g_input_stream_read (G_INPUT_STREAM (inputstream), buffer, 4096, NULL, &err);
+// result = gnome_vfs_read (handle, buffer, 4096, &bytes_read);
+ if (bytes_read == 0) {
break;
}
- else if (result != GNOME_VFS_OK) {
+ else if (err != NULL) {
failed = TRUE;
break;
}
@@ -522,7 +544,7 @@
}
g_free (buffer);
- gnome_vfs_close (handle);
+ g_input_stream_close (G_INPUT_STREAM(inputstream), NULL, NULL);
if (failed) {
if (priv->image != NULL) {
@@ -564,34 +586,34 @@
if (priv->image == NULL && priv->load_idle_id == 0)
{
if (priv->mode == EOG_IMAGE_LOAD_DEFAULT) {
- if (gnome_vfs_uri_is_local (priv->uri)) {
- GnomeVFSFileInfo *info;
- GnomeVFSResult result;
- info = gnome_vfs_file_info_new ();
-
- result = gnome_vfs_get_file_info_uri (priv->uri,
- info,
- GNOME_VFS_FILE_INFO_DEFAULT);
-
- if (result != GNOME_VFS_OK) {
- g_signal_emit (G_OBJECT (img), eog_image_signals [SIGNAL_LOADING_FAILED],
- 0, gnome_vfs_result_to_string (result));
- g_print ("VFS Error: %s\n", gnome_vfs_result_to_string (result));
- return FALSE;
- }
-
- priv->mode = EOG_IMAGE_LOAD_PROGRESSIVE;
- if (((info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) != 0) &&
- (info->size < 1000000))
- {
- priv->mode = EOG_IMAGE_LOAD_COMPLETE;
- }
-
- gnome_vfs_file_info_unref (info);
- }
- else {
+// if (gnome_vfs_uri_is_local (priv->uri)) {
+// GnomeVFSFileInfo *info;
+// GnomeVFSResult result;
+// info = gnome_vfs_file_info_new ();
+//
+// result = gnome_vfs_get_file_info_uri (priv->uri,
+// info,
+// GNOME_VFS_FILE_INFO_DEFAULT);
+//
+// if (result != GNOME_VFS_OK) {
+// g_signal_emit (G_OBJECT (img), eog_image_signals [SIGNAL_LOADING_FAILED],
+// 0, gnome_vfs_result_to_string (result));
+// g_print ("VFS Error: %s\n", gnome_vfs_result_to_string (result));
+// return FALSE;
+// }
+//
+// priv->mode = EOG_IMAGE_LOAD_PROGRESSIVE;
+// if (((info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) != 0) &&
+// (info->size < 1000000))
+// {
+// priv->mode = EOG_IMAGE_LOAD_COMPLETE;
+// }
+//
+// gnome_vfs_file_info_unref (info);
+// }
+// else {
priv->mode = EOG_IMAGE_LOAD_PROGRESSIVE;
- }
+// }
}
priv->load_idle_id = g_idle_add (real_image_load, img);
@@ -750,61 +772,61 @@
g_signal_emit (G_OBJECT (img), eog_image_signals [SIGNAL_CHANGED], 0);
}
-gboolean
-eog_image_save (EogImage *img, const GnomeVFSURI *uri, GError **error)
-{
- EogImagePrivate *priv;
- char *file;
- char *file_type = NULL;
-
- g_return_val_if_fail (EOG_IS_IMAGE (img), FALSE);
- g_return_val_if_fail (uri != NULL, FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- priv = img->priv;
-
- if (priv->image == NULL) {
- g_set_error (error, EOG_IMAGE_ERROR,
- EOG_IMAGE_ERROR_NOT_LOADED,
- _("No image loaded."));
- return FALSE;
- }
-
- if (!gnome_vfs_uri_is_local (uri)) {
- g_set_error (error, EOG_IMAGE_ERROR,
- EOG_IMAGE_ERROR_SAVE_NOT_LOCAL,
- _("Can't save non local files."));
- return FALSE;
- }
-
- file = (char*) gnome_vfs_uri_get_path (uri); /* don't free file */
-
- if (g_str_has_suffix (file, ".png")) {
- file_type = "png";
- }
- else if (g_str_has_suffix (file, ".jpg") ||
- g_str_has_suffix (file, ".jpeg"))
- {
- file_type = "jpeg";
- }
-#if 0
- else if (g_str_has_suffix (file, ".xpm")) {
- return eog_image_helper_save_xpm (priv->image, file, error);
- }
-#endif
-
- if (file_type == NULL) {
- g_set_error (error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("Unsupported image type for saving."));
- return FALSE;
- }
- else {
- return gdk_pixbuf_save (priv->image, file, file_type, error, NULL);
- }
-
- return FALSE;
-}
+//gboolean
+//eog_image_save (EogImage *img, const GFile *uri, GError **error)
+//{
+// EogImagePrivate *priv;
+// char *file;
+// char *file_type = NULL;
+//
+// g_return_val_if_fail (EOG_IS_IMAGE (img), FALSE);
+// g_return_val_if_fail (uri != NULL, FALSE);
+// g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+//
+// priv = img->priv;
+//
+// if (priv->image == NULL) {
+// g_set_error (error, EOG_IMAGE_ERROR,
+// EOG_IMAGE_ERROR_NOT_LOADED,
+// _("No image loaded."));
+// return FALSE;
+// }
+//
+// if (!gnome_vfs_uri_is_local (uri)) {
+// g_set_error (error, EOG_IMAGE_ERROR,
+// EOG_IMAGE_ERROR_SAVE_NOT_LOCAL,
+// _("Can't save non local files."));
+// return FALSE;
+// }
+//
+// file = (char*) gnome_vfs_uri_get_path (uri); /* don't free file */
+//
+// if (g_str_has_suffix (file, ".png")) {
+// file_type = "png";
+// }
+// else if (g_str_has_suffix (file, ".jpg") ||
+// g_str_has_suffix (file, ".jpeg"))
+// {
+// file_type = "jpeg";
+// }
+//#if 0
+// else if (g_str_has_suffix (file, ".xpm")) {
+// return eog_image_helper_save_xpm (priv->image, file, error);
+// }
+//#endif
+//
+// if (file_type == NULL) {
+// g_set_error (error, GDK_PIXBUF_ERROR,
+// GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
+// _("Unsupported image type for saving."));
+// return FALSE;
+// }
+// else {
+// return gdk_pixbuf_save (priv->image, file, file_type, error, NULL);
+// }
+//
+// return FALSE;
+//}
gchar*
eog_image_get_caption (EogImage *img)
@@ -818,7 +840,7 @@
if (priv->uri == NULL)
return NULL;
- return gnome_vfs_uri_extract_short_name (priv->uri);
+ return g_file_get_basename (priv->uri);
}
void
Modified: trunk/libeog/eog-image.h
==============================================================================
--- trunk/libeog/eog-image.h (original)
+++ trunk/libeog/eog-image.h Thu Nov 20 11:17:29 2008
@@ -2,7 +2,7 @@
#define _EOG_IMAGE_H_
#include <glib-object.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
+#include <gio/gio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
@@ -60,14 +60,14 @@
/* loading API */
EogImage* eog_image_new (const char *txt_uri, EogImageLoadMode mode);
-EogImage* eog_image_new_uri (GnomeVFSURI *uri, EogImageLoadMode mode);
+EogImage* eog_image_new_uri (GFile *uri, EogImageLoadMode mode);
gboolean eog_image_load (EogImage *img);
gboolean eog_image_load_thumbnail (EogImage *img);
void eog_image_free_mem (EogImage *img);
/* saving API */
gboolean eog_image_save (EogImage *img,
- const GnomeVFSURI *uri,
+ const GFile *uri,
GError **error);
/* query API */
Modified: trunk/libeog/image-view.c
==============================================================================
--- trunk/libeog/image-view.c (original)
+++ trunk/libeog/image-view.c Thu Nov 20 11:17:29 2008
@@ -26,7 +26,7 @@
#include <stdlib.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkmain.h>
+#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "cursors.h"
#include "image-view.h"
Modified: trunk/libeog/image-view.h
==============================================================================
--- trunk/libeog/image-view.h (original)
+++ trunk/libeog/image-view.h Thu Nov 20 11:17:29 2008
@@ -22,9 +22,9 @@
#ifndef IMAGE_VIEW_H
#define IMAGE_VIEW_H
-#include <glib/gmacros.h>
+#include <glib.h>
#include <gconf/gconf-client.h>
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
Modified: trunk/libeog/ui-image.c
==============================================================================
--- trunk/libeog/ui-image.c (original)
+++ trunk/libeog/ui-image.c Thu Nov 20 11:17:29 2008
@@ -20,8 +20,6 @@
*/
#include <config.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkwindow.h>
#include "image-view.h"
#include "ui-image.h"
Modified: trunk/libeog/ui-image.h
==============================================================================
--- trunk/libeog/ui-image.h (original)
+++ trunk/libeog/ui-image.h Thu Nov 20 11:17:29 2008
@@ -22,7 +22,7 @@
#ifndef UI_IMAGE_H
#define UI_IMAGE_H
-#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
Modified: trunk/libfspot/Makefile.am
==============================================================================
--- trunk/libfspot/Makefile.am (original)
+++ trunk/libfspot/Makefile.am Thu Nov 20 11:17:29 2008
@@ -4,6 +4,9 @@
-DG_LOG_DOMAIN=\"libf\" \
-DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED \
+ -DG_DISABLE_SINGLE_INCLUDES \
+ -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES \
+ -DGTK_DISABLE_SINGLE_INCLUDES \
$(F_CFLAGS) \
$(EXIF_CFLAGS) \
$(LCMS_CFLAGS) \
Modified: trunk/libfspot/f-jpeg-utils.c
==============================================================================
--- trunk/libfspot/f-jpeg-utils.c (original)
+++ trunk/libfspot/f-jpeg-utils.c Thu Nov 20 11:17:29 2008
@@ -42,10 +42,7 @@
#include "libjpegtran/jpegtran.h"
#include <glib.h>
-
-#include <libgnomevfs/gnome-vfs-types.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
+#include <gio/gio.h>
#include <libexif/exif-data.h>
#include <libexif/exif-content.h>
@@ -59,7 +56,7 @@
typedef struct {
struct jpeg_source_mgr pub; /* public fields */
- GnomeVFSHandle *handle;
+ GInputStream *stream;
JOCTET buffer[BUFFER_SIZE];
} Source;
@@ -94,16 +91,17 @@
fill_input_buffer (j_decompress_ptr cinfo)
{
Source *src;
- GnomeVFSFileSize nbytes;
- GnomeVFSResult result;
+ gssize nbytes;
+ GError *err = NULL;
src = (Source *) cinfo->src;
- result = gnome_vfs_read (src->handle,
- src->buffer,
- G_N_ELEMENTS (src->buffer),
- &nbytes);
+ nbytes = g_input_stream_read (src->stream,
+ src->buffer,
+ G_N_ELEMENTS (src->buffer),
+ NULL,
+ &err);
- if (result != GNOME_VFS_OK || nbytes == 0) {
+ if (err == NULL || nbytes == 0) {
/* return a fake EOI marker so we will eventually terminate */
src->buffer[0] = (JOCTET) 0xFF;
src->buffer[1] = (JOCTET) JPEG_EOI;
@@ -138,7 +136,7 @@
}
static void
-vfs_src (j_decompress_ptr cinfo, GnomeVFSHandle *handle)
+gio_src (j_decompress_ptr cinfo, GInputStream *stream)
{
Source *src;
@@ -152,13 +150,13 @@
src->pub.skip_input_data = skip_input_data;
src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
src->pub.term_source = term_source;
- src->handle = handle;
+ src->stream = stream;
src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
src->pub.next_input_byte = NULL; /* until buffer loaded */
}
static void
-vfs_src_free (j_decompress_ptr cinfo)
+gio_src_free (j_decompress_ptr cinfo)
{
g_free (cinfo->src);
}
@@ -195,13 +193,13 @@
{
struct jpeg_decompress_struct cinfo;
ErrorHandlerData jerr;
- GnomeVFSHandle *handle;
unsigned char *lines[1];
guchar * volatile buffer;
guchar * volatile pixels;
guchar *ptr;
- guchar *uri;
- GnomeVFSResult result;
+ GFile *uri;
+ GFileInputStream *input_stream;
+ GError *err = NULL;
unsigned int i;
g_return_val_if_fail (g_path_is_absolute (path), NULL);
@@ -211,11 +209,11 @@
if (original_height_return != NULL)
*original_height_return = 0;
- uri = g_strconcat ("file://", path, NULL);
- result = gnome_vfs_open (&handle, uri, GNOME_VFS_OPEN_READ);
- g_free (uri);
+ uri = g_file_new_for_path (path);
+ input_stream = g_file_read (uri, NULL, &err);
+ g_object_unref (uri);
- if (result != GNOME_VFS_OK)
+ if (err != NULL)
return NULL;
cinfo.err = jpeg_std_error (&jerr.pub);
@@ -227,7 +225,7 @@
if (setjmp (jerr.setjmp_buffer)) {
/* Handle a JPEG error. */
jpeg_destroy_decompress (&cinfo);
- gnome_vfs_close (handle);
+ g_input_stream_close (G_INPUT_STREAM (input_stream), NULL, NULL);
g_free (buffer);
g_free (pixels);
return NULL;
@@ -235,7 +233,7 @@
jpeg_create_decompress (&cinfo);
- vfs_src (&cinfo, handle);
+ gio_src (&cinfo, G_INPUT_STREAM (input_stream));
jpeg_read_header (&cinfo, TRUE);
if (target_width != 0 && target_height != 0) {
@@ -284,9 +282,9 @@
jpeg_destroy_decompress (&cinfo);
- vfs_src_free (&cinfo);
+ gio_src_free (&cinfo);
- gnome_vfs_close (handle);
+ g_input_stream_close (G_INPUT_STREAM (input_stream), NULL, NULL);
if (original_width_return != NULL)
*original_width_return = cinfo.image_width;
@@ -306,15 +304,15 @@
/* Public API. */
-GdkPixbuf *
-f_load_scaled_jpeg (const char *path,
- int target_width,
- int target_height,
- int *original_width_return,
- int *original_height_return)
-{
- return do_load_internal (path, target_width, target_height, original_width_return, original_height_return);
-}
+//GdkPixbuf *
+//f_load_scaled_jpeg (const char *path,
+// int target_width,
+// int target_height,
+// int *original_width_return,
+// int *original_height_return)
+//{
+// return do_load_internal (path, target_width, target_height, original_width_return, original_height_return);
+//}
/* FIXME: Error reporting in this function sucks... */
Modified: trunk/libfspot/f-jpeg-utils.h
==============================================================================
--- trunk/libfspot/f-jpeg-utils.h (original)
+++ trunk/libfspot/f-jpeg-utils.h Thu Nov 20 11:17:29 2008
@@ -31,12 +31,12 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
-GdkPixbuf *f_load_scaled_jpeg (const char *path,
- int target_width,
- int target_heigh,
- int *original_width_return,
- int *original_height_return);
-
+//GdkPixbuf *f_load_scaled_jpeg (const char *path,
+// int target_width,
+// int target_heigh,
+// int *original_width_return,
+// int *original_height_return);
+//
void f_get_jpeg_size (const char *path,
int *width_return,
int *height_return);
Modified: trunk/libfspot/f-pixbuf-utils.c
==============================================================================
--- trunk/libfspot/f-pixbuf-utils.c (original)
+++ trunk/libfspot/f-pixbuf-utils.c Thu Nov 20 11:17:29 2008
@@ -42,7 +42,7 @@
#include <math.h>
#include <stdio.h>
#include <errno.h>
-#include <gdk/gdkcairo.h>
+#include <gdk/gdk.h>
#include "f-image-surface.h"
Modified: trunk/libfspot/f-utils.c
==============================================================================
--- trunk/libfspot/f-utils.c (original)
+++ trunk/libfspot/f-utils.c Thu Nov 20 11:17:29 2008
@@ -25,7 +25,7 @@
#include "f-utils.h"
-#include <glib/gmacros.h>
+#include <glib.h>
char *
Modified: trunk/src/Imaging/JpegUtils.cs
==============================================================================
--- trunk/src/Imaging/JpegUtils.cs (original)
+++ trunk/src/Imaging/JpegUtils.cs Thu Nov 20 11:17:29 2008
@@ -3,31 +3,31 @@
using Gdk;
public class JpegUtils {
- [DllImport ("libfspot")]
- static extern IntPtr f_load_scaled_jpeg (string path,
- int target_width,
- int target_height,
- out int original_width_return,
- out int original_height_return);
-
- /* FIXME */
- [DllImport("libgobject-2.0-0.dll")]
- static extern void g_object_unref (IntPtr raw);
-
- public static Pixbuf LoadScaled (string path, int target_width, int target_height,
- out int original_width, out int original_height)
- {
- Pixbuf pixbuf = new Pixbuf (f_load_scaled_jpeg (path, target_width, target_height,
- out original_width, out original_height));
- g_object_unref (pixbuf.Handle);
- return pixbuf;
- }
-
- public static Pixbuf LoadScaled (string path, int target_width, int target_height)
- {
- int unused;
- return LoadScaled (path, target_width, target_height, out unused, out unused);
- }
+// [DllImport ("libfspot")]
+// static extern IntPtr f_load_scaled_jpeg (string path,
+// int target_width,
+// int target_height,
+// out int original_width_return,
+// out int original_height_return);
+//
+// /* FIXME */
+// [DllImport("libgobject-2.0-0.dll")]
+// static extern void g_object_unref (IntPtr raw);
+//
+// public static Pixbuf LoadScaled (string path, int target_width, int target_height,
+// out int original_width, out int original_height)
+// {
+// Pixbuf pixbuf = new Pixbuf (f_load_scaled_jpeg (path, target_width, target_height,
+// out original_width, out original_height));
+// g_object_unref (pixbuf.Handle);
+// return pixbuf;
+// }
+
+// public static Pixbuf LoadScaled (string path, int target_width, int target_height)
+// {
+// int unused;
+// return LoadScaled (path, target_width, target_height, out unused, out unused);
+// }
[DllImport ("libfspot")]
static extern void f_save_jpeg_exif (string path, HandleRef data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]