INSTALL added --without-gio configure option.

2008-03-11  Sven Neumann  <sven@gimp.org>

	* INSTALL
	* configure.in: added --without-gio configure option.

	* plug-ins/uri/Makefile.am: prefer the GIO backend.

	* plug-ins/uri/uri-backend-gio.c
	* plug-ins/uri/uri-backend-libcurl.c
	* plug-ins/uri/uri-backend-gnomevfs.c: improved progress 
messages.


svn path=/trunk/; revision=25085
This commit is contained in:
Sven Neumann 2008-03-11 18:45:54 +00:00 committed by Sven Neumann
parent 10a6af62ba
commit 675f734b15
7 changed files with 97 additions and 38 deletions

View file

@ -1,3 +1,14 @@
2008-03-11 Sven Neumann <sven@gimp.org>
* INSTALL
* configure.in: added --without-gio configure option.
* plug-ins/uri/Makefile.am: prefer the GIO backend.
* plug-ins/uri/uri-backend-gio.c
* plug-ins/uri/uri-backend-libcurl.c
* plug-ins/uri/uri-backend-gnomevfs.c: improved progress messages.
2008-03-11 Sven Neumann <sven@gimp.org>
* configure.in: added a check for gio-2.0.

View file

@ -165,6 +165,9 @@ These are:
--without-print. If for some reason you don't want to build the Print
plug-in based on the GtkPrint API, you can build with --without-print.
--without-gio. If you don't want to use GIO to access remote
files, you can pass --without-gio to the configure script.
--without-gnomevfs. If you don't want to use gnomevfs to access remote
files, you can pass --without-gnomevfs to the configure script.

View file

@ -1302,15 +1302,23 @@ AC_SUBST(LIBPOPPLER)
uri_plugin=no
PKG_CHECK_MODULES(GIO, gio-2.0, have_gio=yes, have_gio=no)
AC_MSG_RESULT($have_gio)
AC_ARG_WITH(gio, [ --without-gio build without GIO support])
have_gio="no (disabled)"
if test "x$with_gio" != xno; then
PKG_CHECK_MODULES(GIO, gio-2.0,
have_gio=yes,
AC_MSG_RESULT([no])
have_gio="no (gio-2.0 not found)")
fi
AM_CONDITIONAL(HAVE_GIO, test "x$have_gio" = xyes)
gnome_vfs_modules="gnome-vfs-2.0 >= gnome_vfs_required_version"
AC_ARG_WITH(gnomevfs, [ --without-gnomevfs build without gnomevfs support])
AC_ARG_WITH(gnomevfs, [ --without-gnomevfs build without gnomevfs support])
have_gnomeui="no (disabled)"
have_gnome_keyring="no (disabled)"
@ -1360,7 +1368,9 @@ fi
AM_CONDITIONAL(HAVE_LIBCURL, test "x$have_libcurl" = xyes)
if test "x$have_gnomevfs" = xyes; then
if test "x$have_gio" = xyes; then
uri_plugin="yes (using GIO)"
elif test "x$have_gnomevfs" = xyes; then
uri_plugin="yes (using gnome-vfs)"
elif test "x$have_libcurl" = xyes; then
uri_plugin="yes (using libcurl)"

View file

@ -18,6 +18,11 @@ libexecdir = $(gimpplugindir)/plug-ins
libexec_PROGRAMS = uri
if HAVE_GIO
backend_sources = uri-backend-gio.c
backend_cflags = $(GIO_CFLAGS)
backend_libs = $(GIO_LIBS)
else
if HAVE_GNOMEVFS
backend_sources = uri-backend-gnomevfs.c
backend_cflags = $(URI_GNOME_VFS_CFLAGS)
@ -28,11 +33,6 @@ backend_sources = uri-backend-libcurl.c
backend_cflags = $(URI_LIBCURL_CFLAGS)
backend_libs = $(URI_LIBCURL_LIBS)
else
if HAVE_GIO
backend_sources = uri-backend-gio.c
backend_cflags = $(GIO_CFLAGS)
backend_libs = $(GIO_LIBS)
else
backend_sources = uri-backend-wget.c
backend_cflags =
backend_libs =

View file

@ -28,12 +28,18 @@
#include "libgimp/stdplugins-intl.h"
typedef enum
{
DOWNLOAD,
UPLOAD
} Mode;
/* local function prototypes */
static gchar * get_protocols (void);
static gboolean copy_uri (const gchar *src_uri,
const gchar *dest_uri,
const gchar *format,
Mode mode,
GError **error);
@ -50,6 +56,11 @@ uri_backend_init (const gchar *plugin_name,
GimpRunMode run_mode,
GError **error)
{
if (run_mode == GIMP_RUN_INTERACTIVE)
{
gimp_ui_init (plugin_name, FALSE);
}
return TRUE;
}
@ -98,16 +109,9 @@ uri_backend_load_image (const gchar *uri,
gboolean success;
dest_uri = g_filename_to_uri (tmpname, NULL, NULL);
success = copy_uri (uri, dest_uri,
_("Downloading image (%s of %s)..."),
error);
success = copy_uri (uri, dest_uri, DOWNLOAD, error);
g_free (dest_uri);
if (*error)
{
g_printerr ("uri_backend_load_image: %s\n", (*error)->message);
}
return success;
}
@ -121,16 +125,9 @@ uri_backend_save_image (const gchar *uri,
gboolean success;
src_uri = g_filename_to_uri (tmpname, NULL, NULL);
success = copy_uri (src_uri, uri,
_("Uploading image (%s of %s)..."),
error);
success = copy_uri (src_uri, uri, UPLOAD, error);
g_free (src_uri);
if (*error)
{
g_printerr ("uri_backend_save_image: %s\n", (*error)->message);
}
return success;
}
@ -171,22 +168,60 @@ uri_progress_callback (goffset current_num_bytes,
goffset total_num_bytes,
gpointer user_data)
{
gchar *done = gimp_memsize_to_string (current_num_bytes);
gchar *total = gimp_memsize_to_string (total_num_bytes);
Mode mode = GPOINTER_TO_INT (user_data);
gimp_progress_set_text_printf ((const gchar *) user_data, done, total);
if (total_num_bytes > 0)
{
const gchar *format;
gchar *done = gimp_memsize_to_string (current_num_bytes);
gchar *total = gimp_memsize_to_string (total_num_bytes);
if (total_num_bytes)
gimp_progress_update (current_num_bytes / total_num_bytes);
switch (mode)
{
case DOWNLOAD:
format = _("Downloading image (%s of %s)");
break;
case UPLOAD:
format = _("Uploading image (%s of %s)");
break;
default:
g_assert_not_reached ();
}
g_free (total);
g_free (done);
gimp_progress_set_text_printf (format, done, total);
gimp_progress_update (current_num_bytes / total_num_bytes);
g_free (total);
g_free (done);
}
else
{
const gchar *format;
gchar *done = gimp_memsize_to_string (current_num_bytes);
switch (mode)
{
case DOWNLOAD:
format = _("Downloaded %s of image data");
break;
case UPLOAD:
format = _("Uploaded %s of image data");
break;
default:
g_assert_not_reached ();
}
gimp_progress_set_text_printf (format, done);
gimp_progress_pulse ();
g_free (done);
}
}
static gboolean
copy_uri (const gchar *src_uri,
const gchar *dest_uri,
const gchar *format,
Mode mode,
GError **error)
{
GVfs *vfs;
@ -202,7 +237,7 @@ copy_uri (const gchar *src_uri,
gimp_progress_init (_("Connecting to server"));
success = g_file_copy (src_file, dest_file, G_FILE_COPY_OVERWRITE, NULL,
uri_progress_callback, (gpointer) format,
uri_progress_callback, GINT_TO_POINTER (mode),
error);
g_object_unref (src_file);

View file

@ -159,7 +159,7 @@ uri_backend_load_image (const gchar *uri,
dest_uri = g_filename_to_uri (tmpname, NULL, NULL);
success = copy_uri (uri, dest_uri,
_("Downloading %s of image data..."),
_("Downloading %s of image data"),
_("Downloaded %s of image data"),
error);
g_free (dest_uri);
@ -178,7 +178,7 @@ uri_backend_save_image (const gchar *uri,
src_uri = g_filename_to_uri (tmpname, NULL, NULL);
success = copy_uri (src_uri, uri,
_("Uploading %s of image data..."),
_("Uploading %s of image data"),
_("Uploaded %s of image data"),
error);
g_free (src_uri);

View file

@ -123,7 +123,7 @@ progress_callback (void *clientp,
if (dltotal > 0.0)
{
memsize = gimp_memsize_to_string (dltotal);
gimp_progress_set_text_printf (_("Downloading %s of image data..."),
gimp_progress_set_text_printf (_("Downloading %s of image data"),
memsize);
gimp_progress_update (dlnow / dltotal);
}