[gimp] plug-ins: remove the libcurl and wget file-uri backends
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: remove the libcurl and wget file-uri backends
- Date: Thu, 10 Jul 2014 18:54:37 +0000 (UTC)
commit 4fbff306e6ce15ebdd06df81d774bac68bd4f824
Author: Michael Natterer <mitch gimp org>
Date: Thu Jul 10 20:50:35 2014 +0200
plug-ins: remove the libcurl and wget file-uri backends
and build file-uri unconditionally, always using GIO. Use more GFiles
instead of URIs in the plug-in in preparation of moving its
functionality to the core.
configure.ac | 38 ---
plug-ins/Makefile.am | 7 +-
plug-ins/file-uri/Makefile.am | 20 +--
plug-ins/file-uri/uri-backend-gvfs.c | 62 ++---
plug-ins/file-uri/uri-backend-libcurl.c | 275 -------------------
plug-ins/file-uri/uri-backend-wget.c | 454 -------------------------------
plug-ins/file-uri/uri-backend.h | 6 +-
plug-ins/file-uri/uri.c | 43 ++--
8 files changed, 49 insertions(+), 856 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0185be5..3ca2d67 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1496,42 +1496,6 @@ if test "x$have_cairo_pdf" = xyes && test "x$have_poppler" = xyes; then
fi
-################################
-# Check for gio/gvfs and libcurl
-################################
-
-uri_plugin=no
-
-
-AC_ARG_WITH(gvfs, [ --without-gvfs build without GIO/GVfs support])
-
-AM_CONDITIONAL(HAVE_GVFS, test "x$with_gvfs" != xno)
-
-
-AC_ARG_WITH(libcurl, [ --without-libcurl build without curl support])
-
-have_libcurl="no (disabled)"
-
-if test "x$with_libcurl" != xno; then
-
-PKG_CHECK_MODULES(CURL, libcurl >= libcurl_required_version,
- have_libcurl=yes,
- have_libcurl="no (libcurl not found)")
-
-fi
-
-AM_CONDITIONAL(HAVE_LIBCURL, test "x$have_libcurl" = xyes)
-
-
-if test "x$with_gvfs" != xno; then
- uri_plugin="yes (using GIO/GVfs)"
-elif test "x$have_libcurl" = xyes; then
- uri_plugin="yes (using libcurl)"
-elif test "x$os_win32" = xno; then
- uri_plugin="yes (using wget)"
-fi
-
-
###################
# Check for libwmf2
###################
@@ -2367,9 +2331,7 @@ Optional Plug-Ins:
TIFF: $have_libtiff
TWAIN (MacOS X): $mac_twain_ok
TWAIN (Win32): $os_win32
- URI: $uri_plugin
Webpage: $have_webkit
- Windows ICO: $have_libpng
WMF: $have_libwmf
X11 Mouse Cursor: $have_xmc
XPM: $have_libxpm
diff --git a/plug-ins/Makefile.am b/plug-ins/Makefile.am
index 91d26d6..abd265c 100644
--- a/plug-ins/Makefile.am
+++ b/plug-ins/Makefile.am
@@ -27,11 +27,6 @@ endif
if OS_WIN32
twain = twain
win_snap = win-snap
-if HAVE_LIBCURL
-file_uri = file-uri
-endif
-else
-file_uri = file-uri
endif
SUBDIRS = \
@@ -47,7 +42,7 @@ SUBDIRS = \
file-jpeg \
file-psd \
file-sgi \
- $(file_uri) \
+ file-uri \
flame \
fractal-explorer \
gfig \
diff --git a/plug-ins/file-uri/Makefile.am b/plug-ins/file-uri/Makefile.am
index a260bd2..2af8950 100644
--- a/plug-ins/file-uri/Makefile.am
+++ b/plug-ins/file-uri/Makefile.am
@@ -23,30 +23,13 @@ libexecdir = $(gimpplugindir)/plug-ins
libexec_PROGRAMS = file-uri
-if HAVE_GVFS
-backend_sources = uri-backend-gvfs.c
-backend_cflags = $(GIO_CFLAGS)
-backend_libs = $(GIO_LIBS)
-else
-if HAVE_LIBCURL
-backend_sources = uri-backend-libcurl.c
-backend_cflags = $(CURL_CFLAGS)
-backend_libs = $(CURL_LIBS)
-else
-backend_sources = uri-backend-wget.c
-backend_cflags =
-backend_libs =
-endif
-endif
-
file_uri_SOURCES = \
uri.c \
uri-backend.h \
- $(backend_sources)
+ uri-backend-gvfs.c
AM_CPPFLAGS = \
-I$(top_srcdir) \
- $(backend_cflags) \
$(GTK_CFLAGS) \
$(GEGL_CFLAGS) \
-I$(includedir)
@@ -59,7 +42,6 @@ LDADD = \
$(libgimp) \
$(libgimpcolor) \
$(libgimpbase) \
- $(backend_libs) \
$(GTK_LIBS) \
$(RT_LIBS) \
$(INTLLIBS) \
diff --git a/plug-ins/file-uri/uri-backend-gvfs.c b/plug-ins/file-uri/uri-backend-gvfs.c
index 3fb2f27..52eddef 100644
--- a/plug-ins/file-uri/uri-backend-gvfs.c
+++ b/plug-ins/file-uri/uri-backend-gvfs.c
@@ -40,8 +40,8 @@ typedef enum
static gchar * get_protocols (void);
-static gboolean copy_uri (const gchar *src_uri,
- const gchar *dest_uri,
+static gboolean copy_uri (GFile *src_file,
+ GFile *dest_file,
Mode mode,
GimpRunMode run_mode,
GError **error);
@@ -101,56 +101,48 @@ uri_backend_get_save_protocols (void)
}
gboolean
-uri_backend_load_image (const gchar *uri,
+uri_backend_load_image (GFile *file,
const gchar *tmpname,
GimpRunMode run_mode,
GError **error)
{
- gchar *dest_uri = g_filename_to_uri (tmpname, NULL, error);
+ GFile *dest_file;
+ gboolean success;
- if (dest_uri)
- {
- gboolean success = copy_uri (uri, dest_uri, DOWNLOAD, run_mode, error);
+ dest_file = g_file_new_for_path (tmpname);
- g_free (dest_uri);
+ success = copy_uri (file, dest_file, DOWNLOAD, run_mode, error);
- return success;
- }
+ g_object_unref (dest_file);
- return FALSE;
+ return success;
}
gboolean
-uri_backend_save_image (const gchar *uri,
+uri_backend_save_image (GFile *file,
const gchar *tmpname,
GimpRunMode run_mode,
GError **error)
{
- gchar *src_uri = g_filename_to_uri (tmpname, NULL, error);
+ GFile *src_file;
+ gboolean success;
- if (src_uri)
- {
- gboolean success = copy_uri (src_uri, uri, UPLOAD, run_mode, error);
+ src_file = g_file_new_for_path (tmpname);
- g_free (src_uri);
+ success = copy_uri (src_file, file, UPLOAD, run_mode, error);
- return success;
- }
+ g_object_unref (src_file);
- return FALSE;
+ return success;
}
gchar *
-uri_backend_map_image (const gchar *uri,
- GimpRunMode run_mode)
+uri_backend_map_image (GFile *file,
+ GimpRunMode run_mode)
{
- GFile *file = g_file_new_for_uri (uri);
gchar *path = NULL;
gboolean success = TRUE;
- if (! file)
- return NULL;
-
if (run_mode == GIMP_RUN_INTERACTIVE)
{
GError *error = NULL;
@@ -168,8 +160,6 @@ uri_backend_map_image (const gchar *uri,
if (success)
path = g_file_get_path (file);
- g_object_unref (file);
-
return path;
}
@@ -303,24 +293,19 @@ mount_enclosing_volume (GFile *file,
}
static gboolean
-copy_uri (const gchar *src_uri,
- const gchar *dest_uri,
+copy_uri (GFile *src_file,
+ GFile *dest_file,
Mode mode,
GimpRunMode run_mode,
GError **error)
{
- GFile *src_file;
- GFile *dest_file;
- UriProgress progress = { 0, };
- gboolean success;
+ UriProgress progress = { 0, };
+ gboolean success;
gimp_progress_init (_("Connecting to server"));
progress.mode = mode;
- src_file = g_file_new_for_uri (src_uri);
- dest_file = g_file_new_for_uri (dest_uri);
-
success = g_file_copy (src_file, dest_file, G_FILE_COPY_OVERWRITE, NULL,
uri_progress_callback, &progress,
error);
@@ -343,8 +328,5 @@ copy_uri (const gchar *src_uri,
}
}
- g_object_unref (src_file);
- g_object_unref (dest_file);
-
return success;
}
diff --git a/plug-ins/file-uri/uri-backend.h b/plug-ins/file-uri/uri-backend.h
index 1f634a1..6c8168a 100644
--- a/plug-ins/file-uri/uri-backend.h
+++ b/plug-ins/file-uri/uri-backend.h
@@ -31,15 +31,15 @@ const gchar * uri_backend_get_save_help (void);
const gchar * uri_backend_get_load_protocols (void);
const gchar * uri_backend_get_save_protocols (void);
-gboolean uri_backend_load_image (const gchar *uri,
+gboolean uri_backend_load_image (GFile *file,
const gchar *tmpname,
GimpRunMode run_mode,
GError **error);
-gboolean uri_backend_save_image (const gchar *uri,
+gboolean uri_backend_save_image (GFile *file,
const gchar *tmpname,
GimpRunMode run_mode,
GError **error);
-gchar * uri_backend_map_image (const gchar *uri,
+gchar * uri_backend_map_image (GFile *file,
GimpRunMode run_mode);
diff --git a/plug-ins/file-uri/uri.c b/plug-ins/file-uri/uri.c
index 7ae964c..ffed739 100644
--- a/plug-ins/file-uri/uri.c
+++ b/plug-ins/file-uri/uri.c
@@ -50,16 +50,16 @@ static void run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals);
-static gint32 load_image (const gchar *uri,
+static gint32 load_image (GFile *file,
GimpRunMode run_mode,
GError **error);
-static GimpPDBStatusType save_image (const gchar *uri,
+static GimpPDBStatusType save_image (GFile *file,
gint32 image_ID,
gint32 drawable_ID,
gint32 run_mode,
GError **error);
-static gchar * get_temp_name (const gchar *uri,
+static gchar * get_temp_name (GFile *file,
gboolean *name_image);
static gboolean valid_file (const gchar *filename);
@@ -197,7 +197,8 @@ run (const gchar *name,
if (! strcmp (name, LOAD_PROC) && uri_backend_get_load_protocols ())
{
- image_ID = load_image (param[2].data.d_string, run_mode, &error);
+ image_ID = load_image (g_file_new_for_uri (param[2].data.d_string),
+ run_mode, &error);
if (image_ID != -1)
{
@@ -210,7 +211,7 @@ run (const gchar *name,
}
else if (! strcmp (name, SAVE_PROC) && uri_backend_get_save_protocols ())
{
- status = save_image (param[3].data.d_string,
+ status = save_image (g_file_new_for_uri (param[3].data.d_string),
param[1].data.d_int32,
param[2].data.d_int32,
run_mode, &error);
@@ -233,7 +234,7 @@ run (const gchar *name,
}
static gint32
-load_image (const gchar *uri,
+load_image (GFile *file,
GimpRunMode run_mode,
GError **error)
{
@@ -242,7 +243,7 @@ load_image (const gchar *uri,
gchar *tmpname;
gboolean mapped = FALSE;
- tmpname = uri_backend_map_image (uri, run_mode);
+ tmpname = uri_backend_map_image (file, run_mode);
if (tmpname)
{
@@ -250,9 +251,9 @@ load_image (const gchar *uri,
}
else
{
- tmpname = get_temp_name (uri, &name_image);
+ tmpname = get_temp_name (file, &name_image);
- if (! uri_backend_load_image (uri, tmpname, run_mode, error))
+ if (! uri_backend_load_image (file, tmpname, run_mode, error))
return -1;
}
@@ -261,7 +262,7 @@ load_image (const gchar *uri,
if (image_ID != -1)
{
if (mapped || name_image)
- gimp_image_set_filename (image_ID, uri);
+ gimp_image_set_filename (image_ID, g_file_get_uri (file));
else
gimp_image_set_filename (image_ID, "");
}
@@ -280,22 +281,22 @@ load_image (const gchar *uri,
}
static GimpPDBStatusType
-save_image (const gchar *uri,
- gint32 image_ID,
- gint32 drawable_ID,
- gint32 run_mode,
- GError **error)
+save_image (GFile *file,
+ gint32 image_ID,
+ gint32 drawable_ID,
+ gint32 run_mode,
+ GError **error)
{
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
gchar *tmpname;
gboolean mapped = FALSE;
- tmpname = uri_backend_map_image (uri, run_mode);
+ tmpname = uri_backend_map_image (file, run_mode);
if (tmpname)
mapped = TRUE;
else
- tmpname = get_temp_name (uri, NULL);
+ tmpname = get_temp_name (file, NULL);
if (gimp_file_save (run_mode,
image_ID,
@@ -309,7 +310,7 @@ save_image (const gchar *uri,
}
else if (valid_file (tmpname))
{
- if (uri_backend_save_image (uri, tmpname, run_mode, error))
+ if (uri_backend_save_image (file, tmpname, run_mode, error))
{
status = GIMP_PDB_SUCCESS;
}
@@ -336,8 +337,8 @@ save_image (const gchar *uri,
}
static gchar *
-get_temp_name (const gchar *uri,
- gboolean *name_image)
+get_temp_name (GFile *file,
+ gboolean *name_image)
{
gchar *basename;
gchar *tmpname = NULL;
@@ -345,7 +346,7 @@ get_temp_name (const gchar *uri,
if (name_image)
*name_image = FALSE;
- basename = g_path_get_basename (uri);
+ basename = g_path_get_basename (gimp_file_get_utf8_name (file));
if (basename)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]