mirror of https://github.com/GNOME/gimp.git
Change the "handles uri" flag of file procedures to "handle remote"
And always pass URIs to all file procedures, the ones what didn't register as "handles remove" will only ever get local file:// URIs. Change all file plug-ins (also legacy ones) to expect URIs instead of filenames, and convert to local paths in the plug-in. The wire protocol should now be almost 100% clean of non-UTF-8 strings.
This commit is contained in:
parent
9cabc8c8d0
commit
de121374ef
|
@ -65,7 +65,7 @@ file_data_init (Gimp *gimp)
|
|||
gimp_plug_in_procedure_set_file_proc (proc, "gbr, gbp", "",
|
||||
"20, string, GIMP");
|
||||
gimp_plug_in_procedure_set_mime_types (proc, "image/gimp-x-gbr");
|
||||
gimp_plug_in_procedure_set_handles_uri (proc);
|
||||
gimp_plug_in_procedure_set_handles_remote (proc);
|
||||
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure), "file-gbr-load");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
|
@ -132,7 +132,7 @@ file_data_init (Gimp *gimp)
|
|||
gimp_plug_in_procedure_set_image_types (proc, "RGB*, GRAY*, INDEXED*");
|
||||
gimp_plug_in_procedure_set_file_proc (proc, "gbr", "", NULL);
|
||||
gimp_plug_in_procedure_set_mime_types (proc, "image/x-gimp-gbr");
|
||||
gimp_plug_in_procedure_set_handles_uri (proc);
|
||||
gimp_plug_in_procedure_set_handles_remote (proc);
|
||||
#endif
|
||||
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
|
@ -215,7 +215,7 @@ file_data_init (Gimp *gimp)
|
|||
gimp_plug_in_procedure_set_image_types (proc, NULL);
|
||||
gimp_plug_in_procedure_set_file_proc (proc, "gih", "", "");
|
||||
gimp_plug_in_procedure_set_mime_types (proc, "image/gimp-x-gih");
|
||||
gimp_plug_in_procedure_set_handles_uri (proc);
|
||||
gimp_plug_in_procedure_set_handles_remote (proc);
|
||||
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure), "file-gih-load");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
|
@ -280,7 +280,7 @@ file_data_init (Gimp *gimp)
|
|||
gimp_plug_in_procedure_set_image_types (proc, "RGB*, GRAY*, INDEXED*");
|
||||
gimp_plug_in_procedure_set_file_proc (proc, "gih", "", NULL);
|
||||
gimp_plug_in_procedure_set_mime_types (proc, "image/x-gimp-gih");
|
||||
gimp_plug_in_procedure_set_handles_uri (proc);
|
||||
gimp_plug_in_procedure_set_handles_remote (proc);
|
||||
#endif
|
||||
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
|
@ -371,7 +371,7 @@ file_data_init (Gimp *gimp)
|
|||
gimp_plug_in_procedure_set_file_proc (proc, "pat", "",
|
||||
"20,string,GPAT");
|
||||
gimp_plug_in_procedure_set_mime_types (proc, "image/gimp-x-pat");
|
||||
gimp_plug_in_procedure_set_handles_uri (proc);
|
||||
gimp_plug_in_procedure_set_handles_remote (proc);
|
||||
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure), "file-pat-load");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
|
@ -434,7 +434,7 @@ file_data_init (Gimp *gimp)
|
|||
gimp_plug_in_procedure_set_image_types (proc, "RGB*, GRAY*, INDEXED*");
|
||||
gimp_plug_in_procedure_set_file_proc (proc, "pat", "", NULL);
|
||||
gimp_plug_in_procedure_set_mime_types (proc, "image/x-gimp-pat");
|
||||
gimp_plug_in_procedure_set_handles_uri (proc);
|
||||
gimp_plug_in_procedure_set_handles_remote (proc);
|
||||
#endif
|
||||
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
|
@ -513,7 +513,7 @@ file_data_init (Gimp *gimp)
|
|||
"20, string, GIMP");
|
||||
gimp_plug_in_procedure_set_generic_file_proc (proc, TRUE);
|
||||
gimp_plug_in_procedure_set_mime_types (proc, "image/gimp-x-gex");
|
||||
gimp_plug_in_procedure_set_handles_uri (proc);
|
||||
gimp_plug_in_procedure_set_handles_remote (proc);
|
||||
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure), "file-gex-load");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
|
|
|
@ -82,7 +82,7 @@ file_open_image (Gimp *gimp,
|
|||
GimpValueArray *return_vals;
|
||||
GimpImage *image = NULL;
|
||||
GFile *local_file = NULL;
|
||||
gchar *path = NULL;
|
||||
gchar *uri = NULL;
|
||||
gchar *entered_uri = NULL;
|
||||
gboolean mounted = TRUE;
|
||||
GError *my_error = NULL;
|
||||
|
@ -167,7 +167,7 @@ file_open_image (Gimp *gimp,
|
|||
}
|
||||
}
|
||||
|
||||
if (! file_proc || ! file_proc->handles_uri || ! mounted)
|
||||
if (! file_proc || ! file_proc->handles_remote || ! mounted)
|
||||
{
|
||||
gchar *my_path = g_file_get_path (file);
|
||||
|
||||
|
@ -202,27 +202,19 @@ file_open_image (Gimp *gimp,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (file_proc->handles_uri)
|
||||
path = g_file_get_uri (local_file);
|
||||
else
|
||||
path = g_file_get_path (local_file);
|
||||
uri = g_file_get_uri (local_file);
|
||||
}
|
||||
|
||||
g_free (my_path);
|
||||
}
|
||||
|
||||
if (! path)
|
||||
{
|
||||
if (file_proc->handles_uri)
|
||||
path = g_file_get_uri (file);
|
||||
else
|
||||
path = g_file_get_path (file);
|
||||
}
|
||||
if (! uri)
|
||||
uri = g_file_get_uri (file);
|
||||
|
||||
entered_uri = g_file_get_uri (entered_file);
|
||||
|
||||
if (! entered_uri)
|
||||
entered_uri = g_strdup (path);
|
||||
entered_uri = g_strdup (uri);
|
||||
|
||||
if (progress)
|
||||
g_object_add_weak_pointer (G_OBJECT (progress), (gpointer) &progress);
|
||||
|
@ -232,14 +224,14 @@ file_open_image (Gimp *gimp,
|
|||
context, progress, error,
|
||||
gimp_object_get_name (file_proc),
|
||||
GIMP_TYPE_RUN_MODE, run_mode,
|
||||
G_TYPE_STRING, path,
|
||||
G_TYPE_STRING, uri,
|
||||
G_TYPE_STRING, entered_uri,
|
||||
G_TYPE_NONE);
|
||||
|
||||
if (progress)
|
||||
g_object_remove_weak_pointer (G_OBJECT (progress), (gpointer) &progress);
|
||||
|
||||
g_free (path);
|
||||
g_free (uri);
|
||||
g_free (entered_uri);
|
||||
|
||||
*status = g_value_get_enum (gimp_value_array_index (return_vals, 0));
|
||||
|
@ -374,23 +366,19 @@ file_open_thumbnail (Gimp *gimp,
|
|||
GimpPDBStatusType status;
|
||||
GimpValueArray *return_vals;
|
||||
GimpImage *image = NULL;
|
||||
gchar *path = NULL;
|
||||
gchar *uri = NULL;
|
||||
|
||||
if (! file_proc->handles_uri)
|
||||
path = g_file_get_path (file);
|
||||
|
||||
if (! path)
|
||||
path = g_file_get_uri (file);
|
||||
uri = g_file_get_uri (file);
|
||||
|
||||
return_vals =
|
||||
gimp_pdb_execute_procedure_by_name (gimp->pdb,
|
||||
context, progress, error,
|
||||
gimp_object_get_name (procedure),
|
||||
G_TYPE_STRING, path,
|
||||
G_TYPE_STRING, uri,
|
||||
G_TYPE_INT, size,
|
||||
G_TYPE_NONE);
|
||||
|
||||
g_free (path);
|
||||
g_free (uri);
|
||||
|
||||
status = g_value_get_enum (gimp_value_array_index (return_vals, 0));
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ file_save (Gimp *gimp,
|
|||
GimpValueArray *return_vals;
|
||||
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
|
||||
GFile *local_file = NULL;
|
||||
gchar *path = NULL;
|
||||
gchar *uri = NULL;
|
||||
gboolean mounted = TRUE;
|
||||
gint32 image_ID;
|
||||
|
@ -161,7 +160,7 @@ file_save (Gimp *gimp,
|
|||
}
|
||||
}
|
||||
|
||||
if (! file_proc->handles_uri || ! mounted)
|
||||
if (! file_proc->handles_remote || ! mounted)
|
||||
{
|
||||
gchar *my_path = g_file_get_path (file);
|
||||
|
||||
|
@ -180,24 +179,14 @@ file_save (Gimp *gimp,
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (file_proc->handles_uri)
|
||||
path = g_file_get_uri (local_file);
|
||||
else
|
||||
path = g_file_get_path (local_file);
|
||||
uri = g_file_get_uri (local_file);
|
||||
}
|
||||
|
||||
g_free (my_path);
|
||||
}
|
||||
|
||||
if (! path)
|
||||
{
|
||||
if (file_proc->handles_uri)
|
||||
path = g_file_get_uri (file);
|
||||
else
|
||||
path = g_file_get_path (file);
|
||||
}
|
||||
|
||||
uri = g_file_get_uri (file);
|
||||
if (! uri)
|
||||
uri = g_file_get_uri (file);
|
||||
|
||||
image_ID = gimp_image_get_ID (image);
|
||||
drawable_ID = gimp_item_get_ID (GIMP_ITEM (drawable));
|
||||
|
@ -210,7 +199,7 @@ file_save (Gimp *gimp,
|
|||
GIMP_TYPE_RUN_MODE, run_mode,
|
||||
GIMP_TYPE_IMAGE_ID, image_ID,
|
||||
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
|
||||
G_TYPE_STRING, path,
|
||||
G_TYPE_STRING, uri,
|
||||
G_TYPE_STRING, uri,
|
||||
G_TYPE_NONE);
|
||||
|
||||
|
@ -318,7 +307,6 @@ file_save (Gimp *gimp,
|
|||
g_object_unref (file);
|
||||
g_object_unref (image);
|
||||
|
||||
g_free (path);
|
||||
g_free (uri);
|
||||
|
||||
return status;
|
||||
|
|
|
@ -91,12 +91,8 @@ file_load_invoker (GimpProcedure *procedure,
|
|||
g_value_transform (gimp_value_array_index (args, 0),
|
||||
gimp_value_array_index (new_args, 0));
|
||||
|
||||
if (file_proc->handles_uri)
|
||||
g_value_take_string (gimp_value_array_index (new_args, 1),
|
||||
g_file_get_uri (file));
|
||||
else
|
||||
g_value_transform (gimp_value_array_index (args, 1),
|
||||
gimp_value_array_index (new_args, 1));
|
||||
g_value_take_string (gimp_value_array_index (new_args, 1),
|
||||
g_file_get_uri (file));
|
||||
|
||||
g_value_transform (gimp_value_array_index (args, 2),
|
||||
gimp_value_array_index (new_args, 2));
|
||||
|
@ -307,12 +303,8 @@ file_save_invoker (GimpProcedure *procedure,
|
|||
g_value_transform (gimp_value_array_index (args, 2),
|
||||
gimp_value_array_index (new_args, 2));
|
||||
|
||||
if (file_proc->handles_uri)
|
||||
g_value_take_string (gimp_value_array_index (new_args, 3),
|
||||
g_file_get_uri (file));
|
||||
else
|
||||
g_value_transform (gimp_value_array_index (args, 3),
|
||||
gimp_value_array_index (new_args, 3));
|
||||
g_value_take_string (gimp_value_array_index (new_args, 3),
|
||||
g_file_get_uri (file));
|
||||
|
||||
g_value_transform (gimp_value_array_index (args, 4),
|
||||
gimp_value_array_index (new_args, 4));
|
||||
|
@ -553,12 +545,12 @@ register_file_handler_mime_invoker (GimpProcedure *procedure,
|
|||
}
|
||||
|
||||
static GimpValueArray *
|
||||
register_file_handler_uri_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GimpValueArray *args,
|
||||
GError **error)
|
||||
register_file_handler_remote_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GimpValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
const gchar *procedure_name;
|
||||
|
@ -568,8 +560,8 @@ register_file_handler_uri_invoker (GimpProcedure *procedure,
|
|||
if (success)
|
||||
{
|
||||
success = (gimp_pdb_is_canonical_procedure (procedure_name, error) &&
|
||||
gimp_plug_in_manager_register_handles_uri (gimp->plug_in_manager,
|
||||
procedure_name));
|
||||
gimp_plug_in_manager_register_handles_remote (gimp->plug_in_manager,
|
||||
procedure_name));
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success,
|
||||
|
@ -1072,14 +1064,14 @@ register_fileops_procs (GimpPDB *pdb)
|
|||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-register-file-handler-uri
|
||||
* gimp-register-file-handler-remote
|
||||
*/
|
||||
procedure = gimp_procedure_new (register_file_handler_uri_invoker);
|
||||
procedure = gimp_procedure_new (register_file_handler_remote_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-register-file-handler-uri");
|
||||
"gimp-register-file-handler-remote");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"Registers a file handler procedure as capable of handling URIs.",
|
||||
"Registers a file handler procedure as capable of handling URIs. This allows GIMP to call the procedure directly for all kinds of URIs, and the 'filename' traditionally passed to file procedures turns into an URI.",
|
||||
"Registers a file handler procedure as capable of handling remote URIs.",
|
||||
"Registers a file handler procedure as capable of handling remote URIs. This allows GIMP to call the procedure directly for all kinds of URIs, not only on local file:// URIs.",
|
||||
"Michael Natterer <mitch@gimp.org>",
|
||||
"Michael Natterer",
|
||||
"2012",
|
||||
|
@ -1087,7 +1079,7 @@ register_fileops_procs (GimpPDB *pdb)
|
|||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_string ("procedure-name",
|
||||
"procedure name",
|
||||
"The name of the procedure to enable URIs for.",
|
||||
"The name of the procedure to enable remote URIs for.",
|
||||
FALSE, FALSE, TRUE,
|
||||
NULL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
|
|
@ -221,8 +221,8 @@ gimp_plug_in_manager_register_mime_types (GimpPlugInManager *manager,
|
|||
}
|
||||
|
||||
gboolean
|
||||
gimp_plug_in_manager_register_handles_uri (GimpPlugInManager *manager,
|
||||
const gchar *name)
|
||||
gimp_plug_in_manager_register_handles_remote (GimpPlugInManager *manager,
|
||||
const gchar *name)
|
||||
{
|
||||
GimpPlugInProcedure *file_proc;
|
||||
GSList *list;
|
||||
|
@ -240,7 +240,7 @@ gimp_plug_in_manager_register_handles_uri (GimpPlugInManager *manager,
|
|||
if (! file_proc)
|
||||
return FALSE;
|
||||
|
||||
gimp_plug_in_procedure_set_handles_uri (file_proc);
|
||||
gimp_plug_in_procedure_set_handles_remote (file_proc);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,8 @@ gboolean gimp_plug_in_manager_register_mime_types (GimpPlugInManager *manage
|
|||
const gchar *name,
|
||||
const gchar *mime_types);
|
||||
|
||||
gboolean gimp_plug_in_manager_register_handles_uri (GimpPlugInManager *manager,
|
||||
gboolean gimp_plug_in_manager_register_handles_remote
|
||||
(GimpPlugInManager *manager,
|
||||
const gchar *name);
|
||||
|
||||
gboolean gimp_plug_in_manager_register_handles_raw (GimpPlugInManager *manager,
|
||||
|
|
|
@ -462,48 +462,48 @@ gimp_plug_in_procedure_validate_args (GimpPlugInProcedure *proc,
|
|||
GimpValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
if (proc->file_proc && proc->handles_uri)
|
||||
GimpProcedure *procedure = GIMP_PROCEDURE (proc);
|
||||
GValue *uri_value = NULL;
|
||||
|
||||
if (! proc->file_proc)
|
||||
return TRUE;
|
||||
|
||||
/* make sure that the passed strings are actually URIs, not just a
|
||||
* file path (bug 758685)
|
||||
*/
|
||||
|
||||
if ((procedure->num_args >= 3) &&
|
||||
(procedure->num_values >= 1) &&
|
||||
GIMP_IS_PARAM_SPEC_RUN_MODE (procedure->args[0]) &&
|
||||
G_IS_PARAM_SPEC_STRING (procedure->args[1]) &&
|
||||
G_IS_PARAM_SPEC_STRING (procedure->args[2]) &&
|
||||
GIMP_IS_PARAM_SPEC_IMAGE_ID (procedure->values[0]))
|
||||
{
|
||||
/* for file procedures that handle URIs, make sure that the
|
||||
* passed string actually is an URI, not just a file path
|
||||
* (bug 758685)
|
||||
*/
|
||||
GimpProcedure *procedure = GIMP_PROCEDURE (proc);
|
||||
GValue *uri_value = NULL;
|
||||
uri_value = gimp_value_array_index (args, 1);
|
||||
}
|
||||
else if ((procedure->num_args >= 5) &&
|
||||
GIMP_IS_PARAM_SPEC_RUN_MODE (procedure->args[0]) &&
|
||||
GIMP_IS_PARAM_SPEC_IMAGE_ID (procedure->args[1]) &&
|
||||
GIMP_IS_PARAM_SPEC_DRAWABLE_ID (procedure->args[2]) &&
|
||||
G_IS_PARAM_SPEC_STRING (procedure->args[3]) &&
|
||||
G_IS_PARAM_SPEC_STRING (procedure->args[4]))
|
||||
{
|
||||
uri_value = gimp_value_array_index (args, 3);
|
||||
}
|
||||
|
||||
if ((procedure->num_args >= 3) &&
|
||||
(procedure->num_values >= 1) &&
|
||||
GIMP_IS_PARAM_SPEC_RUN_MODE (procedure->args[0]) &&
|
||||
G_IS_PARAM_SPEC_STRING (procedure->args[1]) &&
|
||||
G_IS_PARAM_SPEC_STRING (procedure->args[2]) &&
|
||||
GIMP_IS_PARAM_SPEC_IMAGE_ID (procedure->values[0]))
|
||||
{
|
||||
uri_value = gimp_value_array_index (args, 1);
|
||||
}
|
||||
else if ((procedure->num_args >= 5) &&
|
||||
GIMP_IS_PARAM_SPEC_RUN_MODE (procedure->args[0]) &&
|
||||
GIMP_IS_PARAM_SPEC_IMAGE_ID (procedure->args[1]) &&
|
||||
GIMP_IS_PARAM_SPEC_DRAWABLE_ID (procedure->args[2]) &&
|
||||
G_IS_PARAM_SPEC_STRING (procedure->args[3]) &&
|
||||
G_IS_PARAM_SPEC_STRING (procedure->args[4]))
|
||||
{
|
||||
uri_value = gimp_value_array_index (args, 3);
|
||||
}
|
||||
if (uri_value)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
if (uri_value)
|
||||
{
|
||||
GFile *file;
|
||||
file = file_utils_filename_to_file (gimp,
|
||||
g_value_get_string (uri_value),
|
||||
error);
|
||||
|
||||
file = file_utils_filename_to_file (gimp,
|
||||
g_value_get_string (uri_value),
|
||||
error);
|
||||
if (! file)
|
||||
return FALSE;
|
||||
|
||||
if (! file)
|
||||
return FALSE;
|
||||
|
||||
g_value_take_string (uri_value, g_file_get_uri (file));
|
||||
g_object_unref (file);
|
||||
}
|
||||
g_value_take_string (uri_value, g_file_get_uri (file));
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1219,11 +1219,11 @@ gimp_plug_in_procedure_set_mime_types (GimpPlugInProcedure *proc,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_plug_in_procedure_set_handles_uri (GimpPlugInProcedure *proc)
|
||||
gimp_plug_in_procedure_set_handles_remote (GimpPlugInProcedure *proc)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc));
|
||||
|
||||
proc->handles_uri = TRUE;
|
||||
proc->handles_remote = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -64,7 +64,7 @@ struct _GimpPlugInProcedure
|
|||
gchar *magics;
|
||||
gint priority;
|
||||
gchar *mime_types;
|
||||
gboolean handles_uri;
|
||||
gboolean handles_remote;
|
||||
gboolean handles_raw;
|
||||
GSList *extensions_list;
|
||||
GSList *prefixes_list;
|
||||
|
@ -132,7 +132,7 @@ void gimp_plug_in_procedure_set_priority (GimpPlugInProcedure *pro
|
|||
gint priority);
|
||||
void gimp_plug_in_procedure_set_mime_types (GimpPlugInProcedure *proc,
|
||||
const gchar *mime_ypes);
|
||||
void gimp_plug_in_procedure_set_handles_uri (GimpPlugInProcedure *proc);
|
||||
void gimp_plug_in_procedure_set_handles_remote(GimpPlugInProcedure *proc);
|
||||
void gimp_plug_in_procedure_set_handles_raw (GimpPlugInProcedure *proc);
|
||||
void gimp_plug_in_procedure_set_thumb_loader (GimpPlugInProcedure *proc,
|
||||
const gchar *thumbnailer);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
#define PLUG_IN_RC_FILE_VERSION 9
|
||||
#define PLUG_IN_RC_FILE_VERSION 10
|
||||
|
||||
|
||||
/*
|
||||
|
@ -93,7 +93,7 @@ enum
|
|||
MAGICS,
|
||||
PRIORITY,
|
||||
MIME_TYPES,
|
||||
HANDLES_URI,
|
||||
HANDLES_REMOTE,
|
||||
HANDLES_RAW,
|
||||
THUMB_LOADER
|
||||
};
|
||||
|
@ -161,7 +161,7 @@ plug_in_rc_parse (Gimp *gimp,
|
|||
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
|
||||
"mime-types", GINT_TO_POINTER (MIME_TYPES));
|
||||
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
|
||||
"handles-uri", GINT_TO_POINTER (HANDLES_URI));
|
||||
"handles-remote", GINT_TO_POINTER (HANDLES_REMOTE));
|
||||
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
|
||||
"handles-raw", GINT_TO_POINTER (HANDLES_RAW));
|
||||
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
|
||||
|
@ -176,7 +176,7 @@ plug_in_rc_parse (Gimp *gimp,
|
|||
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
|
||||
"mime-types", GINT_TO_POINTER (MIME_TYPES));
|
||||
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
|
||||
"handles-uri", GINT_TO_POINTER (HANDLES_URI));
|
||||
"handles-remote", GINT_TO_POINTER (HANDLES_REMOTE));
|
||||
|
||||
token = G_TOKEN_LEFT_PAREN;
|
||||
|
||||
|
@ -696,8 +696,8 @@ plug_in_file_proc_deserialize (GScanner *scanner,
|
|||
}
|
||||
break;
|
||||
|
||||
case HANDLES_URI:
|
||||
gimp_plug_in_procedure_set_handles_uri (proc);
|
||||
case HANDLES_REMOTE:
|
||||
gimp_plug_in_procedure_set_handles_remote (proc);
|
||||
break;
|
||||
|
||||
case HANDLES_RAW:
|
||||
|
@ -1255,9 +1255,9 @@ plug_in_rc_write (GSList *plug_in_defs,
|
|||
gimp_config_writer_close (writer);
|
||||
}
|
||||
|
||||
if (proc->handles_uri)
|
||||
if (proc->handles_remote)
|
||||
{
|
||||
gimp_config_writer_open (writer, "handles-uri");
|
||||
gimp_config_writer_open (writer, "handles-remote");
|
||||
gimp_config_writer_close (writer);
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ xcf_init (Gimp *gimp)
|
|||
gimp_plug_in_procedure_set_image_types (proc, "RGB*, GRAY*, INDEXED*");
|
||||
gimp_plug_in_procedure_set_file_proc (proc, "xcf", "", NULL);
|
||||
gimp_plug_in_procedure_set_mime_types (proc, "image/x-xcf");
|
||||
gimp_plug_in_procedure_set_handles_uri (proc);
|
||||
gimp_plug_in_procedure_set_handles_remote (proc);
|
||||
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-xcf-save");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
|
@ -190,7 +190,7 @@ xcf_init (Gimp *gimp)
|
|||
gimp_plug_in_procedure_set_file_proc (proc, "xcf", "",
|
||||
"0,string,gimp\\040xcf\\040");
|
||||
gimp_plug_in_procedure_set_mime_types (proc, "image/x-xcf");
|
||||
gimp_plug_in_procedure_set_handles_uri (proc);
|
||||
gimp_plug_in_procedure_set_handles_remote (proc);
|
||||
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-xcf-load");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
|
|
|
@ -257,14 +257,14 @@ EXPORTS
|
|||
gimp_file_load_layer
|
||||
gimp_file_load_layers
|
||||
gimp_file_procedure_get_extensions
|
||||
gimp_file_procedure_get_handles_uri
|
||||
gimp_file_procedure_get_handles_remote
|
||||
gimp_file_procedure_get_magics
|
||||
gimp_file_procedure_get_mime_types
|
||||
gimp_file_procedure_get_prefixes
|
||||
gimp_file_procedure_get_priority
|
||||
gimp_file_procedure_get_type
|
||||
gimp_file_procedure_set_extensions
|
||||
gimp_file_procedure_set_handles_uri
|
||||
gimp_file_procedure_set_handles_remote
|
||||
gimp_file_procedure_set_magics
|
||||
gimp_file_procedure_set_mime_types
|
||||
gimp_file_procedure_set_prefixes
|
||||
|
@ -701,7 +701,7 @@ EXPORTS
|
|||
gimp_progress_update
|
||||
gimp_quit
|
||||
gimp_register_file_handler_mime
|
||||
gimp_register_file_handler_uri
|
||||
gimp_register_file_handler_remote
|
||||
gimp_register_load_handler
|
||||
gimp_register_magic_load_handler
|
||||
gimp_register_save_handler
|
||||
|
|
|
@ -530,22 +530,22 @@ _gimp_register_file_handler_mime (const gchar *procedure_name,
|
|||
}
|
||||
|
||||
/**
|
||||
* _gimp_register_file_handler_uri:
|
||||
* @procedure_name: The name of the procedure to enable URIs for.
|
||||
* _gimp_register_file_handler_remote:
|
||||
* @procedure_name: The name of the procedure to enable remote URIs for.
|
||||
*
|
||||
* Registers a file handler procedure as capable of handling URIs.
|
||||
* Registers a file handler procedure as capable of handling remote
|
||||
* URIs.
|
||||
*
|
||||
* Registers a file handler procedure as capable of handling URIs. This
|
||||
* allows GIMP to call the procedure directly for all kinds of URIs,
|
||||
* and the 'filename' traditionally passed to file procedures turns
|
||||
* into an URI.
|
||||
* Registers a file handler procedure as capable of handling remote
|
||||
* URIs. This allows GIMP to call the procedure directly for all kinds
|
||||
* of URIs, not only on local file:// URIs.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: 2.10
|
||||
**/
|
||||
gboolean
|
||||
_gimp_register_file_handler_uri (const gchar *procedure_name)
|
||||
_gimp_register_file_handler_remote (const gchar *procedure_name)
|
||||
{
|
||||
GimpPDB *pdb = gimp_get_pdb ();
|
||||
GimpValueArray *args;
|
||||
|
@ -558,10 +558,10 @@ _gimp_register_file_handler_uri (const gchar *procedure_name)
|
|||
|
||||
if (pdb)
|
||||
return_vals = gimp_pdb_run_procedure_array (pdb,
|
||||
"gimp-register-file-handler-uri",
|
||||
"gimp-register-file-handler-remote",
|
||||
args);
|
||||
else
|
||||
return_vals = gimp_run_procedure_array ("gimp-register-file-handler-uri",
|
||||
return_vals = gimp_run_procedure_array ("gimp-register-file-handler-remote",
|
||||
args);
|
||||
gimp_value_array_unref (args);
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ G_GNUC_INTERNAL gboolean _gimp_register_file_handler_priority (const gchar *proc
|
|||
gint priority);
|
||||
G_GNUC_INTERNAL gboolean _gimp_register_file_handler_mime (const gchar *procedure_name,
|
||||
const gchar *mime_types);
|
||||
G_GNUC_INTERNAL gboolean _gimp_register_file_handler_uri (const gchar *procedure_name);
|
||||
G_GNUC_INTERNAL gboolean _gimp_register_file_handler_remote (const gchar *procedure_name);
|
||||
G_GNUC_INTERNAL gboolean _gimp_register_file_handler_raw (const gchar *procedure_name);
|
||||
G_GNUC_INTERNAL gboolean _gimp_register_thumbnail_loader (const gchar *load_proc,
|
||||
const gchar *thumb_proc);
|
||||
|
|
|
@ -33,7 +33,7 @@ struct _GimpFileProcedurePrivate
|
|||
gchar *prefixes;
|
||||
gchar *magics;
|
||||
gint priority;
|
||||
gboolean handles_uri;
|
||||
gboolean handles_remote;
|
||||
};
|
||||
|
||||
|
||||
|
@ -178,7 +178,7 @@ gimp_file_procedure_get_extensions (GimpFileProcedure *procedure)
|
|||
* handle (i.e. "http:,ftp:").
|
||||
*
|
||||
* It should almost never be neccessary to register prefixes with file
|
||||
* procedures, because most sorty of URIs should be handled by GIO.
|
||||
* procedures, because most sorts of URIs should be handled by GIO.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
|
@ -284,45 +284,45 @@ gimp_file_procedure_get_priority (GimpFileProcedure *procedure)
|
|||
}
|
||||
|
||||
/**
|
||||
* gimp_file_procedure_set_handles_uri:
|
||||
* @procedure: A #GimpFileProcedure.
|
||||
* @handles_uri: The procedure's handles uri flag.
|
||||
* gimp_file_procedure_set_handles_remote:
|
||||
* @procedure: A #GimpFileProcedure.
|
||||
* @handles_remote: The procedure's 'handles remote' flag.
|
||||
*
|
||||
* Registers a file procedure as capable of handling arbitrary URIs
|
||||
* via GIO.
|
||||
* Registers a file procedure as capable of handling arbitrary remote
|
||||
* URIs via GIO.
|
||||
*
|
||||
* When @handles_uri is set to %TRUE, the procedure will get a #GFile
|
||||
* passed that can point to a remote file.
|
||||
* When @handles_remote is set to %TRUE, the procedure will get a
|
||||
* #GFile passed that can point to a remote file.
|
||||
*
|
||||
* When @handles_uri is set to %FALSE, the procedure will get a local
|
||||
* #GFile passed and can use g_file_get_path() to get to a filename
|
||||
* that can be used with whatever non-GIO means of dealing with the
|
||||
* file.
|
||||
* When @handles_remote is set to %FALSE, the procedure will get a
|
||||
* local #GFile passed and can use g_file_get_path() to get to a
|
||||
* filename that can be used with whatever non-GIO means of dealing
|
||||
* with the file.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gimp_file_procedure_set_handles_uri (GimpFileProcedure *procedure,
|
||||
gint handles_uri)
|
||||
gimp_file_procedure_set_handles_remote (GimpFileProcedure *procedure,
|
||||
gint handles_remote)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_FILE_PROCEDURE (procedure));
|
||||
|
||||
procedure->priv->handles_uri = handles_uri;
|
||||
procedure->priv->handles_remote = handles_remote;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_file_procedure_get_handles_uri:
|
||||
* gimp_file_procedure_get_handles_remote:
|
||||
* @procedure: A #GimpFileProcedure.
|
||||
*
|
||||
* Returns: The procedure's handles uri flag as set with
|
||||
* gimp_file_procedure_set_handles_uri().
|
||||
* Returns: The procedure's 'handles remote' flag as set with
|
||||
* gimp_file_procedure_set_handles_remote().
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
gint
|
||||
gimp_file_procedure_get_handles_uri (GimpFileProcedure *procedure)
|
||||
gimp_file_procedure_get_handles_remote (GimpFileProcedure *procedure)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_FILE_PROCEDURE (procedure), 0);
|
||||
|
||||
return procedure->priv->handles_uri;
|
||||
return procedure->priv->handles_remote;
|
||||
}
|
||||
|
|
|
@ -76,9 +76,11 @@ void gimp_file_procedure_set_priority (GimpFileProcedure *procedur
|
|||
gint priority);
|
||||
gint gimp_file_procedure_get_priority (GimpFileProcedure *procedure);
|
||||
|
||||
void gimp_file_procedure_set_handles_uri (GimpFileProcedure *procedure,
|
||||
gboolean handles_uri);
|
||||
gboolean gimp_file_procedure_get_handles_uri (GimpFileProcedure *procedure);
|
||||
void gimp_file_procedure_set_handles_remote
|
||||
(GimpFileProcedure *procedure,
|
||||
gboolean handles_remote);
|
||||
gboolean gimp_file_procedure_get_handles_remote
|
||||
(GimpFileProcedure *procedure);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -494,26 +494,25 @@ gimp_register_file_handler_mime (const gchar *procedure_name,
|
|||
}
|
||||
|
||||
/**
|
||||
* gimp_register_file_handler_uri:
|
||||
* @procedure_name: The name of the procedure to enable URIs for.
|
||||
* gimp_register_file_handler_remote:
|
||||
* @procedure_name: The name of the procedure to enable remote URIs for.
|
||||
*
|
||||
* Registers a file handler procedure as capable of handling URIs.
|
||||
* Registers a file handler procedure as capable of handling remote URIs.
|
||||
*
|
||||
* Registers a file handler procedure as capable of handling URIs. This
|
||||
* allows GIMP to call the procedure directly for all kinds of URIs,
|
||||
* and the 'filename' traditionally passed to file procedures turns
|
||||
* into an URI.
|
||||
* note only local file:// URIs.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: 2.10
|
||||
**/
|
||||
gboolean
|
||||
gimp_register_file_handler_uri (const gchar *procedure_name)
|
||||
gimp_register_file_handler_remote (const gchar *procedure_name)
|
||||
{
|
||||
ASSERT_NO_PLUG_IN_EXISTS (G_STRFUNC);
|
||||
|
||||
return _gimp_register_file_handler_uri (procedure_name);
|
||||
return _gimp_register_file_handler_remote (procedure_name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -280,7 +280,7 @@ gboolean gimp_register_save_handler (const gchar *procedure_name,
|
|||
const gchar *prefixes);
|
||||
gboolean gimp_register_file_handler_mime (const gchar *procedure_name,
|
||||
const gchar *mime_types);
|
||||
gboolean gimp_register_file_handler_uri (const gchar *procedure_name);
|
||||
gboolean gimp_register_file_handler_remote (const gchar *procedure_name);
|
||||
gboolean gimp_register_thumbnail_loader (const gchar *load_proc,
|
||||
const gchar *thumb_proc);
|
||||
|
||||
|
|
|
@ -140,8 +140,8 @@ gimp_load_procedure_install (GimpProcedure *procedure)
|
|||
gimp_file_procedure_get_prefixes (file_proc));
|
||||
}
|
||||
|
||||
if (gimp_file_procedure_get_handles_uri (file_proc))
|
||||
_gimp_register_file_handler_uri (gimp_procedure_get_name (procedure));
|
||||
if (gimp_file_procedure_get_handles_remote (file_proc))
|
||||
_gimp_register_file_handler_remote (gimp_procedure_get_name (procedure));
|
||||
|
||||
mime_types = gimp_file_procedure_get_mime_types (file_proc);
|
||||
if (mime_types)
|
||||
|
@ -177,10 +177,7 @@ gimp_load_procedure_run (GimpProcedure *procedure,
|
|||
uri = g_value_get_string (gimp_value_array_index (args, 1));
|
||||
/* raw_uri = g_value_get_string (gimp_value_array_index (args, 2)); */
|
||||
|
||||
if (gimp_file_procedure_get_handles_uri (GIMP_FILE_PROCEDURE (procedure)))
|
||||
file = g_file_new_for_uri (uri);
|
||||
else
|
||||
file = g_file_new_for_path (uri);
|
||||
file = g_file_new_for_uri (uri);
|
||||
|
||||
remaining = gimp_value_array_new (gimp_value_array_length (args) - 3);
|
||||
|
||||
|
|
|
@ -131,8 +131,8 @@ gimp_save_procedure_install (GimpProcedure *procedure)
|
|||
gimp_file_procedure_get_extensions (file_proc),
|
||||
gimp_file_procedure_get_prefixes (file_proc));
|
||||
|
||||
if (gimp_file_procedure_get_handles_uri (file_proc))
|
||||
_gimp_register_file_handler_uri (gimp_procedure_get_name (procedure));
|
||||
if (gimp_file_procedure_get_handles_remote (file_proc))
|
||||
_gimp_register_file_handler_remote (gimp_procedure_get_name (procedure));
|
||||
|
||||
mime_types = gimp_file_procedure_get_mime_types (file_proc);
|
||||
if (mime_types)
|
||||
|
@ -165,10 +165,7 @@ gimp_save_procedure_run (GimpProcedure *procedure,
|
|||
uri = g_value_get_string (gimp_value_array_index (args, 3));
|
||||
/* raw_uri = g_value_get_string (gimp_value_array_index (args, 4)); */
|
||||
|
||||
if (gimp_file_procedure_get_handles_uri (GIMP_FILE_PROCEDURE (procedure)))
|
||||
file = g_file_new_for_uri (uri);
|
||||
else
|
||||
file = g_file_new_for_path (uri);
|
||||
file = g_file_new_for_uri (uri);
|
||||
|
||||
remaining = gimp_value_array_new (gimp_value_array_length (args) - 5);
|
||||
|
||||
|
|
|
@ -85,12 +85,8 @@ HELP
|
|||
g_value_transform (gimp_value_array_index (args, 0),
|
||||
gimp_value_array_index (new_args, 0));
|
||||
|
||||
if (file_proc->handles_uri)
|
||||
g_value_take_string (gimp_value_array_index (new_args, 1),
|
||||
g_file_get_uri (file));
|
||||
else
|
||||
g_value_transform (gimp_value_array_index (args, 1),
|
||||
gimp_value_array_index (new_args, 1));
|
||||
g_value_take_string (gimp_value_array_index (new_args, 1),
|
||||
g_file_get_uri (file));
|
||||
|
||||
g_value_transform (gimp_value_array_index (args, 2),
|
||||
gimp_value_array_index (new_args, 2));
|
||||
|
@ -330,12 +326,8 @@ HELP
|
|||
g_value_transform (gimp_value_array_index (args, 2),
|
||||
gimp_value_array_index (new_args, 2));
|
||||
|
||||
if (file_proc->handles_uri)
|
||||
g_value_take_string (gimp_value_array_index (new_args, 3),
|
||||
g_file_get_uri (file));
|
||||
else
|
||||
g_value_transform (gimp_value_array_index (args, 3),
|
||||
gimp_value_array_index (new_args, 3));
|
||||
g_value_take_string (gimp_value_array_index (new_args, 3),
|
||||
g_file_get_uri (file));
|
||||
|
||||
g_value_transform (gimp_value_array_index (args, 4),
|
||||
gimp_value_array_index (new_args, 4));
|
||||
|
@ -587,14 +579,13 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
sub register_file_handler_uri {
|
||||
$blurb = 'Registers a file handler procedure as capable of handling URIs.';
|
||||
sub register_file_handler_remote {
|
||||
$blurb = 'Registers a file handler procedure as capable of handling remote URIs.';
|
||||
|
||||
$help = <<'HELP';
|
||||
Registers a file handler procedure as capable of handling URIs. This
|
||||
allows GIMP to call the procedure directly for all kinds of URIs, and
|
||||
the 'filename' traditionally passed to file procedures turns into an
|
||||
URI.
|
||||
Registers a file handler procedure as capable of handling remote
|
||||
URIs. This allows GIMP to call the procedure directly for all kinds of
|
||||
URIs, not only on local file:// URIs.
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2012', '2.10');
|
||||
|
@ -603,15 +594,15 @@ HELP
|
|||
|
||||
@inargs = (
|
||||
{ name => 'procedure_name', type => 'string', non_empty => 1,
|
||||
desc => "The name of the procedure to enable URIs for." }
|
||||
desc => "The name of the procedure to enable remote URIs for." }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
success = (gimp_pdb_is_canonical_procedure (procedure_name, error) &&
|
||||
gimp_plug_in_manager_register_handles_uri (gimp->plug_in_manager,
|
||||
procedure_name));
|
||||
gimp_plug_in_manager_register_handles_remote (gimp->plug_in_manager,
|
||||
procedure_name));
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
@ -737,7 +728,7 @@ CODE
|
|||
register_save_handler
|
||||
register_file_handler_priority
|
||||
register_file_handler_mime
|
||||
register_file_handler_uri
|
||||
register_file_handler_remote
|
||||
register_file_handler_raw
|
||||
register_thumbnail_loader);
|
||||
|
||||
|
|
|
@ -220,7 +220,9 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (save_aa (drawable_ID, param[3].data.d_string, output_type))
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
if (save_aa (drawable_ID, g_file_get_path (file), output_type))
|
||||
{
|
||||
gimp_set_data (SAVE_PROC, &output_type, sizeof (output_type));
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ query (void)
|
|||
G_N_ELEMENTS (save_args), 0,
|
||||
save_args, NULL);
|
||||
|
||||
gimp_register_file_handler_uri (SAVE_PROC);
|
||||
gimp_register_file_handler_remote (SAVE_PROC);
|
||||
gimp_register_save_handler (SAVE_PROC, "cel", "");
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,9 @@ run (const gchar *name,
|
|||
|
||||
if (! error)
|
||||
{
|
||||
image = load_image (param[1].data.d_string,
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
image = load_image (g_file_get_path (file),
|
||||
&error);
|
||||
|
||||
if (image != -1)
|
||||
|
|
|
@ -115,7 +115,7 @@ query (void)
|
|||
save_args, NULL);
|
||||
|
||||
gimp_register_file_handler_mime (SAVE_PROC, "text/x-csrc");
|
||||
gimp_register_file_handler_uri (SAVE_PROC);
|
||||
gimp_register_file_handler_remote (SAVE_PROC);
|
||||
gimp_register_save_handler (SAVE_PROC, "c", "");
|
||||
}
|
||||
|
||||
|
|
|
@ -199,7 +199,9 @@ run (const gchar *name,
|
|||
|
||||
if (strcmp (name, LOAD_PROC) == 0)
|
||||
{
|
||||
image_ID = load_image (param[1].data.d_string, &error);
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
image_ID = load_image (g_file_get_path (file), &error);
|
||||
|
||||
if (image_ID != -1)
|
||||
{
|
||||
|
@ -265,7 +267,10 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (param[3].data.d_string, image_ID, drawable_ID,
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
if (! save_image (g_file_get_path (file),
|
||||
image_ID, drawable_ID,
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
|
|
@ -152,8 +152,8 @@ gbr_create_procedure (GimpPlugIn *plug_in,
|
|||
"image/x-gimp-gbr");
|
||||
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
|
||||
"gbr");
|
||||
gimp_file_procedure_set_handles_uri (GIMP_FILE_PROCEDURE (procedure),
|
||||
TRUE);
|
||||
gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure),
|
||||
TRUE);
|
||||
|
||||
GIMP_PROC_ARG_INT (procedure, "spacing",
|
||||
"Spacing",
|
||||
|
|
|
@ -216,7 +216,9 @@ run (const gchar *name,
|
|||
|
||||
if (format->load_proc && !strcmp (name, format->load_proc))
|
||||
{
|
||||
image_ID = load_image (param[1].data.d_string, &error);
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
image_ID = load_image (g_file_get_path (file), &error);
|
||||
|
||||
if (image_ID != -1)
|
||||
{
|
||||
|
@ -233,6 +235,8 @@ run (const gchar *name,
|
|||
}
|
||||
else if (format->save_proc && !strcmp (name, format->save_proc))
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
GimpExportReturn export = GIMP_EXPORT_CANCEL;
|
||||
|
||||
image_ID = param[1].data.d_int32;
|
||||
|
@ -263,7 +267,8 @@ run (const gchar *name,
|
|||
break;
|
||||
}
|
||||
|
||||
if (! save_image (param[3].data.d_string, image_ID, drawable_ID,
|
||||
if (! save_image (g_file_get_path (file),
|
||||
image_ID, drawable_ID,
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
|
|
@ -191,9 +191,9 @@ query (void)
|
|||
|
||||
gimp_register_file_handler_mime (SAVE_PROC, "image/gif");
|
||||
gimp_register_save_handler (SAVE_PROC, "gif", "");
|
||||
gimp_register_file_handler_uri (SAVE_PROC);
|
||||
gimp_register_file_handler_remote (SAVE_PROC);
|
||||
|
||||
gimp_register_file_handler_uri (SAVE2_PROC);
|
||||
gimp_register_file_handler_remote (SAVE2_PROC);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -195,8 +195,8 @@ gih_create_procedure (GimpPlugIn *plug_in,
|
|||
"image/x-gimp-gih");
|
||||
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
|
||||
"gih");
|
||||
gimp_file_procedure_set_handles_uri (GIMP_FILE_PROCEDURE (procedure),
|
||||
TRUE);
|
||||
gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure),
|
||||
TRUE);
|
||||
|
||||
GIMP_PROC_ARG_INT (procedure, "spacing",
|
||||
"Spacing",
|
||||
|
|
|
@ -69,6 +69,7 @@ query (void)
|
|||
{ GIMP_PDB_STRINGARRAY, "files", "The list of matching names" }
|
||||
};
|
||||
|
||||
/* FIXME filename encoding */
|
||||
|
||||
gimp_install_procedure (PLUG_IN_PROC,
|
||||
"Returns a list of matching filenames",
|
||||
|
|
|
@ -86,7 +86,7 @@ query (void)
|
|||
save_args, NULL);
|
||||
|
||||
gimp_register_file_handler_mime (SAVE_PROC, "text/x-chdr");
|
||||
gimp_register_file_handler_uri (SAVE_PROC);
|
||||
gimp_register_file_handler_remote (SAVE_PROC);
|
||||
gimp_register_save_handler (SAVE_PROC, "h", "");
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ query (void)
|
|||
|
||||
gimp_register_load_handler (LOAD_PROC, "heic,heif", "");
|
||||
gimp_register_file_handler_mime (LOAD_PROC, "image/heif");
|
||||
gimp_register_file_handler_uri (LOAD_PROC);
|
||||
gimp_register_file_handler_remote (LOAD_PROC);
|
||||
/* HEIF is an ISOBMFF format whose "brand" (the value after "ftyp")
|
||||
* can be of various values.
|
||||
* See also: https://gitlab.gnome.org/GNOME/gimp/issues/2209
|
||||
|
@ -149,7 +149,7 @@ query (void)
|
|||
|
||||
gimp_register_save_handler (SAVE_PROC, "heic,heif", "");
|
||||
gimp_register_file_handler_mime (SAVE_PROC, "image/heif");
|
||||
gimp_register_file_handler_uri (SAVE_PROC);
|
||||
gimp_register_file_handler_remote (SAVE_PROC);
|
||||
}
|
||||
|
||||
#define LOAD_HEIF_CANCEL -2
|
||||
|
|
|
@ -157,7 +157,7 @@ query (void)
|
|||
save_args, NULL);
|
||||
|
||||
gimp_register_file_handler_mime (SAVE_PROC, "text/html");
|
||||
gimp_register_file_handler_uri (SAVE_PROC);
|
||||
gimp_register_file_handler_remote (SAVE_PROC);
|
||||
gimp_register_save_handler (SAVE_PROC, "html,htm", "");
|
||||
}
|
||||
|
||||
|
|
|
@ -224,6 +224,8 @@ run (const gchar *name,
|
|||
if (strcmp (name, LOAD_JP2_PROC) == 0 ||
|
||||
strcmp (name, LOAD_J2K_PROC) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
OPJ_COLOR_SPACE color_space = OPJ_CLRSPC_UNKNOWN;
|
||||
gboolean interactive;
|
||||
|
||||
|
@ -270,20 +272,19 @@ run (const gchar *name,
|
|||
|
||||
if (strcmp (name, LOAD_JP2_PROC) == 0)
|
||||
{
|
||||
image_ID = load_image (param[1].data.d_string, OPJ_CODEC_JP2,
|
||||
image_ID = load_image (g_file_get_path (file), OPJ_CODEC_JP2,
|
||||
color_space, interactive, &profile_loaded,
|
||||
&error);
|
||||
}
|
||||
else /* strcmp (name, LOAD_J2K_PROC) == 0 */
|
||||
{
|
||||
image_ID = load_image (param[1].data.d_string, OPJ_CODEC_J2K,
|
||||
image_ID = load_image (g_file_get_path (file), OPJ_CODEC_J2K,
|
||||
color_space, interactive, &profile_loaded,
|
||||
&error);
|
||||
}
|
||||
|
||||
if (image_ID != -1)
|
||||
{
|
||||
GFile *file = g_file_new_for_path (param[1].data.d_string);
|
||||
GimpMetadata *metadata;
|
||||
|
||||
metadata = gimp_image_metadata_load_prepare (image_ID, "image/jp2",
|
||||
|
@ -303,8 +304,6 @@ run (const gchar *name,
|
|||
g_object_unref (metadata);
|
||||
}
|
||||
|
||||
g_object_unref (file);
|
||||
|
||||
*nreturn_vals = 2;
|
||||
values[1].type = GIMP_PDB_IMAGE;
|
||||
values[1].data.d_image = image_ID;
|
||||
|
|
|
@ -1749,9 +1749,11 @@ run (const gchar *name,
|
|||
|
||||
if (values[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
GError *error = NULL;
|
||||
|
||||
if (mng_save_image (param[3].data.d_string,
|
||||
if (mng_save_image (g_file_get_path (file),
|
||||
image_id, drawable_id,
|
||||
original_image_id, &error))
|
||||
{
|
||||
|
|
|
@ -124,8 +124,8 @@ pat_create_procedure (GimpPlugIn *plug_in,
|
|||
"image/x-gimp-pat");
|
||||
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
|
||||
"pat");
|
||||
gimp_file_procedure_set_handles_uri (GIMP_FILE_PROCEDURE (procedure),
|
||||
TRUE);
|
||||
gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure),
|
||||
TRUE);
|
||||
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_string ("description",
|
||||
|
|
|
@ -201,7 +201,9 @@ run (const gchar *name,
|
|||
|
||||
if (strcmp (name, LOAD_PROC) == 0)
|
||||
{
|
||||
image_ID = load_image (param[1].data.d_string, &error);
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
image_ID = load_image (g_file_get_path (file), &error);
|
||||
|
||||
if (image_ID != -1)
|
||||
{
|
||||
|
@ -216,6 +218,8 @@ run (const gchar *name,
|
|||
}
|
||||
else if (strcmp (name, SAVE_PROC) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
image_ID = param[1].data.d_int32;
|
||||
drawable_ID = param[2].data.d_int32;
|
||||
|
||||
|
@ -260,7 +264,8 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (param[3].data.d_string, image_ID, drawable_ID,
|
||||
if (! save_image (g_file_get_path (file),
|
||||
image_ID, drawable_ID,
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
|
|
@ -392,6 +392,8 @@ run (const gchar *name,
|
|||
|
||||
if (strcmp (name, LOAD_PROC) == 0 || strcmp (name, LOAD2_PROC) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
PdfSelectedPages pages = { 0, NULL };
|
||||
GimpRunMode run_mode;
|
||||
|
||||
|
@ -409,7 +411,7 @@ run (const gchar *name,
|
|||
gimp_get_data (LOAD2_PROC, &loadvals);
|
||||
}
|
||||
gimp_ui_init (PLUG_IN_BINARY, FALSE);
|
||||
doc = open_document (param[1].data.d_string,
|
||||
doc = open_document (g_file_get_path (file),
|
||||
loadvals.PDF_password,
|
||||
run_mode, &error);
|
||||
|
||||
|
@ -441,12 +443,12 @@ run (const gchar *name,
|
|||
case GIMP_RUN_NONINTERACTIVE:
|
||||
if (strcmp (name, LOAD_PROC) == 0)
|
||||
{
|
||||
doc = open_document (param[1].data.d_string,
|
||||
doc = open_document (g_file_get_path (file),
|
||||
NULL, run_mode, &error);
|
||||
}
|
||||
else if (strcmp (name, LOAD2_PROC) == 0)
|
||||
{
|
||||
doc = open_document (param[1].data.d_string,
|
||||
doc = open_document (g_file_get_path (file),
|
||||
param[3].data.d_string,
|
||||
run_mode, &error);
|
||||
}
|
||||
|
@ -504,7 +506,7 @@ run (const gchar *name,
|
|||
ngettext ("PDF document '%1$s' has %3$d page. Page %2$d is out of range.",
|
||||
"PDF document '%1$s' has %3$d pages. Page %2$d is out of range.",
|
||||
doc_n_pages),
|
||||
param[1].data.d_string,
|
||||
gimp_file_get_utf8_name (file),
|
||||
param[5].data.d_int32array[i],
|
||||
doc_n_pages);
|
||||
break;
|
||||
|
@ -533,7 +535,8 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
image_ID = load_image (doc, param[1].data.d_string,
|
||||
image_ID = load_image (doc,
|
||||
g_file_get_path (file),
|
||||
run_mode,
|
||||
loadvals.target,
|
||||
loadvals.resolution,
|
||||
|
@ -559,6 +562,8 @@ run (const gchar *name,
|
|||
}
|
||||
else if (strcmp (name, LOAD_THUMB_PROC) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[0].data.d_string);
|
||||
|
||||
if (nparams < 2)
|
||||
{
|
||||
status = GIMP_PDB_CALLING_ERROR;
|
||||
|
@ -582,7 +587,7 @@ run (const gchar *name,
|
|||
gimp_get_data (LOAD2_PROC, &loadvals);
|
||||
}
|
||||
|
||||
doc = open_document (param[0].data.d_string,
|
||||
doc = open_document (g_file_get_path (file),
|
||||
loadvals.PDF_password,
|
||||
GIMP_RUN_NONINTERACTIVE,
|
||||
&error);
|
||||
|
|
|
@ -658,10 +658,12 @@ init_vals (const gchar *name,
|
|||
if ((g_str_equal (name, SAVE_PROC) && nparams == SA_ARG_COUNT - 2) ||
|
||||
(g_str_equal (name, SAVE2_PROC) && nparams == SA_ARG_COUNT))
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[SA_FILENAME].data.d_string);
|
||||
|
||||
single = TRUE;
|
||||
*run_mode = param[SA_RUN_MODE].data.d_int32;
|
||||
image = param[SA_IMAGE].data.d_int32;
|
||||
file_name = param[SA_FILENAME].data.d_string;
|
||||
file_name = g_file_get_path (file);
|
||||
|
||||
if (*run_mode == GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
|
@ -679,13 +681,15 @@ init_vals (const gchar *name,
|
|||
}
|
||||
else if (g_str_equal (name, SAVE_MULTI_PROC))
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[SMA_FILENAME].data.d_string);
|
||||
|
||||
single = FALSE;
|
||||
if (nparams != SMA_ARG_COUNT)
|
||||
return FALSE;
|
||||
|
||||
*run_mode = param[SMA_RUN_MODE].data.d_int32;
|
||||
image = -1;
|
||||
file_name = param[SMA_FILENAME].data.d_string;
|
||||
file_name = g_file_get_path (file);
|
||||
|
||||
optimize.apply_masks = param[SMA_APPLY_MASKS].data.d_int32;
|
||||
optimize.vectorize = param[SMA_VECTORIZE].data.d_int32;
|
||||
|
|
|
@ -147,7 +147,7 @@ query (void)
|
|||
G_N_ELEMENTS (load_return_vals),
|
||||
load_args, load_return_vals);
|
||||
|
||||
gimp_register_file_handler_uri (LOAD_PROC);
|
||||
gimp_register_file_handler_remote (LOAD_PROC);
|
||||
gimp_register_load_handler (LOAD_PROC, "pix,matte,mask,alpha,als", "");
|
||||
|
||||
gimp_install_procedure (SAVE_PROC,
|
||||
|
@ -162,7 +162,7 @@ query (void)
|
|||
G_N_ELEMENTS (save_args), 0,
|
||||
save_args, NULL);
|
||||
|
||||
gimp_register_file_handler_uri (SAVE_PROC);
|
||||
gimp_register_file_handler_remote (SAVE_PROC);
|
||||
gimp_register_save_handler (SAVE_PROC, "pix,matte,mask,alpha,als", "");
|
||||
}
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ query (void)
|
|||
load_args, load_return_vals);
|
||||
|
||||
gimp_register_file_handler_mime (LOAD_PROC, "image/x-portable-anymap");
|
||||
gimp_register_file_handler_uri (LOAD_PROC);
|
||||
gimp_register_file_handler_remote (LOAD_PROC);
|
||||
gimp_register_magic_load_handler (LOAD_PROC,
|
||||
"pnm,ppm,pgm,pbm,pfm",
|
||||
"",
|
||||
|
@ -344,11 +344,11 @@ query (void)
|
|||
gimp_register_file_handler_mime (PPM_SAVE_PROC, "image/x-portable-pixmap");
|
||||
gimp_register_file_handler_mime (PPM_SAVE_PROC, "image/x-portable-floatmap");
|
||||
|
||||
gimp_register_file_handler_uri (PNM_SAVE_PROC);
|
||||
gimp_register_file_handler_uri (PBM_SAVE_PROC);
|
||||
gimp_register_file_handler_uri (PGM_SAVE_PROC);
|
||||
gimp_register_file_handler_uri (PPM_SAVE_PROC);
|
||||
gimp_register_file_handler_uri (PFM_SAVE_PROC);
|
||||
gimp_register_file_handler_remote (PNM_SAVE_PROC);
|
||||
gimp_register_file_handler_remote (PBM_SAVE_PROC);
|
||||
gimp_register_file_handler_remote (PGM_SAVE_PROC);
|
||||
gimp_register_file_handler_remote (PPM_SAVE_PROC);
|
||||
gimp_register_file_handler_remote (PFM_SAVE_PROC);
|
||||
|
||||
gimp_register_save_handler (PNM_SAVE_PROC, "pnm", "");
|
||||
gimp_register_save_handler (PBM_SAVE_PROC, "pbm", "");
|
||||
|
|
|
@ -541,8 +541,8 @@ ps_create_procedure (GimpPlugIn *plug_in,
|
|||
"Peter Kirchgessner",
|
||||
dversion);
|
||||
|
||||
gimp_file_procedure_set_handles_uri (GIMP_FILE_PROCEDURE (procedure),
|
||||
TRUE);
|
||||
gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure),
|
||||
TRUE);
|
||||
|
||||
GIMP_PROC_ARG_DOUBLE (procedure, "width",
|
||||
"Width",
|
||||
|
|
|
@ -1986,7 +1986,9 @@ run (const gchar *name,
|
|||
|
||||
if (strcmp (name, LOAD_PROC) == 0)
|
||||
{
|
||||
image_ID = load_image (param[1].data.d_string, &error);
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
image_ID = load_image (g_file_get_path (file), &error);
|
||||
|
||||
if (image_ID != -1)
|
||||
{
|
||||
|
@ -2064,7 +2066,9 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (save_image (param[3].data.d_string, image_ID, drawable_ID,
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
if (save_image (g_file_get_path (file), image_ID, drawable_ID,
|
||||
&error))
|
||||
{
|
||||
gimp_set_data (SAVE_PROC, &psvals, sizeof (PSPSaveVals));
|
||||
|
|
|
@ -399,6 +399,8 @@ run (const gchar *name,
|
|||
if (strcmp (name, LOAD_PROC) == 0 ||
|
||||
strcmp (name, LOAD_HGT_PROC) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
gboolean is_hgt = (strcmp (name, LOAD_HGT_PROC) == 0);
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
@ -417,12 +419,12 @@ run (const gchar *name,
|
|||
|
||||
runtime->image_type = RAW_GRAY_16BPP_SBE;
|
||||
|
||||
fp = g_fopen (param[1].data.d_string, "rb");
|
||||
fp = g_fopen (g_file_get_path (file), "rb");
|
||||
if (! fp)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, g_file_error_from_errno (errno),
|
||||
_("Could not open '%s' for size verification: %s"),
|
||||
gimp_filename_to_utf8 (param[1].data.d_string),
|
||||
gimp_file_get_utf8_name (file),
|
||||
g_strerror (errno));
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
@ -469,20 +471,20 @@ run (const gchar *name,
|
|||
if (! is_hgt)
|
||||
gimp_get_data (LOAD_PROC, runtime);
|
||||
|
||||
preview_fd = g_open (param[1].data.d_string, O_RDONLY, 0);
|
||||
preview_fd = g_open (g_file_get_path (file), O_RDONLY, 0);
|
||||
if (preview_fd < 0)
|
||||
{
|
||||
g_set_error (&error,
|
||||
G_FILE_ERROR, g_file_error_from_errno (errno),
|
||||
_("Could not open '%s' for reading: %s"),
|
||||
gimp_filename_to_utf8 (param[1].data.d_string),
|
||||
gimp_file_get_utf8_name (file),
|
||||
g_strerror (errno));
|
||||
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! load_dialog (param[1].data.d_string, is_hgt))
|
||||
if (! load_dialog (g_file_get_path (file), is_hgt))
|
||||
status = GIMP_PDB_CANCEL;
|
||||
|
||||
close (preview_fd);
|
||||
|
@ -522,7 +524,7 @@ run (const gchar *name,
|
|||
"or its variant is not supported yet. "
|
||||
"Supported HGT files are: SRTM-1 and SRTM-3. "
|
||||
"If you know the variant, run with argument 1 or 3."),
|
||||
gimp_filename_to_utf8 (param[1].data.d_string));
|
||||
gimp_file_get_utf8_name (file));
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
|
@ -549,7 +551,7 @@ run (const gchar *name,
|
|||
/* we are okay, and the user clicked OK in the load dialog */
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
image_id = load_image (param[1].data.d_string, &error);
|
||||
image_id = load_image (g_file_get_path (file), &error);
|
||||
|
||||
if (image_id != -1)
|
||||
{
|
||||
|
@ -568,7 +570,7 @@ run (const gchar *name,
|
|||
if (status != GIMP_PDB_SUCCESS && error)
|
||||
{
|
||||
g_warning ("Loading \"%s\" failed with error: %s",
|
||||
param[1].data.d_string,
|
||||
gimp_file_get_utf8_name (file),
|
||||
error->message);
|
||||
}
|
||||
|
||||
|
@ -577,6 +579,8 @@ run (const gchar *name,
|
|||
else if (strcmp (name, SAVE_PROC) == 0 ||
|
||||
strcmp (name, SAVE_PROC2) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
image_id = param[1].data.d_int32;
|
||||
drawable_id = param[2].data.d_int32;
|
||||
|
@ -649,7 +653,7 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (save_image (param[3].data.d_string,
|
||||
if (save_image (g_file_get_path (file),
|
||||
image_id, drawable_id, &error))
|
||||
{
|
||||
gimp_set_data (SAVE_PROC, &rawvals, sizeof (rawvals));
|
||||
|
|
|
@ -312,7 +312,9 @@ run (const gchar *name,
|
|||
|
||||
if (strcmp (name, LOAD_PROC) == 0)
|
||||
{
|
||||
image_ID = load_image (param[1].data.d_string, &error);
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
image_ID = load_image (g_file_get_path (file), &error);
|
||||
|
||||
if (image_ID != -1)
|
||||
{
|
||||
|
@ -327,6 +329,8 @@ run (const gchar *name,
|
|||
}
|
||||
else if (strcmp (name, SAVE_PROC) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
image_ID = param[1].data.d_int32;
|
||||
drawable_ID = param[2].data.d_int32;
|
||||
|
||||
|
@ -386,7 +390,8 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (save_image (param[3].data.d_string, image_ID, drawable_ID,
|
||||
if (save_image (g_file_get_path (file),
|
||||
image_ID, drawable_ID,
|
||||
&error))
|
||||
{
|
||||
/* Store psvals data */
|
||||
|
|
|
@ -303,11 +303,13 @@ run (const gchar *name,
|
|||
|
||||
if (strcmp (name, LOAD_PROC) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
#ifdef PROFILE
|
||||
times (&tbuf1);
|
||||
#endif
|
||||
|
||||
image_ID = load_image (param[1].data.d_string, &error);
|
||||
image_ID = load_image (g_file_get_path (file), &error);
|
||||
|
||||
if (image_ID != -1)
|
||||
{
|
||||
|
@ -322,6 +324,8 @@ run (const gchar *name,
|
|||
}
|
||||
else if (strcmp (name, SAVE_PROC) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
gimp_ui_init (PLUG_IN_BINARY, FALSE);
|
||||
|
||||
image_ID = param[1].data.d_int32;
|
||||
|
@ -386,7 +390,8 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (save_image (param[3].data.d_string, image_ID, drawable_ID,
|
||||
if (save_image (g_file_get_path (file),
|
||||
image_ID, drawable_ID,
|
||||
&error))
|
||||
{
|
||||
/* Store psvals data */
|
||||
|
|
|
@ -186,7 +186,9 @@ run (const gchar *name,
|
|||
|
||||
if (strcmp (name, LOAD_PROC) == 0)
|
||||
{
|
||||
filename = param[1].data.d_string;
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
filename = g_file_get_path (file);
|
||||
|
||||
gimp_get_data (LOAD_PROC, &load_vals);
|
||||
|
||||
|
@ -199,7 +201,7 @@ run (const gchar *name,
|
|||
break;
|
||||
|
||||
case GIMP_RUN_INTERACTIVE:
|
||||
if (!load_dialog (param[1].data.d_string))
|
||||
if (! load_dialog (filename))
|
||||
status = GIMP_PDB_CANCEL;
|
||||
break;
|
||||
|
||||
|
@ -209,9 +211,11 @@ run (const gchar *name,
|
|||
}
|
||||
else if (strcmp (name, LOAD_THUMB_PROC) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[0].data.d_string);
|
||||
|
||||
gint size = param[1].data.d_int32;
|
||||
|
||||
filename = param[0].data.d_string;
|
||||
filename = g_file_get_path (file);
|
||||
|
||||
if (size > 0 &&
|
||||
load_wmf_size (filename, &load_vals) &&
|
||||
|
|
|
@ -205,7 +205,7 @@ query (void)
|
|||
save_args, NULL);
|
||||
|
||||
gimp_register_file_handler_mime (SAVE_PROC, "image/x-xbitmap");
|
||||
gimp_register_file_handler_uri (SAVE_PROC);
|
||||
gimp_register_file_handler_remote (SAVE_PROC);
|
||||
gimp_register_save_handler (SAVE_PROC, "xbm,icon,bitmap", "");
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,9 @@ run (const gchar *name,
|
|||
|
||||
if (strcmp (name, LOAD_PROC) == 0)
|
||||
{
|
||||
image_ID = load_image (param[1].data.d_string, &error);
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
image_ID = load_image (g_file_get_path (file), &error);
|
||||
|
||||
if (image_ID != -1)
|
||||
{
|
||||
|
|
|
@ -422,9 +422,12 @@ run (const gchar *name,
|
|||
|
||||
if (strcmp (name, LOAD_PROC) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
DM_XMC ("Starting to load file.\tparam.data=%s\n",
|
||||
param[1].data.d_string);
|
||||
image_ID = load_image (param[1].data.d_string, &error);
|
||||
gimp_file_get_utf8_name (file));
|
||||
|
||||
image_ID = load_image (g_file_get_path (file), &error);
|
||||
|
||||
if (image_ID != -1)
|
||||
{
|
||||
|
@ -440,9 +443,12 @@ run (const gchar *name,
|
|||
}
|
||||
else if (strcmp (name, LOAD_THUMB_PROC) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[0].data.d_string);
|
||||
|
||||
DM_XMC ("Starting to load thumbnail.\tfilename=%s\tthumb-size=%d\n",
|
||||
param[0].data.d_string, param[1].data.d_int32);
|
||||
image_ID = load_thumbnail (param[0].data.d_string,
|
||||
gimp_file_get_utf8_name (file), param[1].data.d_int32);
|
||||
|
||||
image_ID = load_thumbnail (g_file_get_path (file),
|
||||
param[1].data.d_int32,
|
||||
&width,
|
||||
&height,
|
||||
|
@ -473,7 +479,10 @@ run (const gchar *name,
|
|||
}
|
||||
else if (strcmp (name, SAVE_PROC) == 0)
|
||||
{
|
||||
DM_XMC ("run: export %s\n", name);
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
DM_XMC ("run: exprort %s\n", name);
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
image_ID = orig_image_ID = param[1].data.d_int32;
|
||||
drawable_ID = param[2].data.d_int32;
|
||||
|
@ -483,7 +492,9 @@ run (const gchar *name,
|
|||
{
|
||||
g_set_error (&error, 0, 0,
|
||||
_("Cannot set the hot spot!\n"
|
||||
"You must arrange layers so that all of them have an intersection."));
|
||||
"You must arrange layers so that all of them have "
|
||||
"an intersection."));
|
||||
|
||||
*nreturn_vals = 2;
|
||||
values[1].type = GIMP_PDB_STRING;
|
||||
values[1].data.d_string = error->message;
|
||||
|
@ -589,10 +600,12 @@ run (const gchar *name,
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (save_image (param[3].data.d_string, image_ID,
|
||||
drawable_ID, orig_image_ID, &error))
|
||||
if (save_image (g_file_get_path (file),
|
||||
image_ID, drawable_ID, orig_image_ID,
|
||||
&error))
|
||||
{
|
||||
gimp_set_data (SAVE_PROC, &xmcvals, sizeof (XmcSaveVals));
|
||||
}
|
||||
|
|
|
@ -234,7 +234,9 @@ run (const gchar *name,
|
|||
|
||||
if (strcmp (name, LOAD_PROC) == 0)
|
||||
{
|
||||
image_ID = load_image (param[1].data.d_string, &error);
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
image_ID = load_image (g_file_get_path (file), &error);
|
||||
|
||||
if (image_ID != -1)
|
||||
{
|
||||
|
@ -249,6 +251,8 @@ run (const gchar *name,
|
|||
}
|
||||
else if (strcmp (name, SAVE_PROC) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
gimp_ui_init (PLUG_IN_BINARY, FALSE);
|
||||
|
||||
image_ID = param[1].data.d_int32;
|
||||
|
@ -314,8 +318,9 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (save_image (param[3].data.d_string,
|
||||
image_ID, drawable_ID, &error))
|
||||
if (save_image (g_file_get_path (file),
|
||||
image_ID, drawable_ID,
|
||||
&error))
|
||||
{
|
||||
gimp_set_data ("file_xpm_save", &xpmvals, sizeof (XpmSaveVals));
|
||||
}
|
||||
|
|
|
@ -314,7 +314,7 @@ query (void)
|
|||
save_args, NULL);
|
||||
|
||||
gimp_register_file_handler_mime (SAVE_PROC, "image/x-xwindowdump");
|
||||
gimp_register_file_handler_uri (SAVE_PROC);
|
||||
gimp_register_file_handler_remote (SAVE_PROC);
|
||||
gimp_register_save_handler (SAVE_PROC, "xwd", "");
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,9 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
gint32 image_ID = load_image (param[1].data.d_string,
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
gint32 image_ID = load_image (g_file_get_path (file),
|
||||
&error);
|
||||
|
||||
if (image_ID != -1)
|
||||
|
@ -240,10 +242,14 @@ run (const gchar *name,
|
|||
}
|
||||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
status = save_image (param[3].data.d_string,
|
||||
image_ID, drawable_ID,
|
||||
run_mode,
|
||||
&error);
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
status = save_image (g_file_get_path (file),
|
||||
image_ID, drawable_ID,
|
||||
run_mode,
|
||||
&error);
|
||||
}
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image_ID);
|
||||
|
|
|
@ -250,7 +250,9 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
status = read_dds (param[1].data.d_string, &imageID,
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
status = read_dds (g_file_get_path (file), &imageID,
|
||||
run_mode == GIMP_RUN_INTERACTIVE);
|
||||
if (status == GIMP_PDB_SUCCESS && imageID != -1)
|
||||
{
|
||||
|
@ -374,8 +376,12 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
status = write_dds (param[3].data.d_string, imageID, drawableID,
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
status = write_dds (g_file_get_path (file),
|
||||
imageID, drawableID,
|
||||
run_mode == GIMP_RUN_INTERACTIVE);
|
||||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
gimp_set_data (SAVE_PROC, &dds_write_vals, sizeof (dds_write_vals));
|
||||
}
|
||||
|
|
|
@ -137,7 +137,9 @@ run (const gchar *name,
|
|||
|
||||
if (strcmp (name, LOAD_PROC) == 0)
|
||||
{
|
||||
image_ID = load_image (param[1].data.d_string, &error);
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
image_ID = load_image (g_file_get_path (file), &error);
|
||||
|
||||
if (image_ID != -1)
|
||||
{
|
||||
|
|
|
@ -248,8 +248,11 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
check_load_vals ();
|
||||
image_ID = load_image (param[1].data.d_string, &error);
|
||||
|
||||
image_ID = load_image (g_file_get_path (file), &error);
|
||||
|
||||
/* Write out error messages of FITS-Library */
|
||||
show_fits_errors ();
|
||||
|
@ -317,7 +320,10 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (param[3].data.d_string, image_ID, drawable_ID,
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
if (! save_image (g_file_get_path (file),
|
||||
image_ID, drawable_ID,
|
||||
&error))
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
|
|
@ -226,6 +226,7 @@ run (const gchar *name,
|
|||
gint32 image_ID;
|
||||
gint32 drawable_ID;
|
||||
gint32 orig_image_ID;
|
||||
GFile *file;
|
||||
GimpExportReturn export = GIMP_EXPORT_CANCEL;
|
||||
GError *error = NULL;
|
||||
|
||||
|
@ -242,6 +243,8 @@ run (const gchar *name,
|
|||
|
||||
if (strcmp (name, LOAD_PROC) == 0)
|
||||
{
|
||||
file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
switch (run_mode)
|
||||
{
|
||||
case GIMP_RUN_NONINTERACTIVE:
|
||||
|
@ -277,7 +280,7 @@ run (const gchar *name,
|
|||
from_frame = ((nparams < G_N_ELEMENTS (load_args)) ?
|
||||
-1 : param[4].data.d_int32);
|
||||
|
||||
image_ID = load_image (param[1].data.d_string,
|
||||
image_ID = load_image (g_file_get_path (file),
|
||||
from_frame, to_frame, &error);
|
||||
|
||||
if (image_ID != -1)
|
||||
|
@ -293,9 +296,9 @@ run (const gchar *name,
|
|||
break;
|
||||
|
||||
case GIMP_RUN_INTERACTIVE:
|
||||
if (load_dialog (param[1].data.d_string))
|
||||
if (load_dialog (g_file_get_path (file)))
|
||||
{
|
||||
image_ID = load_image (param[1].data.d_string,
|
||||
image_ID = load_image (g_file_get_path (file),
|
||||
from_frame, to_frame, &error);
|
||||
|
||||
if (image_ID != -1)
|
||||
|
@ -322,6 +325,8 @@ run (const gchar *name,
|
|||
}
|
||||
else if (strcmp (name, SAVE_PROC) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
|
||||
image_ID = orig_image_ID = param[1].data.d_int32;
|
||||
drawable_ID = param[2].data.d_int32;
|
||||
|
||||
|
@ -341,7 +346,7 @@ run (const gchar *name,
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (! save_image (param[3].data.d_string, image_ID,
|
||||
if (! save_image (g_file_get_path (file), image_ID,
|
||||
param[5].data.d_int32,
|
||||
param[6].data.d_int32, &error))
|
||||
{
|
||||
|
@ -367,7 +372,7 @@ run (const gchar *name,
|
|||
|
||||
if (save_dialog (param[1].data.d_image))
|
||||
{
|
||||
if (! save_image (param[3].data.d_string,
|
||||
if (! save_image (g_file_get_path (file),
|
||||
image_ID, from_frame, to_frame, &error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
|
|
@ -196,7 +196,9 @@ run (const gchar *name,
|
|||
|
||||
if (strcmp (name, LOAD_PROC) == 0)
|
||||
{
|
||||
gboolean resolution_loaded = FALSE;
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
gboolean resolution_loaded = FALSE;
|
||||
|
||||
switch (run_mode)
|
||||
{
|
||||
|
@ -210,12 +212,11 @@ run (const gchar *name,
|
|||
break;
|
||||
}
|
||||
|
||||
image_ID = load_image (param[1].data.d_string, run_mode, FALSE,
|
||||
image_ID = load_image (g_file_get_path (file), run_mode, FALSE,
|
||||
&resolution_loaded, &error);
|
||||
|
||||
if (image_ID != -1)
|
||||
{
|
||||
GFile *file = g_file_new_for_path (param[1].data.d_string);
|
||||
GimpMetadata *metadata;
|
||||
|
||||
metadata = gimp_image_metadata_load_prepare (image_ID, "image/jpeg",
|
||||
|
@ -235,8 +236,6 @@ run (const gchar *name,
|
|||
g_object_unref (metadata);
|
||||
}
|
||||
|
||||
g_object_unref (file);
|
||||
|
||||
*nreturn_vals = 2;
|
||||
values[1].type = GIMP_PDB_IMAGE;
|
||||
values[1].data.d_image = image_ID;
|
||||
|
@ -254,7 +253,7 @@ run (const gchar *name,
|
|||
}
|
||||
else
|
||||
{
|
||||
GFile *file = g_file_new_for_path (param[0].data.d_string);
|
||||
GFile *file = g_file_new_for_uri (param[0].data.d_string);
|
||||
gint width = 0;
|
||||
gint height = 0;
|
||||
GimpImageType type = -1;
|
||||
|
@ -286,6 +285,7 @@ run (const gchar *name,
|
|||
}
|
||||
else if (strcmp (name, SAVE_PROC) == 0)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
GimpMetadata *metadata;
|
||||
GimpMetadataSaveFlags metadata_flags;
|
||||
gint32 orig_image_ID;
|
||||
|
@ -499,7 +499,7 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (param[3].data.d_string,
|
||||
if (! save_image (g_file_get_path (file),
|
||||
image_ID, drawable_ID, orig_image_ID, FALSE,
|
||||
&error))
|
||||
{
|
||||
|
@ -546,8 +546,6 @@ run (const gchar *name,
|
|||
|
||||
if (metadata)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
gimp_metadata_set_bits_per_sample (metadata, 8);
|
||||
|
||||
if (jsvals.save_exif)
|
||||
|
@ -575,12 +573,10 @@ run (const gchar *name,
|
|||
else
|
||||
metadata_flags &= ~GIMP_METADATA_SAVE_COLOR_PROFILE;
|
||||
|
||||
file = g_file_new_for_path (param[3].data.d_string);
|
||||
gimp_image_metadata_save_finish (orig_image_ID,
|
||||
"image/jpeg",
|
||||
metadata, metadata_flags,
|
||||
file, NULL);
|
||||
g_object_unref (file);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -168,8 +168,8 @@ tiff_create_procedure (GimpPlugIn *plug_in,
|
|||
"Nick Lamb <njl195@zepler.org.uk>",
|
||||
"1995-1996,1998-2003");
|
||||
|
||||
gimp_file_procedure_set_handles_uri (GIMP_FILE_PROCEDURE (procedure),
|
||||
TRUE);
|
||||
gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure),
|
||||
TRUE);
|
||||
gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
|
||||
"image/tiff");
|
||||
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
|
||||
|
@ -198,8 +198,8 @@ tiff_create_procedure (GimpPlugIn *plug_in,
|
|||
"Spencer Kimball & Peter Mattis",
|
||||
"1995-1996,2000-2003");
|
||||
|
||||
gimp_file_procedure_set_handles_uri (GIMP_FILE_PROCEDURE (procedure),
|
||||
TRUE);
|
||||
gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure),
|
||||
TRUE);
|
||||
gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
|
||||
"image/tiff");
|
||||
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
|
||||
|
|
|
@ -158,7 +158,9 @@ run (const gchar *name,
|
|||
|
||||
if (! strcmp (name, LOAD_PROC))
|
||||
{
|
||||
image_ID = load_image (param[1].data.d_string, FALSE, &error);
|
||||
GFile *file = g_file_new_for_uri (param[1].data.d_string);
|
||||
|
||||
image_ID = load_image (g_file_get_path (file), FALSE, &error);
|
||||
|
||||
if (image_ID != -1)
|
||||
{
|
||||
|
@ -174,6 +176,7 @@ run (const gchar *name,
|
|||
}
|
||||
else if (! strcmp (name, SAVE_PROC))
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (param[3].data.d_string);
|
||||
GimpMetadata *metadata = NULL;
|
||||
GimpMetadataSaveFlags metadata_flags;
|
||||
WebPSaveParams params;
|
||||
|
@ -283,7 +286,7 @@ run (const gchar *name,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (param[3].data.d_string,
|
||||
if (! save_image (g_file_get_path (file),
|
||||
image_ID,
|
||||
drawable_ID,
|
||||
metadata, metadata_flags,
|
||||
|
|
Loading…
Reference in New Issue