Commit a127f375 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

Dropped support for the GnomeVFS file-uri backend. Recent GNOME releases

2009-03-23  Sven Neumann  <sven@gimp.org>

	Dropped support for the GnomeVFS file-uri backend. Recent GNOME
	releases use GIO/GVfs and libgnomeui will also go away soon.

	* INSTALL 
	* configure.in: removed checks for libgnomeui and 
libgnome-keyring.

	* plug-ins/file-uri/Makefile.am
	* plug-ins/file-uri/uri-backend-gnomevfs.c: removed.


svn path=/trunk/; revision=28211
parent 45e89543
2009-03-23 Sven Neumann <sven@gimp.org>
Dropped support for the GnomeVFS file-uri backend. Recent GNOME
releases use GIO/GVfs and libgnomeui will also go away soon.
* INSTALL
* configure.in: removed checks for libgnomeui and libgnome-keyring.
* plug-ins/file-uri/Makefile.am
* plug-ins/file-uri/uri-backend-gnomevfs.c: removed.
2009-03-23 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpgradienteditor.c: use GtkAdjustment's accessors.
......
......@@ -186,11 +186,8 @@ These are:
--without-gvfs. If you don't want to use GIO/GVfs to access remote
files, you can pass --without-gvfs 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.
--without-libcurl. If you don't want to use libcurl to access remote
files, you can pass --without-gnomevfs to the configure script.
files, you can pass --without-libcurl to the configure script.
--without-alsa. If you don't want to compile ALSA support into the
MIDI input controller module, you can use the --without-alsa option.
......
......@@ -1327,10 +1327,9 @@ fi
AC_SUBST(FILE_PDF)
###############################################
# Check for gio/gvfs, gnome-vfs and libcurl
# (and optionally libgnomeui and gnome-keyring)
###############################################
################################
# Check for gio/gvfs and libcurl
################################
uri_plugin=no
......@@ -1340,39 +1339,6 @@ AC_ARG_WITH(gvfs, [ --without-gvfs build without GIO/GVfs support])
AM_CONDITIONAL(HAVE_GVFS, test "x$with_gvfs" != xno)
AC_ARG_WITH(gnomevfs, [ --without-gnomevfs build without gnomevfs support])
have_gnomeui="no (disabled)"
have_gnome_keyring="no (disabled)"
have_gnomevfs="no (disabled)"
if test "x$with_gnomevfs" != xno; then
gnome_vfs_modules="gnome-vfs-2.0 >= gnome_vfs_required_version"
if $PKG_CONFIG --atleast-version=gnomeui_required_version libgnomeui-2.0; then
have_gnomeui=yes
gnome_vfs_modules="$gnome_vfs_modules libgnomeui-2.0"
else
have_gnomeui="no (libgnomeui-2.0 not found)"
fi
if $PKG_CONFIG --atleast-version=gnome_keyring_required_version gnome-keyring-1; then
have_gnome_keyring=yes
gnome_vfs_modules="$gnome_vfs_modules gnome-keyring-1"
else
have_gnome_keyring="no (gnome-keyring-1 not found)"
fi
PKG_CHECK_MODULES(GNOME_VFS, $gnome_vfs_modules,
have_gnomevfs=yes,
have_gnomevfs="no (gnome-vfs-2.0 not found)")
fi
AM_CONDITIONAL(HAVE_GNOMEVFS, test "x$have_gnomevfs" = xyes)
AC_ARG_WITH(libcurl, [ --without-libcurl build without curl support])
have_libcurl="no (disabled)"
......@@ -1390,8 +1356,6 @@ 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_gnomevfs" = xyes; then
uri_plugin="yes (using gnome-vfs)"
elif test "x$have_libcurl" = xyes; then
uri_plugin="yes (using libcurl)"
elif test "x$os_win32" = xno; then
......@@ -1399,15 +1363,6 @@ elif test "x$os_win32" = xno; then
fi
if test "x$have_gnomeui" = xyes; then
AC_DEFINE(HAVE_GNOMEUI, 1, [Define to 1 if libgnomeui is available])
fi
if test "x$have_gnome_keyring" = xyes; then
AC_DEFINE(HAVE_GNOME_KEYRING, 1, [Define to 1 if gnome-keyring is available])
fi
###################
# Check for libwmf2
###################
......@@ -2138,8 +2093,6 @@ Optional Plug-Ins:
Plug-In Features:
EXIF support: $have_libexif
GNOME UI: $have_gnomeui
GNOME keyring: $have_gnome_keyring
Optional Modules:
ALSA (MIDI Input): $have_alsa
......
......@@ -23,11 +23,6 @@ backend_sources = uri-backend-gvfs.c
backend_cflags = $(GIO_CFLAGS)
backend_libs = $(GIO_LIBS)
else
if HAVE_GNOMEVFS
backend_sources = uri-backend-gnomevfs.c
backend_cflags = $(GNOME_VFS_CFLAGS)
backend_libs = $(GNOME_VFS_LIBS)
else
if HAVE_LIBCURL
backend_sources = uri-backend-libcurl.c
backend_cflags = $(CURL_CFLAGS)
......@@ -38,7 +33,6 @@ backend_cflags =
backend_libs =
endif
endif
endif
file_uri_SOURCES = \
uri.c \
......
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <libgnomevfs/gnome-vfs.h>
#ifdef HAVE_GNOMEUI
#include <libgnomeui/gnome-authentication-manager.h>
#endif
#ifdef HAVE_GNOME_KEYRING
#include <gnome-keyring.h>
#endif
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "uri-backend.h"
#include "libgimp/stdplugins-intl.h"
#define BUFSIZE 4096
/* local function prototypes */
static gchar * get_protocols (void);
static gboolean copy_uri (const gchar *src_uri,
const gchar *dest_uri,
const gchar *copying_format_str,
const gchar *copied_format_str,
GError **error);
#ifdef HAVE_GNOME_KEYRING
static void vfs_async_fill_authentication_callback (gconstpointer in,
size_t in_size,
gpointer out,
size_t out_size,
gpointer user_data,
GnomeVFSModuleCallbackResponse response,
gpointer response_data);
static void vfs_fill_authentication_callback (gconstpointer in,
size_t in_size,
gpointer out,
size_t out_size,
gpointer user_data);
#endif /* HAVE_GNOME_KEYRING */
/* private variables */
static gchar *supported_protocols = NULL;
/* public functions */
gboolean
uri_backend_init (const gchar *plugin_name,
gboolean run,
GimpRunMode run_mode,
GError **error)
{
if (! gnome_vfs_init ())
{
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
"%s", "Could not initialize GnomeVFS");
return FALSE;
}
#ifdef HAVE_GNOMEUI
if (run)
{
if (run_mode == GIMP_RUN_INTERACTIVE)
{
gimp_ui_init (plugin_name, FALSE);
gnome_authentication_manager_init ();
}
else
{
#ifdef HAVE_GNOME_KEYRING
gnome_vfs_async_module_callback_set_default
(GNOME_VFS_MODULE_CALLBACK_FILL_AUTHENTICATION,
vfs_async_fill_authentication_callback,
GINT_TO_POINTER (0),
NULL);
gnome_vfs_module_callback_set_default
(GNOME_VFS_MODULE_CALLBACK_FILL_AUTHENTICATION,
vfs_fill_authentication_callback,
GINT_TO_POINTER (0),
NULL);
#endif /* HAVE_GNOME_KEYRING */
}
}
#endif /* HAVE_GNOMEUI */
return TRUE;
}
void
uri_backend_shutdown (void)
{
gnome_vfs_shutdown ();
}
const gchar *
uri_backend_get_load_help (void)
{
return "Loads a file using the GnomeVFS library";
}
const gchar *
uri_backend_get_save_help (void)
{
return "Saves a file using the GnomeVFS library";
}
const gchar *
uri_backend_get_load_protocols (void)
{
if (! supported_protocols)
supported_protocols = get_protocols ();
return supported_protocols;
}
const gchar *
uri_backend_get_save_protocols (void)
{
if (! supported_protocols)
supported_protocols = get_protocols ();
return supported_protocols;
}
gboolean
uri_backend_load_image (const gchar *uri,
const gchar *tmpname,
GimpRunMode run_mode,
GError **error)
{
gchar *dest_uri;
gboolean success;
dest_uri = g_filename_to_uri (tmpname, NULL, NULL);
success = copy_uri (uri, dest_uri,
_("Downloading %s of image data"),
_("Downloaded %s of image data"),
error);
g_free (dest_uri);
return success;
}
gboolean
uri_backend_save_image (const gchar *uri,
const gchar *tmpname,
GimpRunMode run_mode,
GError **error)
{
gchar *src_uri;
gboolean success;
src_uri = g_filename_to_uri (tmpname, NULL, NULL);
success = copy_uri (src_uri, uri,
_("Uploading %s of image data"),
_("Uploaded %s of image data"),
error);
g_free (src_uri);
return success;
}
/* private functions */
static gchar *
get_protocols (void)
{
static const gchar *protocols[] =
{
"http:",
"https:",
"ftp:",
"sftp:",
"ssh:",
"smb:",
"dav:",
"davs:"
};
GString *string = g_string_new (NULL);
gint i;
for (i = 0; i < G_N_ELEMENTS (protocols); i++)
{
gchar *uri;
GnomeVFSURI *vfs_uri;
uri = g_strdup_printf ("%s//foo/bar.xcf", protocols[i]);
vfs_uri = gnome_vfs_uri_new (uri);
if (vfs_uri)
{
if (string->len > 0)
g_string_append_c (string, ',');
g_string_append (string, protocols[i]);
gnome_vfs_uri_unref (vfs_uri);
}
g_free (uri);
}
return g_string_free (string, FALSE);
}
static gboolean
copy_uri (const gchar *src_uri,
const gchar *dest_uri,
const gchar *copying_format_str,
const gchar *copied_format_str,
GError **error)
{
GnomeVFSHandle *read_handle;
GnomeVFSHandle *write_handle;
GnomeVFSFileInfo *src_info;
GnomeVFSFileSize file_size = 0;
GnomeVFSFileSize bytes_read = 0;
guchar buffer[BUFSIZE];
GnomeVFSResult result;
gchar *memsize;
GTimeVal last_time = { 0, 0 };
gimp_progress_init (_("Connecting to server"));
src_info = gnome_vfs_file_info_new ();
result = gnome_vfs_get_file_info (src_uri, src_info, 0);
/* ignore errors here, they will be noticed below */
if (result == GNOME_VFS_OK &&
(src_info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE))
{
file_size = src_info->size;
}
gnome_vfs_file_info_unref (src_info);
result = gnome_vfs_open (&read_handle, src_uri, GNOME_VFS_OPEN_READ);
if (result != GNOME_VFS_OK)
{
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
_("Could not open '%s' for reading: %s"),
src_uri, gnome_vfs_result_to_string (result));
return FALSE;
}
result = gnome_vfs_create (&write_handle, dest_uri,
GNOME_VFS_OPEN_WRITE, FALSE, 0644);
if (result != GNOME_VFS_OK)
{
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
_("Could not open '%s' for writing: %s"),
dest_uri, gnome_vfs_result_to_string (result));
gnome_vfs_close (read_handle);
return FALSE;
}
memsize = g_format_size_for_display (file_size);
gimp_progress_init_printf (file_size > 0 ?
copying_format_str : copied_format_str,
memsize);
g_free (memsize);
while (TRUE)
{
GnomeVFSFileSize chunk_read;
GnomeVFSFileSize chunk_written;
GTimeVal now;
result = gnome_vfs_read (read_handle, buffer, sizeof (buffer),
&chunk_read);
if (chunk_read == 0)
{
if (result != GNOME_VFS_ERROR_EOF)
{
memsize = g_format_size_for_display (sizeof (buffer));
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
_("Failed to read %s from '%s': %s"),
memsize, src_uri,
gnome_vfs_result_to_string (result));
g_free (memsize);
gnome_vfs_close (read_handle);
gnome_vfs_close (write_handle);
return FALSE;
}
else
{
gimp_progress_update (1.0);
break;
}
}
bytes_read += chunk_read;
/* update the progress only up to 10 times a second */
g_get_current_time (&now);
if (((now.tv_sec - last_time.tv_sec) * 1000 +
(now.tv_usec - last_time.tv_usec) / 1000) > 100)
{
if (file_size > 0)
{
gimp_progress_update ((gdouble) bytes_read / (gdouble) file_size);
}
else
{
memsize = g_format_size_for_display (bytes_read);
gimp_progress_set_text_printf (copied_format_str, memsize);
gimp_progress_pulse ();
g_free (memsize);
}
last_time = now;
}
result = gnome_vfs_write (write_handle, buffer, chunk_read,
&chunk_written);
if (chunk_written < chunk_read)
{
memsize = g_format_size_for_display (chunk_read);
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
_("Failed to write %s to '%s': %s"),
memsize, dest_uri,
gnome_vfs_result_to_string (result));
g_free (memsize);
gnome_vfs_close (read_handle);
gnome_vfs_close (write_handle);
return FALSE;
}
}
gnome_vfs_close (read_handle);
gnome_vfs_close (write_handle);
return TRUE;
}
#ifdef HAVE_GNOME_KEYRING
/* gnome-keyring code copied from
* libgnomeui/libgnomeui/gnome-authentication-manager.c CVS version 1.13
*/
typedef struct
{
const GnomeVFSModuleCallbackFillAuthenticationIn *in_args;
GnomeVFSModuleCallbackFillAuthenticationOut *out_args;
GnomeVFSModuleCallbackResponse response;
gpointer response_data;
} FillCallbackInfo;
static void
fill_auth_callback (GnomeKeyringResult result,
GList *list,
gpointer data)
{
FillCallbackInfo *info = data;
GnomeKeyringNetworkPasswordData *pwd_data;;
if (result != GNOME_KEYRING_RESULT_OK || list == NULL)
{
info->out_args->valid = FALSE;
}
else
{
/* We use the first result, which is the least specific match */
pwd_data = list->data;
info->out_args->valid = TRUE;
info->out_args->username = g_strdup (pwd_data->user);
info->out_args->domain = g_strdup (pwd_data->domain);
info->out_args->password = g_strdup (pwd_data->password);
}
info->response (info->response_data);
}
static void /* GnomeVFSAsyncModuleCallback */
vfs_async_fill_authentication_callback (gconstpointer in,
size_t in_size,
gpointer out,
size_t out_size,
gpointer user_data,
GnomeVFSModuleCallbackResponse response,
gpointer response_data)
{
GnomeVFSModuleCallbackFillAuthenticationIn *in_real;
GnomeVFSModuleCallbackFillAuthenticationOut *out_real;
gpointer request;
FillCallbackInfo *info;
g_return_if_fail
(sizeof (GnomeVFSModuleCallbackFillAuthenticationIn) == in_size &&
sizeof (GnomeVFSModuleCallbackFillAuthenticationOut) == out_size);
g_return_if_fail (in != NULL);
g_return_if_fail (out != NULL);
in_real = (GnomeVFSModuleCallbackFillAuthenticationIn *)in;
out_real = (GnomeVFSModuleCallbackFillAuthenticationOut *)out;
info = g_new (FillCallbackInfo, 1);
info->in_args = in_real;
info->out_args = out_real;
info->response = response;
info->response_data = response_data;
request = gnome_keyring_find_network_password (in_real->username,
in_real->domain,
in_real->server,
in_real->object,
in_real->protocol,
in_real->authtype,
in_real->port,
fill_auth_callback,
info, g_free);
}
static void /* GnomeVFSModuleCallback */
vfs_fill_authentication_callback (gconstpointer in,
size_t in_size,
gpointer out,
size_t out_size,
gpointer user_data)
{
GnomeVFSModuleCallbackFillAuthenticationIn *in_real;
GnomeVFSModuleCallbackFillAuthenticationOut *out_real;
GnomeKeyringNetworkPasswordData *pwd_data;
GList *list;
GnomeKeyringResult result;
g_return_if_fail
(sizeof (GnomeVFSModuleCallbackFillAuthenticationIn) == in_size &&
sizeof (GnomeVFSModuleCallbackFillAuthenticationOut) == out_size);
g_return_if_fail (in != NULL);
g_return_if_fail (out != NULL);
in_real = (GnomeVFSModuleCallbackFillAuthenticationIn *)in;
out_real = (GnomeVFSModuleCallbackFillAuthenticationOut *)out;
result = gnome_keyring_find_network_password_sync (in_real->username,
in_real->domain,
in_real->server,
in_real->object,
in_real->protocol,
in_real->authtype,
in_real->port,
&list);
if (result != GNOME_KEYRING_RESULT_OK || list == NULL)
{
out_real->valid = FALSE;
}
else
{
/* We use the first result, which is the least specific match */
pwd_data = list->data;
out_real->valid = TRUE;
out_real->username = g_strdup (pwd_data->user);
out_real->domain = g_strdup (pwd_data->domain);
out_real->password = g_strdup (pwd_data->password);
gnome_keyring_network_password_list_free (list);
}
}
#endif /* HAVE_GNOME_KEYRING */
2009-03-23 Sven Neumann <sven@gimp.org>
* POTFILES.in: removed plug-ins/file-uri/uri-backend-gnomevfs.c.
2009-03-18 Mișu Moldovan <dumol@gnome.ro>
* ro.po: updated Romanian translation by Cristian Secară
2009-03-18 Marco Ciampa <ciampix@libero.it>
it.po: updated italian translation.
* it.po: updated italian translation.
2009-03-10 Ulf-D. Ehlert <ulfehlert@svn.gnome.org>
......
......@@ -171,7 +171,6 @@ plug-ins/file-psd/psd-thumb-load.c
plug-ins/file-psd/psd-util.c
plug-ins/file-psd/psd.c
plug-ins/file-sgi/sgi.c
plug-ins/file-uri/uri-backend-gnomevfs.c
plug-ins/file-uri/uri-backend-gvfs.c
plug-ins/file-uri/uri-backend-libcurl.c
plug-ins/file-uri/uri-backend-wget.c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment