librsvg r1142 - trunk
- From: doml svn gnome org
- To: svn-commits-list gnome org
- Subject: librsvg r1142 - trunk
- Date: Sat, 2 Feb 2008 16:43:03 +0000 (GMT)
Author: doml
Date: Sat Feb 2 16:43:03 2008
New Revision: 1142
URL: http://svn.gnome.org/viewvc/librsvg?rev=1142&view=rev
Log:
2008-02-02 Jan Arne Petersen <jpetersen jpetersen org>
* Migrate to gio (#513778)
Modified:
trunk/ChangeLog
trunk/Makefile.am
trunk/configure.in
trunk/rsvg-base.c
trunk/rsvg-image.c
Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am (original)
+++ trunk/Makefile.am Sat Feb 2 16:43:03 2008
@@ -70,7 +70,7 @@
rsvg-file-util.c
librsvg_2_la_LDFLAGS = -version-info @VERSION_INFO@ -export-dynamic -no-undefined -export-symbols $(srcdir)/librsvg.def
-librsvg_2_la_LIBADD = $(LIBGNOME_VFS_LIBS) $(LIBGSF_LIBS) $(LIBCROCO_LIBS) $(LIBRSVG_LIBS) $(FREETYPE_LIBS)
+librsvg_2_la_LIBADD = $(LIBGSF_LIBS) $(LIBCROCO_LIBS) $(LIBRSVG_LIBS) $(FREETYPE_LIBS)
librsvgincdir = $(includedir)/librsvg-2/librsvg
librsvginc_HEADERS = \
@@ -79,7 +79,6 @@
librsvg-enum-types.h
INCLUDES = \
- $(LIBGNOME_VFS_CFLAGS) \
$(LIBGSF_CFLAGS) \
$(LIBCROCO_CFLAGS) \
-I$(top_srcdir) \
@@ -92,7 +91,6 @@
DEPS = $(top_builddir)/librsvg-2.la
LDADDS = \
- $(LIBGNOME_VFS_LIBS) \
$(LIBGSF_LIBS) \
$(GLIB_LIBS) \
$(LIBCROCO_LIBS) \
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Sat Feb 2 16:43:03 2008
@@ -5,6 +5,7 @@
FONTCONFIG_REQUIRED=1.0.1 dnl Same as in Pango, ???
GDK_PIXBUF_REQUIRED=1.3.7
GLIB_REQUIRED=2.12.0
+GIO_REQUIRED=2.15.4
LIBXML_REQUIRED=2.4.7
CAIRO_REQUIRED=1.2.0
PANGOFT2_REQUIRED=1.2.0
@@ -12,6 +13,7 @@
AC_SUBST(GDK_PIXBUF_REQUIRED)
AC_SUBST(GLIB_REQUIRED)
+AC_SUBST(GIO_REQUIRED)
AC_SUBST(CAIRO_REQUIRED)
AC_SUBST(LIBXML_REQUIRED)
AC_SUBST(PANGOFT2_REQUIRED)
@@ -94,6 +96,16 @@
fontconfig >= $FONTCONFIG_REQUIRED
freetype2)
+test_gio=true
+PKG_CHECK_EXISTS(gio-2.0 >= $GIO_REQUIRED, [
+ PKG_CHECK_MODULES(GIO, gio-2.0 >= $GIO_REQUIRED)
+ LIBRSVG_CFLAGS="$LIBRSVG_CFLAGS $GIO_CFLAGS"
+ LIBRSVG_LIBS="$LIBRSVG_LIBS $GIO_LIBS"
+ AC_DEFINE(HAVE_GIO, 1, [Defined if gio is avaiable])
+],[
+ test_gio=false
+])
+
AC_SUBST(LIBRSVG_LIBS)
AC_SUBST(LIBRSVG_CFLAGS)
@@ -130,34 +142,6 @@
dnl ===========================================================================
-LIBGNOME_VFS_CFLAGS=""
-LIBGNOME_VFS_LIBS=""
-
-LIBGNOME_VFS_PKG=""
-AC_ARG_ENABLE([gnome-vfs],
- [AS_HELP_STRING([--enable-gnome-vfs],[Use Gnome VFS for reading remote files (default = auto)])],
- [],[enable_gnome_vfs=auto])
-
-if test "$enable_gnome_vfs" != "no"; then
- PKG_CHECK_MODULES([LIBGNOME_VFS],[gnome-vfs-2.0 >= 1.9.16],[enable_gnome_vfs=yes],[enable_gnome_vfs=no])
-fi
-
-if test "$enable_gnome_vfs" = "yes"; then
- LIBGNOME_VFS_CFLAGS="$LIBGNOME_VFS_CFLAGS -DHAVE_GNOME_VFS=1"
- LIBGNOME_VFS_PKG="gnome-vfs-2.0"
-else
- AC_MSG_WARN([Gnome VFS support disabled, as requested (Use --enable-gnome-vfs to enable)])
-fi
-AM_CONDITIONAL([WITH_LIBGNOME_VFS],[test "$enable_gnome_vfs" = "yes"])
-
-AC_SUBST([LIBGNOME_VFS_PKG])
-AC_SUBST([GNOME_VFS_SUPPORTED],[$enable_gnome_vfs])
-
-AC_SUBST(LIBGNOME_VFS_CFLAGS)
-AC_SUBST(LIBGNOME_VFS_LIBS)
-
-dnl ===========================================================================
-
LIBCROCO_CFLAGS=""
LIBCROCO_LIBS=""
LIBCROCOPKG=""
@@ -389,7 +373,7 @@
Build theme engine: ${enable_gtk_theme}
Build Netscape plugin: ${build_mozilla_plugin}
Handle svgz files: ${test_gsf}
- Use Gnome VFS: ${test_gnome_vfs}
+ Use GIO: ${test_gio}
Enable printing: ${have_gnome_print}
Use libcroco for css parsing: ${test_croco}
"
Modified: trunk/rsvg-base.c
==============================================================================
--- trunk/rsvg-base.c (original)
+++ trunk/rsvg-base.c Sat Feb 2 16:43:03 2008
@@ -1598,10 +1598,6 @@
#endif
xmlInitParser ();
-
-#ifdef HAVE_GNOME_VFS
- gnome_vfs_init ();
-#endif
}
/**
Modified: trunk/rsvg-image.c
==============================================================================
--- trunk/rsvg-image.c (original)
+++ trunk/rsvg-image.c Sat Feb 2 16:43:03 2008
@@ -26,11 +26,16 @@
Caleb Moore <c moore student unsw edu au>
*/
+#include "config.h"
+
#include "rsvg-image.h"
#include <string.h>
#include <math.h>
#include <errno.h>
#include "rsvg-css.h"
+#ifdef HAVE_GIO
+#include <gio/gio.h>
+#endif
static const char s_UTF8_B64Alphabet[64] = {
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
@@ -292,66 +297,51 @@
return array;
}
-#ifdef HAVE_GNOME_VFS
-
-#include <libgnomevfs/gnome-vfs.h>
+#ifdef HAVE_GIO
static GByteArray *
rsvg_acquire_vfs_resource (const char *filename, const char *base_uri, GError ** error)
{
GByteArray *array;
- guchar buffer[4096];
- GnomeVFSFileSize length;
- GnomeVFSHandle *f = NULL;
- GnomeVFSResult res;
+ GFile *file;
+ char *data;
+ gsize size;
+ gboolean res;
rsvg_return_val_if_fail (filename != NULL, NULL, error);
- rsvg_return_val_if_fail (gnome_vfs_initialized (), NULL, error);
- res = gnome_vfs_open (&f, filename, GNOME_VFS_OPEN_READ);
+ file = g_file_new_for_uri (filename);
- if (res != GNOME_VFS_OK) {
- if (base_uri) {
- GnomeVFSURI *base = gnome_vfs_uri_new (base_uri);
- if (base) {
- GnomeVFSURI *uri = gnome_vfs_uri_resolve_relative (base, filename);
- if (uri) {
- res = gnome_vfs_open_uri (&f, uri, GNOME_VFS_OPEN_READ);
- gnome_vfs_uri_unref (uri);
- }
+ if (!(res = g_file_load_contents (file, NULL, &data, &size, NULL, error))) {
+ if (base_uri != NULL) {
+ GFile *base;
- gnome_vfs_uri_unref (base);
- }
+ g_error_free (*error);
+ *error = NULL;
+
+ g_object_unref (file);
+ base = g_file_new_for_uri (base_uri);
+ file = g_file_resolve_relative_path (base, filename);
+ g_object_unref (base);
+
+ res = g_file_load_contents (file, NULL, &data, &size, NULL, error);
}
}
- if (res != GNOME_VFS_OK) {
- g_set_error (error, rsvg_error_quark (), (gint) res, gnome_vfs_result_to_string (res));
- return NULL;
- }
+ g_object_unref (file);
- /* TODO: an optimization is to use the file's size */
- array = g_byte_array_new ();
+ if (res) {
+ array = g_byte_array_new ();
- while (TRUE) {
- res = gnome_vfs_read (f, buffer, sizeof (buffer), &length);
- if (res == GNOME_VFS_OK && length > 0) {
- if (g_byte_array_append (array, buffer, length) == NULL) {
- gnome_vfs_close (f);
- g_byte_array_free (array, TRUE);
- return NULL;
- }
- } else {
- break;
- }
+ g_byte_array_append (array, (guint8 *)data, size);
+ g_free (data);
+ } else {
+ return NULL;
}
- gnome_vfs_close (f);
-
return array;
}
-
#endif
GByteArray *
@@ -368,7 +358,7 @@
if (!arr)
arr = rsvg_acquire_file_resource (href, base_uri, NULL);
-#ifdef HAVE_GNOME_VFS
+#ifdef HAVE_GIO
if (!arr)
arr = rsvg_acquire_vfs_resource (href, base_uri, NULL);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]