app, libgimp: allow to register more than one MIME type per procedure

GIMP will always use the first one from the list, but at least now
there is a way to register variants.
This commit is contained in:
Michael Natterer 2017-05-04 23:22:37 +02:00
parent 560340e8d6
commit 7f33edea1b
15 changed files with 135 additions and 109 deletions

View File

@ -248,7 +248,7 @@ file_open_image (Gimp *gimp,
file_proc = gimp_image_get_load_proc (image);
if (mime_type)
*mime_type = file_proc->mime_type;
*mime_type = g_slist_nth_data (file_proc->mime_types_list, 0);
}
else
{
@ -454,7 +454,7 @@ file_open_thumbnail (Gimp *gimp,
{
file_open_sanitize_image (image, FALSE);
*mime_type = file_proc->mime_type;
*mime_type = g_slist_nth_data (file_proc->mime_types_list, 0);
#ifdef GIMP_UNSTABLE
g_printerr ("opened thumbnail at %d x %d\n",
@ -823,6 +823,6 @@ static gboolean
file_open_file_proc_is_import (GimpPlugInProcedure *file_proc)
{
return !(file_proc &&
file_proc->mime_type &&
strcmp (file_proc->mime_type, "image/x-xcf") == 0);
file_proc->mime_types &&
strcmp (file_proc->mime_types, "image/x-xcf") == 0);
}

View File

@ -263,11 +263,13 @@ file_save (Gimp *gimp,
documents = GIMP_DOCUMENT_LIST (image->gimp->documents);
imagefile = gimp_document_list_add_file (documents, file,
file_proc->mime_type);
g_slist_nth_data (file_proc->mime_types_list, 0));
/* only save a thumbnail if we are saving as XCF, see bug #25272 */
if (GIMP_PROCEDURE (file_proc)->proc_type == GIMP_INTERNAL)
gimp_imagefile_save_thumbnail (imagefile, file_proc->mime_type, image,
gimp_imagefile_save_thumbnail (imagefile,
g_slist_nth_data (file_proc->mime_types_list, 0),
image,
NULL);
}
else if (status != GIMP_PDB_CANCEL)

View File

@ -515,17 +515,17 @@ register_file_handler_mime_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
const gchar *procedure_name;
const gchar *mime_type;
const gchar *mime_types;
procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
mime_type = g_value_get_string (gimp_value_array_index (args, 1));
mime_types = g_value_get_string (gimp_value_array_index (args, 1));
if (success)
{
gchar *canonical = gimp_canonicalize_identifier (procedure_name);
success = gimp_plug_in_manager_register_mime_type (gimp->plug_in_manager,
canonical, mime_type);
success = gimp_plug_in_manager_register_mime_types (gimp->plug_in_manager,
canonical, mime_types);
g_free (canonical);
}
@ -1021,8 +1021,8 @@ register_fileops_procs (GimpPDB *pdb)
"gimp-register-file-handler-mime");
gimp_procedure_set_static_strings (procedure,
"gimp-register-file-handler-mime",
"Associates a MIME type with a file handler procedure.",
"Registers a MIME type for a file handler procedure. This allows GIMP to determine the MIME type of the file opened or saved using this procedure.",
"Associates MIME types with a file handler procedure.",
"Registers MIME types for a file handler procedure. This allows GIMP to determine the MIME type of the file opened or saved using this procedure. It is recommended that only one MIME type is registered per file procedure; when registering more than one MIME type, GIMP will associate the first one with files opened or saved with this procedure.",
"Sven Neumann <sven@gimp.org>",
"Sven Neumann",
"2004",
@ -1035,9 +1035,9 @@ register_fileops_procs (GimpPDB *pdb)
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("mime-type",
"mime type",
"A single MIME type, like for example \"image/jpeg\".",
gimp_param_spec_string ("mime-types",
"mime types",
"A comma-separated list of MIME types, such as \"image/jpeg\".",
FALSE, FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));

View File

@ -235,9 +235,13 @@ file_procedure_find_by_mime_type (GSList *procs,
for (list = procs; list; list = g_slist_next (list))
{
GimpPlugInProcedure *proc = list->data;
GSList *mime;
if (proc->mime_type && ! strcmp (mime_type, proc->mime_type))
return proc;
for (mime = proc->mime_types_list; mime; mime = g_slist_next (mime))
{
if (! strcmp (mime_type, mime->data))
return proc;
}
}
return NULL;

View File

@ -158,16 +158,16 @@ gimp_plug_in_manager_register_save_handler (GimpPlugInManager *manager,
}
gboolean
gimp_plug_in_manager_register_mime_type (GimpPlugInManager *manager,
const gchar *name,
const gchar *mime_type)
gimp_plug_in_manager_register_mime_types (GimpPlugInManager *manager,
const gchar *name,
const gchar *mime_types)
{
GimpPlugInProcedure *file_proc;
GSList *list;
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), FALSE);
g_return_val_if_fail (name != NULL, FALSE);
g_return_val_if_fail (mime_type != NULL, FALSE);
g_return_val_if_fail (mime_types != NULL, FALSE);
if (manager->current_plug_in && manager->current_plug_in->plug_in_def)
list = manager->current_plug_in->plug_in_def->procedures;
@ -179,7 +179,7 @@ gimp_plug_in_manager_register_mime_type (GimpPlugInManager *manager,
if (! file_proc)
return FALSE;
gimp_plug_in_procedure_set_mime_type (file_proc, mime_type);
gimp_plug_in_procedure_set_mime_types (file_proc, mime_types);
return TRUE;
}

View File

@ -31,9 +31,9 @@ gboolean gimp_plug_in_manager_register_save_handler (GimpPlugInManager *manage
const gchar *extensions,
const gchar *prefixes);
gboolean gimp_plug_in_manager_register_mime_type (GimpPlugInManager *manager,
gboolean gimp_plug_in_manager_register_mime_types (GimpPlugInManager *manager,
const gchar *name,
const gchar *mime_type);
const gchar *mime_types);
gboolean gimp_plug_in_manager_register_handles_uri (GimpPlugInManager *manager,
const gchar *name);

View File

@ -163,11 +163,12 @@ gimp_plug_in_procedure_finalize (GObject *object)
g_free (proc->extensions);
g_free (proc->prefixes);
g_free (proc->magics);
g_free (proc->mime_type);
g_free (proc->mime_types);
g_slist_free_full (proc->extensions_list, (GDestroyNotify) g_free);
g_slist_free_full (proc->prefixes_list, (GDestroyNotify) g_free);
g_slist_free_full (proc->magics_list, (GDestroyNotify) g_free);
g_slist_free_full (proc->mime_types_list, (GDestroyNotify) g_free);
g_free (proc->thumb_loader);
@ -204,7 +205,7 @@ gimp_plug_in_procedure_get_memsize (GimpObject *object,
memsize += gimp_string_get_memsize (proc->extensions);
memsize += gimp_string_get_memsize (proc->prefixes);
memsize += gimp_string_get_memsize (proc->magics);
memsize += gimp_string_get_memsize (proc->mime_type);
memsize += gimp_string_get_memsize (proc->mime_types);
memsize += gimp_string_get_memsize (proc->thumb_loader);
for (slist = proc->extensions_list; slist; slist = g_slist_next (slist))
@ -216,6 +217,9 @@ gimp_plug_in_procedure_get_memsize (GimpObject *object,
for (slist = proc->magics_list; slist; slist = g_slist_next (slist))
memsize += sizeof (GSList) + gimp_string_get_memsize (slist->data);
for (slist = proc->mime_types_list; slist; slist = g_slist_next (slist))
memsize += sizeof (GSList) + gimp_string_get_memsize (slist->data);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
gui_size);
}
@ -1092,15 +1096,23 @@ gimp_plug_in_procedure_set_file_proc (GimpPlugInProcedure *proc,
}
void
gimp_plug_in_procedure_set_mime_type (GimpPlugInProcedure *proc,
const gchar *mime_type)
gimp_plug_in_procedure_set_mime_types (GimpPlugInProcedure *proc,
const gchar *mime_types)
{
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc));
if (proc->mime_type)
g_free (proc->mime_type);
if (proc->mime_types != mime_types)
{
if (proc->mime_types)
g_free (proc->mime_types);
proc->mime_type = g_strdup (mime_type);
proc->mime_types = g_strdup (mime_types);
}
if (proc->mime_types_list)
g_slist_free_full (proc->mime_types_list, (GDestroyNotify) g_free);
proc->mime_types_list = extensions_parse (proc->mime_types);
}
void

View File

@ -59,12 +59,13 @@ struct _GimpPlugInProcedure
gchar *extensions;
gchar *prefixes;
gchar *magics;
gchar *mime_type;
gchar *mime_types;
gboolean handles_uri;
gboolean handles_raw;
GSList *extensions_list;
GSList *prefixes_list;
GSList *magics_list;
GSList *mime_types_list;
gchar *thumb_loader;
};
@ -118,8 +119,8 @@ void gimp_plug_in_procedure_set_file_proc (GimpPlugInProcedure *pro
const gchar *extensions,
const gchar *prefixes,
const gchar *magics);
void gimp_plug_in_procedure_set_mime_type (GimpPlugInProcedure *proc,
const gchar *mime_ype);
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_raw (GimpPlugInProcedure *proc);
void gimp_plug_in_procedure_set_thumb_loader (GimpPlugInProcedure *proc,

View File

@ -40,7 +40,7 @@
#include "gimp-intl.h"
#define PLUG_IN_RC_FILE_VERSION 4
#define PLUG_IN_RC_FILE_VERSION 5
/*
@ -87,10 +87,10 @@ enum
ICON,
LOAD_PROC,
SAVE_PROC,
EXTENSION,
PREFIX,
MAGIC,
MIME_TYPE,
EXTENSIONS,
PREFIXES,
MAGICS,
MIME_TYPES,
HANDLES_URI,
HANDLES_RAW,
THUMB_LOADER
@ -149,13 +149,13 @@ plug_in_rc_parse (Gimp *gimp,
"save-proc", GINT_TO_POINTER (SAVE_PROC));
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
"extension", GINT_TO_POINTER (EXTENSION));
"extensions", GINT_TO_POINTER (EXTENSIONS));
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
"prefix", GINT_TO_POINTER (PREFIX));
"prefixes", GINT_TO_POINTER (PREFIXES));
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
"magic", GINT_TO_POINTER (MAGIC));
"magics", GINT_TO_POINTER (MAGICS));
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
"mime-type", GINT_TO_POINTER (MIME_TYPE));
"mime-types", GINT_TO_POINTER (MIME_TYPES));
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
"handles-uri", GINT_TO_POINTER (HANDLES_URI));
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
@ -164,11 +164,11 @@ plug_in_rc_parse (Gimp *gimp,
"thumb-loader", GINT_TO_POINTER (THUMB_LOADER));
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
"extension", GINT_TO_POINTER (EXTENSION));
"extensions", GINT_TO_POINTER (EXTENSIONS));
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
"prefix", GINT_TO_POINTER (PREFIX));
"prefixes", GINT_TO_POINTER (PREFIXES));
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
"mime-type", GINT_TO_POINTER (MIME_TYPE));
"mime-types", GINT_TO_POINTER (MIME_TYPES));
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
"handles-uri", GINT_TO_POINTER (HANDLES_URI));
@ -601,7 +601,7 @@ plug_in_file_proc_deserialize (GScanner *scanner,
symbol = GPOINTER_TO_INT (scanner->value.v_symbol);
if (symbol == MAGIC)
if (symbol == MAGICS)
{
if (! gimp_scanner_parse_string_no_validate (scanner, &value))
return G_TOKEN_STRING;
@ -615,23 +615,23 @@ plug_in_file_proc_deserialize (GScanner *scanner,
switch (symbol)
{
case EXTENSION:
case EXTENSIONS:
g_free (proc->extensions);
proc->extensions = value;
break;
case PREFIX:
case PREFIXES:
g_free (proc->prefixes);
proc->prefixes = value;
break;
case MAGIC:
case MAGICS:
g_free (proc->magics);
proc->magics = value;
break;
case MIME_TYPE:
gimp_plug_in_procedure_set_mime_type (proc, value);
case MIME_TYPES:
gimp_plug_in_procedure_set_mime_types (proc, value);
g_free (value);
break;
@ -908,29 +908,29 @@ plug_in_rc_write (GSList *plug_in_defs,
if (proc->extensions && *proc->extensions)
{
gimp_config_writer_open (writer, "extension");
gimp_config_writer_open (writer, "extensions");
gimp_config_writer_string (writer, proc->extensions);
gimp_config_writer_close (writer);
}
if (proc->prefixes && *proc->prefixes)
{
gimp_config_writer_open (writer, "prefix");
gimp_config_writer_open (writer, "prefixes");
gimp_config_writer_string (writer, proc->prefixes);
gimp_config_writer_close (writer);
}
if (proc->magics && *proc->magics)
{
gimp_config_writer_open (writer, "magic");
gimp_config_writer_open (writer, "magics");
gimp_config_writer_string (writer, proc->magics);
gimp_config_writer_close (writer);
}
if (proc->mime_type)
if (proc->mime_types && *proc->mime_types)
{
gimp_config_writer_open (writer, "mime-type");
gimp_config_writer_string (writer, proc->mime_type);
gimp_config_writer_open (writer, "mime-types");
gimp_config_writer_string (writer, proc->mime_types);
gimp_config_writer_close (writer);
}

View File

@ -820,12 +820,12 @@ gimp_file_dialog_process_procedure (GimpPlugInProcedure *file_proc,
GtkFileFilter *all,
GtkFileFilter *all_savable)
{
GtkFileFilter *filter = NULL;
GString *str = NULL;
GSList *ext = NULL;
gint i = 0;
GtkFileFilter *filter;
GString *str;
GSList *list;
gint i;
if (!file_proc->extensions_list)
if (! file_proc->extensions_list)
return;
filter = gtk_file_filter_new ();
@ -836,19 +836,21 @@ gimp_file_dialog_process_procedure (GimpPlugInProcedure *file_proc,
*/
g_object_ref_sink (filter);
if (file_proc->mime_type)
for (list = file_proc->mime_types_list; list; list = g_slist_next (list))
{
gtk_file_filter_add_mime_type (filter, file_proc->mime_type);
gtk_file_filter_add_mime_type (all, file_proc->mime_type);
const gchar *mime_type = list->data;
gtk_file_filter_add_mime_type (filter, mime_type);
gtk_file_filter_add_mime_type (all, mime_type);
if (all_savable)
gtk_file_filter_add_mime_type (all_savable, file_proc->mime_type);
gtk_file_filter_add_mime_type (all_savable, mime_type);
}
for (ext = file_proc->extensions_list, i = 0;
ext;
ext = g_slist_next (ext), i++)
for (list = file_proc->extensions_list, i = 0;
list;
list = g_slist_next (list), i++)
{
const gchar *extension = ext->data;
const gchar *extension = list->data;
gchar *pattern;
pattern = gimp_file_dialog_pattern_from_extension (extension);
@ -877,7 +879,7 @@ gimp_file_dialog_process_procedure (GimpPlugInProcedure *file_proc,
g_string_append (str, "...");
}
if (! ext->next)
if (! list->next)
{
g_string_append (str, ")");
}

View File

@ -115,7 +115,7 @@ xcf_init (Gimp *gimp)
strlen ("gimp-wilber") + 1);
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_type (proc, "image/x-xcf");
gimp_plug_in_procedure_set_mime_types (proc, "image/x-xcf");
gimp_plug_in_procedure_set_handles_uri (proc);
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-xcf-save");
@ -187,7 +187,7 @@ xcf_init (Gimp *gimp)
gimp_plug_in_procedure_set_image_types (proc, NULL);
gimp_plug_in_procedure_set_file_proc (proc, "xcf", "",
"0,string,gimp\\040xcf\\040");
gimp_plug_in_procedure_set_mime_type (proc, "image/x-xcf");
gimp_plug_in_procedure_set_mime_types (proc, "image/x-xcf");
gimp_plug_in_procedure_set_handles_uri (proc);
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-xcf-load");

View File

@ -367,12 +367,15 @@ gimp_register_save_handler (const gchar *procedure_name,
/**
* gimp_register_file_handler_mime:
* @procedure_name: The name of the procedure to associate a MIME type with.
* @mime_type: A single MIME type, like for example \"image/jpeg\".
* @mime_types: A comma-separated list of MIME types, such as \"image/jpeg\".
*
* Associates a MIME type with a file handler procedure.
* Associates MIME types with a file handler procedure.
*
* Registers a MIME type for a file handler procedure. This allows GIMP
* Registers MIME types for a file handler procedure. This allows GIMP
* to determine the MIME type of the file opened or saved using this
* procedure. It is recommended that only one MIME type is registered
* per file procedure; when registering more than one MIME type, GIMP
* will associate the first one with files opened or saved with this
* procedure.
*
* Returns: TRUE on success.
@ -381,7 +384,7 @@ gimp_register_save_handler (const gchar *procedure_name,
**/
gboolean
gimp_register_file_handler_mime (const gchar *procedure_name,
const gchar *mime_type)
const gchar *mime_types)
{
GimpParam *return_vals;
gint nreturn_vals;
@ -390,7 +393,7 @@ gimp_register_file_handler_mime (const gchar *procedure_name,
return_vals = gimp_run_procedure ("gimp-register-file-handler-mime",
&nreturn_vals,
GIMP_PDB_STRING, procedure_name,
GIMP_PDB_STRING, mime_type,
GIMP_PDB_STRING, mime_types,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

View File

@ -60,7 +60,7 @@ gboolean gimp_register_save_handler (const gchar *procedure_name,
const gchar *extensions,
const gchar *prefixes);
gboolean gimp_register_file_handler_mime (const gchar *procedure_name,
const gchar *mime_type);
const gchar *mime_types);
gboolean gimp_register_file_handler_uri (const gchar *procedure_name);
gboolean gimp_register_file_handler_raw (const gchar *procedure_name);
gboolean gimp_register_thumbnail_loader (const gchar *load_proc,

View File

@ -44,13 +44,13 @@ static const FileFormat file_formats[] =
{
{
N_("Raw Canon"),
"image/x-canon-cr2,image/x-canon-crw,image/tiff", // FIXME: only one mime type
"image/x-canon-cr2,image/x-canon-crw,image/tiff",
"cr2,crw,tif,tiff",
"0,string,II*\\0\\020\\0\\0\\0CR," // cr2
"0,string,II\\024\\0\\0\\0HEAPCCDR," // crw
"0,string,MM\\0*\\0\\0\\0\\020\\0272\\0260," // tiff
"0,string,MM\\0*\\0\\0\\021\\064\\0\\04," // tiff
"0,string,II*\\0\\0\\03\\0\\0\\0377\\01", // tiff
"0,string,II*\\0\\020\\0\\0\\0CR," /* cr2 */
"0,string,II\\024\\0\\0\\0HEAPCCDR," /* crw */
"0,string,MM\\0*\\0\\0\\0\\020\\0272\\0260," /* tiff */
"0,string,MM\\0*\\0\\0\\021\\064\\0\\04," /* tiff */
"0,string,II*\\0\\0\\03\\0\\0\\0377\\01", /* tiff */
"file-darktable-canon-load",
"Load files in the Canon raw formats via darktable",
@ -59,7 +59,7 @@ static const FileFormat file_formats[] =
{
N_("Raw Nikon"),
"image/x-nikon-nef,image/x-nikon-nrw", // FIXME: only one mime type
"image/x-nikon-nef,image/x-nikon-nrw",
"nef,nrw",
NULL,
@ -70,7 +70,7 @@ static const FileFormat file_formats[] =
{
N_("Raw Hasselblad"),
"image/x-hasselblad-3fr,image/x-hasselblad-fff", // FIXME: only one mime type
"image/x-hasselblad-3fr,image/x-hasselblad-fff",
"3fr,fff",
NULL,
@ -81,7 +81,7 @@ static const FileFormat file_formats[] =
{
N_("Raw Sony"),
"image/x-sony-arw,image/x-sony-srf,image/x-sony-sr2", // FIXME: only one mime type
"image/x-sony-arw,image/x-sony-srf,image/x-sony-sr2",
"arw,srf,sr2",
NULL,
@ -103,7 +103,7 @@ static const FileFormat file_formats[] =
{
N_("Raw Phantom Software CINE"),
"", // FIXME: find a mime type
"", /* FIXME: find a mime type */
"cine,cin",
NULL,
@ -114,7 +114,7 @@ static const FileFormat file_formats[] =
{
N_("Raw Sinar"),
"", // FIXME: find a mime type
"", /* FIXME: find a mime type */
"cs1,ia,sti",
NULL,
@ -125,10 +125,10 @@ static const FileFormat file_formats[] =
{
N_("Raw Kodak"),
"image/x-kodak-dc2,image/x-kodak-dcr,image/x-kodak-kdc,image/x-kodak-k25,image/x-kodak-kc2,image/tiff", // FIXME: only one mime type
"image/x-kodak-dc2,image/x-kodak-dcr,image/x-kodak-kdc,image/x-kodak-k25,image/x-kodak-kc2,image/tiff",
"dc2,dcr,kdc,k25,kc2,tif,tiff",
"0,string,MM\\0*\\0\\0\\021\\0166\\0\\04," // tiff
"0,string,II*\\0\\0\\03\\0\\0\\0174\\01", // tiff
"0,string,MM\\0*\\0\\0\\021\\0166\\0\\04," /* tiff */
"0,string,II*\\0\\0\\03\\0\\0\\0174\\01", /* tiff */
"file-darktable-kodak-load",
"Load files in the Kodak raw formats via darktable",
@ -159,7 +159,7 @@ static const FileFormat file_formats[] =
{
N_("Raw Phase One"),
"image/x-phaseone-cap,image/x-phaseone-iiq", // FIXME: only one mime type
"image/x-phaseone-cap,image/x-phaseone-iiq",
"cap,iiq",
NULL,
@ -170,7 +170,7 @@ static const FileFormat file_formats[] =
{
N_("Raw Minolta"),
"image/x-minolta-mdc,image/x-minolta-mrw", // FIXME: only one mime type
"image/x-minolta-mdc,image/x-minolta-mrw",
"mdc,mrw",
NULL,
@ -213,7 +213,7 @@ static const FileFormat file_formats[] =
{
N_("Raw Pentax PEF"),
"image/x-pentax-pef,image/x-pentax-raw", // FIXME: only one mime type
"image/x-pentax-pef,image/x-pentax-raw",
"pef,raw",
NULL,
@ -224,7 +224,7 @@ static const FileFormat file_formats[] =
{
N_("Raw Logitech PXN"),
"image/x-pxn", // FIXME: is that the correct mime type?
"image/x-pxn", /* FIXME: is that the correct mime type? */
"pxn",
NULL,
@ -235,7 +235,7 @@ static const FileFormat file_formats[] =
{
N_("Raw Apple QuickTake QTK"),
"", // FIXME: find a mime type
"", /* FIXME: find a mime type */
"qtk",
NULL,
@ -257,7 +257,7 @@ static const FileFormat file_formats[] =
{
N_("Raw Panasonic"),
"image/x-panasonic-raw,image/x-panasonic-rw2", // FIXME: only one mime type
"image/x-panasonic-raw,image/x-panasonic-rw2",
"raw,rw2",
"0,string,IIU\\0",
@ -268,7 +268,7 @@ static const FileFormat file_formats[] =
{
N_("Raw Digital Foto Maker RDC"),
"", // FIXME: find a mime type
"", /* FIXME: find a mime type */
"rdc",
NULL,

View File

@ -586,12 +586,14 @@ CODE
}
sub register_file_handler_mime {
$blurb = 'Associates a MIME type with a file handler procedure.';
$blurb = 'Associates MIME types with a file handler procedure.';
$help = <<'HELP';
Registers a MIME type for a file handler procedure. This allows GIMP
to determine the MIME type of the file opened or saved using this
procedure.
Registers MIME types for a file handler procedure. This allows GIMP to
determine the MIME type of the file opened or saved using this
procedure. It is recommended that only one MIME type is registered per
file procedure; when registering more than one MIME type, GIMP will
associate the first one with files opened or saved with this procedure.
HELP
&neo_pdb_misc('2004', '2.2');
@ -599,8 +601,8 @@ HELP
@inargs = (
{ name => 'procedure_name', type => 'string', non_empty => 1,
desc => "The name of the procedure to associate a MIME type with." },
{ name => 'mime_type', type => 'string',
desc => "A single MIME type, like for example \"image/jpeg\"." }
{ name => 'mime_types', type => 'string',
desc => "A comma-separated list of MIME types, such as \"image/jpeg\"." }
);
%invoke = (
@ -608,8 +610,8 @@ HELP
{
gchar *canonical = gimp_canonicalize_identifier (procedure_name);
success = gimp_plug_in_manager_register_mime_type (gimp->plug_in_manager,
canonical, mime_type);
success = gimp_plug_in_manager_register_mime_types (gimp->plug_in_manager,
canonical, mime_types);
g_free (canonical);
}