let the filename -> uri functions take a Gimp parameter instead of the

2007-01-19  Sven Neumann  <sven@gimp.org>

	* app/file/file-utils.[ch]: let the filename -> uri functions take
	a Gimp parameter instead of the list of load procedures.

	* app/core/gimpimage.c
	* app/app_procs.c
	* app/dialogs/file-open-location-dialog.c
	* tools/pdbgen/pdb/fileops.pdb: changed accordingly.

	* app/pdb/fileops_cmds.c: regenerated.

svn path=/trunk/; revision=21736
This commit is contained in:
Sven Neumann 2007-01-19 11:48:48 +00:00 committed by Sven Neumann
parent d4249a1038
commit 20b331da7f
8 changed files with 43 additions and 38 deletions

View File

@ -1,3 +1,15 @@
2007-01-19 Sven Neumann <sven@gimp.org>
* app/file/file-utils.[ch]: let the filename -> uri functions take
a Gimp parameter instead of the list of load procedures.
* app/core/gimpimage.c
* app/app_procs.c
* app/dialogs/file-open-location-dialog.c
* tools/pdbgen/pdb/fileops.pdb: changed accordingly.
* app/pdb/fileops_cmds.c: regenerated.
2007-01-19 Sven Neumann <sven@gimp.org>
* app/app_procs.c

View File

@ -44,8 +44,6 @@
#include "core/gimp.h"
#include "core/gimp-user-install.h"
#include "plug-in/gimppluginmanager.h"
#include "file/file-open.h"
#include "file/file-utils.h"
@ -262,8 +260,7 @@ app_run (const gchar *full_prog_name,
GError *error = NULL;
gchar *uri;
uri = file_utils_any_to_uri (gimp->plug_in_manager->load_procs,
filenames[i], &error);
uri = file_utils_any_to_uri (gimp, filenames[i], &error);
if (uri)
{

View File

@ -62,8 +62,6 @@
#include "gimptemplate.h"
#include "gimpundostack.h"
#include "plug-in/gimppluginmanager.h"
#include "file/file-utils.h"
#include "vectors/gimpvectors.h"
@ -1353,6 +1351,13 @@ gimp_image_set_uri (GimpImage *image,
gimp_object_set_name (GIMP_OBJECT (image), uri);
}
static void
gimp_image_take_uri (GimpImage *image,
gchar *uri)
{
gimp_object_take_name (GIMP_OBJECT (image), uri);
}
const gchar *
gimp_image_get_uri (const GimpImage *image)
{
@ -1373,14 +1378,10 @@ gimp_image_set_filename (GimpImage *image,
if (filename && strlen (filename))
{
gchar *uri;
uri = file_utils_filename_to_uri (image->gimp->plug_in_manager->load_procs,
filename, NULL);
gimp_image_set_uri (image, uri);
g_free (uri);
gimp_image_take_uri (image,
file_utils_filename_to_uri (image->gimp,
filename,
NULL));
}
else
{

View File

@ -31,8 +31,6 @@
#include "core/gimpcontext.h"
#include "core/gimpprogress.h"
#include "plug-in/gimppluginmanager.h"
#include "file/file-open.h"
#include "file/file-utils.h"
@ -188,8 +186,7 @@ file_open_location_response (GtkDialog *dialog,
}
else
{
uri = file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
text, &error);
uri = file_utils_filename_to_uri (gimp, text, &error);
}
box = gimp_progress_box_new ();

View File

@ -50,6 +50,7 @@
#include "core/gimpimage.h"
#include "core/gimpimagefile.h"
#include "plug-in/gimppluginmanager.h"
#include "plug-in/gimppluginprocedure.h"
#include "file-utils.h"
@ -101,19 +102,20 @@ static FileMatchType file_check_magic_list (GSList *magics_l
/* public functions */
gchar *
file_utils_filename_to_uri (GSList *procs,
file_utils_filename_to_uri (Gimp *gimp,
const gchar *filename,
GError **error)
{
gchar *absolute;
gchar *uri;
g_return_val_if_fail (procs != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (filename != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
/* check for prefixes like http or ftp */
if (file_proc_find_by_prefix (procs, filename, FALSE))
if (file_proc_find_by_prefix (gimp->plug_in_manager->load_procs,
filename, FALSE))
{
if (g_utf8_validate (filename, -1, NULL))
{
@ -172,13 +174,13 @@ file_utils_filename_to_uri (GSList *procs,
}
gchar *
file_utils_any_to_uri (GSList *procs,
file_utils_any_to_uri (Gimp *gimp,
const gchar *filename_or_uri,
GError **error)
{
gchar *uri;
g_return_val_if_fail (procs != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (filename_or_uri != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
@ -192,7 +194,7 @@ file_utils_any_to_uri (GSList *procs,
}
else
{
uri = file_utils_filename_to_uri (procs, filename_or_uri, error);
uri = file_utils_filename_to_uri (gimp, filename_or_uri, error);
}
return uri;

View File

@ -25,10 +25,10 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
gchar * file_utils_filename_to_uri (GSList *procs,
gchar * file_utils_filename_to_uri (Gimp *gimp,
const gchar *filename,
GError **error);
gchar * file_utils_any_to_uri (GSList *procs,
gchar * file_utils_any_to_uri (Gimp *gimp,
const gchar *filename_or_uri,
GError **error);
gchar * file_utils_filename_from_uri (const gchar *uri);

View File

@ -59,7 +59,7 @@ file_load_invoker (GimpProcedure *procedure,
gchar *uri;
gint i;
uri = file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
uri = file_utils_filename_to_uri (gimp,
g_value_get_string (&args->values[1]),
NULL);
@ -116,8 +116,7 @@ file_load_layer_invoker (GimpProcedure *procedure,
if (success)
{
gchar *uri = file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
filename, NULL);
gchar *uri = file_utils_filename_to_uri (gimp, filename, NULL);
if (uri)
{
@ -169,8 +168,7 @@ file_load_layers_invoker (GimpProcedure *procedure,
if (success)
{
gchar *uri = file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
filename, NULL);
gchar *uri = file_utils_filename_to_uri (gimp, filename, NULL);
if (uri)
{
@ -229,7 +227,7 @@ file_save_invoker (GimpProcedure *procedure,
gchar *uri;
gint i;
uri = file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
uri = file_utils_filename_to_uri (gimp,
g_value_get_string (&args->values[3]),
NULL);

View File

@ -58,7 +58,7 @@ HELP
gchar *uri;
gint i;
uri = file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
uri = file_utils_filename_to_uri (gimp,
g_value_get_string (&args->values[1]),
NULL);
@ -127,8 +127,7 @@ HELP
%invoke = (
code => <<'CODE'
{
gchar *uri = file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
filename, NULL);
gchar *uri = file_utils_filename_to_uri (gimp, filename, NULL);
if (uri)
{
@ -185,8 +184,7 @@ HELP
%invoke = (
code => <<'CODE'
{
gchar *uri = file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
filename, NULL);
gchar *uri = file_utils_filename_to_uri (gimp, filename, NULL);
if (uri)
{
@ -262,7 +260,7 @@ HELP
gchar *uri;
gint i;
uri = file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
uri = file_utils_filename_to_uri (gimp,
g_value_get_string (&args->values[3]),
NULL);