gimp r25085 - in trunk: . plug-ins/uri
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25085 - in trunk: . plug-ins/uri
- Date: Tue, 11 Mar 2008 18:45:55 +0000 (GMT)
Author: neo
Date: Tue Mar 11 18:45:54 2008
New Revision: 25085
URL: http://svn.gnome.org/viewvc/gimp?rev=25085&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/INSTALL
trunk/configure.in
trunk/plug-ins/uri/Makefile.am
trunk/plug-ins/uri/uri-backend-gio.c
trunk/plug-ins/uri/uri-backend-gnomevfs.c
trunk/plug-ins/uri/uri-backend-libcurl.c
Modified: trunk/INSTALL
==============================================================================
--- trunk/INSTALL (original)
+++ trunk/INSTALL Tue Mar 11 18:45:54 2008
@@ -165,6 +165,9 @@
--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.
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Tue Mar 11 18:45:54 2008
@@ -1302,15 +1302,23 @@
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 @@
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)"
Modified: trunk/plug-ins/uri/Makefile.am
==============================================================================
--- trunk/plug-ins/uri/Makefile.am (original)
+++ trunk/plug-ins/uri/Makefile.am Tue Mar 11 18:45:54 2008
@@ -18,6 +18,11 @@
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_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 =
Modified: trunk/plug-ins/uri/uri-backend-gio.c
==============================================================================
--- trunk/plug-ins/uri/uri-backend-gio.c (original)
+++ trunk/plug-ins/uri/uri-backend-gio.c Tue Mar 11 18:45:54 2008
@@ -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 @@
GimpRunMode run_mode,
GError **error)
{
+ if (run_mode == GIMP_RUN_INTERACTIVE)
+ {
+ gimp_ui_init (plugin_name, FALSE);
+ }
+
return TRUE;
}
@@ -98,16 +109,9 @@
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 @@
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 @@
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);
+
+ 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 ();
+ }
- if (total_num_bytes)
- gimp_progress_update (current_num_bytes / total_num_bytes);
+ gimp_progress_set_text_printf (format, done, total);
+ gimp_progress_update (current_num_bytes / total_num_bytes);
- g_free (total);
- g_free (done);
+ 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 @@
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);
Modified: trunk/plug-ins/uri/uri-backend-gnomevfs.c
==============================================================================
--- trunk/plug-ins/uri/uri-backend-gnomevfs.c (original)
+++ trunk/plug-ins/uri/uri-backend-gnomevfs.c Tue Mar 11 18:45:54 2008
@@ -159,7 +159,7 @@
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 @@
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);
Modified: trunk/plug-ins/uri/uri-backend-libcurl.c
==============================================================================
--- trunk/plug-ins/uri/uri-backend-libcurl.c (original)
+++ trunk/plug-ins/uri/uri-backend-libcurl.c Tue Mar 11 18:45:54 2008
@@ -123,7 +123,7 @@
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]