added new PDB function gimp_register_file_handler_mime() that allows to

2004-05-14  Sven Neumann  <sven@gimp.org>

	* tools/pdbgen/pdb/fileops.pdb: added new PDB function
	gimp_register_file_handler_mime() that allows to associate a MIME
	type with a file procecdurre.

	* app/pdb/fileops_cmds.c
	* app/pdb/internal_procs.c
	* libgimp/gimpfileops_pdb.[ch]: regenerated.

	* app/plug-in/plug-in-proc.[ch]
	* app/plug-in/plug-in-rc.c
	* app/plug-in/plug-ins.[ch]: store a mimetype with file procedures.

	* app/actions/file-commands.c
	* app/core/gimpdocumentlist.[ch]
	* app/core/gimpimagefile.[ch]
	* app/file/file-open.[ch]
	* app/file/file-save.c: set the thumbnail's mimetype from the file
	procedure used to load/save the image.

	* app/xcf/xcf.c
	* plug-ins/bmp/bmp.c
	* plug-ins/common/csource.c
	* plug-ins/common/dicom.c
	* plug-ins/common/gif.c
	* plug-ins/common/gifload.c
	* plug-ins/common/jpeg.c
	* plug-ins/common/mng.c
	* plug-ins/common/png.c
	* plug-ins/common/postscript.c
	* plug-ins/common/psd.c
	* plug-ins/common/psd_save.c
	* plug-ins/common/sunras.c
	* plug-ins/common/svg.c
	* plug-ins/common/tga.c
	* plug-ins/common/tiff.c
	* plug-ins/common/wmf.c
	* plug-ins/common/xbm.c
	* plug-ins/common/xpm.c
	* plug-ins/common/xwd.c
	* plug-ins/faxg3/faxg3.c
	* plug-ins/winicon/main.c: register a mimetype, set a translatable
	action name (taken from shared-mime-info) and register to the <Load>
	and <Save> menus using gimp_plugin_menu_register().
This commit is contained in:
Sven Neumann 2004-05-14 00:01:11 +00:00 committed by Sven Neumann
parent 373db07d13
commit 97fe81b401
56 changed files with 864 additions and 433 deletions

View File

@ -1,3 +1,49 @@
2004-05-14 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/fileops.pdb: added new PDB function
gimp_register_file_handler_mime() that allows to associate a MIME
type with a file procecdurre.
* app/pdb/fileops_cmds.c
* app/pdb/internal_procs.c
* libgimp/gimpfileops_pdb.[ch]: regenerated.
* app/plug-in/plug-in-proc.[ch]
* app/plug-in/plug-in-rc.c
* app/plug-in/plug-ins.[ch]: store a mimetype with file procedures.
* app/actions/file-commands.c
* app/core/gimpdocumentlist.[ch]
* app/core/gimpimagefile.[ch]
* app/file/file-open.[ch]
* app/file/file-save.c: set the thumbnail's mimetype from the file
procedure used to load/save the image.
* app/xcf/xcf.c
* plug-ins/bmp/bmp.c
* plug-ins/common/csource.c
* plug-ins/common/dicom.c
* plug-ins/common/gif.c
* plug-ins/common/gifload.c
* plug-ins/common/jpeg.c
* plug-ins/common/mng.c
* plug-ins/common/png.c
* plug-ins/common/postscript.c
* plug-ins/common/psd.c
* plug-ins/common/psd_save.c
* plug-ins/common/sunras.c
* plug-ins/common/svg.c
* plug-ins/common/tga.c
* plug-ins/common/tiff.c
* plug-ins/common/wmf.c
* plug-ins/common/xbm.c
* plug-ins/common/xpm.c
* plug-ins/common/xwd.c
* plug-ins/faxg3/faxg3.c
* plug-ins/winicon/main.c: register a mimetype, set a translatable
action name (taken from shared-mime-info) and register to the <Load>
and <Save> menus using gimp_plugin_menu_register().
2004-05-13 Sven Neumann <sven@gimp.org>
* tools/pdbgen/lib.pl

View File

@ -376,7 +376,7 @@ file_revert_confirm_callback (GtkWidget *widget,
new_gimage = file_open_image (gimp, gimp_get_user_context (gimp),
uri, uri, NULL,
GIMP_RUN_INTERACTIVE,
&status, &error);
&status, NULL, &error);
if (new_gimage)
{

View File

@ -194,7 +194,8 @@ gimp_document_list_new (Gimp *gimp)
GimpImagefile *
gimp_document_list_add_uri (GimpDocumentList *document_list,
const gchar *uri)
const gchar *uri,
const gchar *mime_type)
{
GimpImagefile *imagefile;
GimpContainer *container;
@ -218,5 +219,9 @@ gimp_document_list_add_uri (GimpDocumentList *document_list,
g_object_unref (imagefile);
}
g_object_set (imagefile->thumbnail,
"image-mimetype", mime_type,
NULL);
return imagefile;
}

View File

@ -44,11 +44,12 @@ struct _GimpDocumentListClass
};
GType gimp_document_list_get_type (void) G_GNUC_CONST;
GType gimp_document_list_get_type (void) G_GNUC_CONST;
GimpContainer * gimp_document_list_new (Gimp *gimp);
GimpImagefile * gimp_document_list_add_uri (GimpDocumentList *document_list,
const gchar *uri);
const gchar *uri,
const gchar *mime_type);
#endif /* __GIMP_DOCUMENT_LIST_H__ */

View File

@ -256,7 +256,8 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
GimpImage *gimage;
GimpPDBStatusType dummy;
gboolean success;
GError *error = NULL;
const gchar *mime_type = NULL;
GError *error = NULL;
gimage = file_open_image (imagefile->gimp,
context,
@ -265,10 +266,16 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
NULL,
GIMP_RUN_NONINTERACTIVE,
&dummy,
&mime_type,
NULL);
if (gimage)
{
if (mime_type)
g_object_set (thumbnail,
"image-mimetype", mime_type,
NULL);
success = gimp_imagefile_save_thumb (imagefile,
gimage, size, &error);

View File

@ -46,13 +46,14 @@ struct _GimpImagefile
Gimp *gimp;
GimpThumbnail *thumbnail;
gchar *mime_type;
gchar *description;
gboolean static_desc;
};
struct _GimpImagefileClass
{
GimpViewableClass parent_class;
GimpViewableClass parent_class;
void (* info_changed) (GimpImagefile *imagefile);
};

View File

@ -68,6 +68,7 @@ file_open_image (Gimp *gimp,
PlugInProcDef *file_proc,
GimpRunMode run_mode,
GimpPDBStatusType *status,
const gchar **mime_type,
GError **error)
{
const ProcRecord *proc;
@ -80,6 +81,7 @@ file_open_image (Gimp *gimp,
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (status != NULL, NULL);
g_return_val_if_fail (mime_type == NULL || *mime_type == NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
*status = GIMP_PDB_EXECUTION_ERROR;
@ -161,6 +163,9 @@ file_open_image (Gimp *gimp,
gimp_image_invalidate_channel_previews (gimage);
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gimage));
if (mime_type)
*mime_type = file_proc->mime_type;
return gimage;
}
else
@ -200,7 +205,8 @@ file_open_with_proc_and_display (Gimp *gimp,
GimpPDBStatusType *status,
GError **error)
{
GimpImage *gimage;
GimpImage *gimage;
const gchar *mime_type = NULL;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
@ -212,6 +218,7 @@ file_open_with_proc_and_display (Gimp *gimp,
file_proc,
GIMP_RUN_INTERACTIVE,
status,
&mime_type,
error);
if (gimage)
@ -222,7 +229,7 @@ file_open_with_proc_and_display (Gimp *gimp,
gimp_create_display (gimage->gimp, gimage, 1.0);
documents = GIMP_DOCUMENT_LIST (gimp->documents);
imagefile = gimp_document_list_add_uri (documents, uri);
imagefile = gimp_document_list_add_uri (documents, uri, mime_type);
/* can only create a thumbnail if the passed uri and the
* resulting image's uri match.

View File

@ -27,6 +27,7 @@ GimpImage * file_open_image (Gimp *gimp,
PlugInProcDef *file_proc,
GimpRunMode run_mode,
GimpPDBStatusType *status,
const gchar **mime_type,
GError **error);
GimpImage * file_open_with_display (Gimp *gimp,

View File

@ -184,7 +184,8 @@ file_save_as (GimpImage *gimage,
}
documents = GIMP_DOCUMENT_LIST (gimage->gimp->documents);
imagefile = gimp_document_list_add_uri (documents, uri);
imagefile = gimp_document_list_add_uri (documents,
uri, file_proc->mime_type);
if (set_uri_and_proc)
{

View File

@ -35,16 +35,19 @@ void
file_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
gint n_entries;
guint merge_id;
gint i;
GtkUIManager *ui_manager;
gint n_entries;
guint merge_id;
gint i;
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
g_return_if_fail (ui_path != NULL);
ui_manager = GTK_UI_MANAGER (manager);
n_entries = GIMP_GUI_CONFIG (manager->gimp->config)->last_opened_size;
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
merge_id = gtk_ui_manager_new_merge_id (ui_manager);
for (i = 0; i < n_entries; i++)
{
@ -54,7 +57,7 @@ file_menu_setup (GimpUIManager *manager,
action_name = g_strdup_printf ("file-open-recent-%02d", i + 1);
action_path = g_strdup_printf ("%s/File/Open Recent/Files", ui_path);
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
gtk_ui_manager_add_ui (ui_manager, merge_id,
action_path, action_name, action_name,
GTK_UI_MANAGER_MENUITEM,
FALSE);

View File

@ -64,6 +64,7 @@ static ProcRecord temp_name_proc;
static ProcRecord register_magic_load_handler_proc;
static ProcRecord register_load_handler_proc;
static ProcRecord register_save_handler_proc;
static ProcRecord register_file_handler_mime_proc;
void
register_fileops_procs (Gimp *gimp)
@ -76,6 +77,7 @@ register_fileops_procs (Gimp *gimp)
procedural_db_register (gimp, &register_magic_load_handler_proc);
procedural_db_register (gimp, &register_load_handler_proc);
procedural_db_register (gimp, &register_save_handler_proc);
procedural_db_register (gimp, &register_file_handler_mime_proc);
}
static Argument *
@ -582,7 +584,8 @@ register_magic_load_handler_invoker (Gimp *gimp,
goto done;
}
file_proc = plug_ins_file_handler (gimp, name, extensions, prefixes, magics);
file_proc = plug_ins_file_register_magic (gimp, name,
extensions, prefixes, magics);
if (! file_proc)
{
@ -732,7 +735,8 @@ register_save_handler_invoker (Gimp *gimp,
goto done;
}
file_proc = plug_ins_file_handler (gimp, name, extensions, prefixes, NULL);
file_proc = plug_ins_file_register_magic (gimp, name,
extensions, prefixes, NULL);
if (! file_proc)
{
@ -786,3 +790,58 @@ static ProcRecord register_save_handler_proc =
NULL,
{ { register_save_handler_invoker } }
};
static Argument *
register_file_handler_mime_invoker (Gimp *gimp,
GimpContext *context,
Argument *args)
{
gboolean success = TRUE;
gchar *name;
gchar *mime_type;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
mime_type = (gchar *) args[1].value.pdb_pointer;
if (mime_type == NULL || !g_utf8_validate (mime_type, -1, NULL))
success = FALSE;
if (success)
{
success = (plug_ins_file_register_mime (gimp, name, mime_type) != NULL);
}
return procedural_db_return_args (&register_file_handler_mime_proc, success);
}
static ProcArg register_file_handler_mime_inargs[] =
{
{
GIMP_PDB_STRING,
"procedure_name",
"The name of the procedure to associate a MIME type with."
},
{
GIMP_PDB_STRING,
"mime_type",
"A single MIME type, like for example \"image/jpeg\"."
}
};
static ProcRecord register_file_handler_mime_proc =
{
"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.",
"Sven Neumann",
"Sven Neumann",
"2004",
GIMP_INTERNAL,
2,
register_file_handler_mime_inargs,
0,
NULL,
{ { register_file_handler_mime_invoker } }
};

View File

@ -36,11 +36,7 @@
PlugInProcDef *
plug_in_proc_def_new (void)
{
PlugInProcDef *proc_def;
proc_def = g_new0 (PlugInProcDef, 1);
return proc_def;
return g_new0 (PlugInProcDef, 1);
}
void
@ -81,6 +77,7 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
g_free (proc_def->extensions);
g_free (proc_def->prefixes);
g_free (proc_def->magics);
g_free (proc_def->mime_type);
g_free (proc_def->image_types);
g_free (proc_def);

View File

@ -32,6 +32,7 @@ struct _PlugInProcDef
gchar *extensions;
gchar *prefixes;
gchar *magics;
gchar *mime_type;
gchar *image_types;
PlugInImageType image_types_val;
ProcRecord db_info;

View File

@ -68,7 +68,7 @@ void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 348 procedures registered total */
/* 349 procedures registered total */
void
internal_procs_init (Gimp *gimp,
@ -95,76 +95,76 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Display procedures"), 0.112);
register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.124);
(* status_callback) (NULL, _("Drawable procedures"), 0.123);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.216);
(* status_callback) (NULL, _("Edit procedures"), 0.215);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.239);
(* status_callback) (NULL, _("File Operations"), 0.238);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.261);
(* status_callback) (NULL, _("Floating selections"), 0.264);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.279);
(* status_callback) (NULL, _("Font UI"), 0.281);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.287);
(* status_callback) (NULL, _("Fonts"), 0.289);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.293);
(* status_callback) (NULL, _("Gimprc procedures"), 0.295);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.31);
(* status_callback) (NULL, _("Gradient UI"), 0.312);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.319);
(* status_callback) (NULL, _("Gradients"), 0.321);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.339);
(* status_callback) (NULL, _("Guide procedures"), 0.341);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.356);
(* status_callback) (NULL, _("Help procedures"), 0.358);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.359);
(* status_callback) (NULL, _("Image"), 0.361);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.534);
(* status_callback) (NULL, _("Layer"), 0.536);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.609);
(* status_callback) (NULL, _("Message procedures"), 0.61);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.618);
(* status_callback) (NULL, _("Miscellaneous"), 0.619);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.624);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.625);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.667);
(* status_callback) (NULL, _("Palette"), 0.668);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.684);
(* status_callback) (NULL, _("Palette UI"), 0.685);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.693);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.707);
(* status_callback) (NULL, _("Parasite procedures"), 0.708);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.741);
(* status_callback) (NULL, _("Paths"), 0.742);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.784);
(* status_callback) (NULL, _("Pattern UI"), 0.785);
register_pattern_select_procs (gimp);
(* status_callback) (NULL, _("Patterns"), 0.793);
(* status_callback) (NULL, _("Patterns"), 0.794);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.807);
(* status_callback) (NULL, _("Plug-in"), 0.808);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.825);
@ -173,7 +173,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Image mask"), 0.851);
register_selection_procs (gimp);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.902);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.903);
register_selection_tools_procs (gimp);
(* status_callback) (NULL, _("Text procedures"), 0.917);
@ -182,7 +182,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Transform Tool procedures"), 0.928);
register_transform_tools_procs (gimp);
(* status_callback) (NULL, _("Undo"), 0.945);
(* status_callback) (NULL, _("Undo"), 0.946);
register_undo_procs (gimp);
(* status_callback) (NULL, _("Units"), 0.966);

View File

@ -49,7 +49,7 @@
#include "gimp-intl.h"
#define STD_PLUGINS_DOMAIN GETTEXT_PACKAGE "-std-plug-ins"
#define STD_PLUGINS_DOMAIN GETTEXT_PACKAGE "-std-plug-ins"
typedef struct _PlugInLocaleDomainDef PlugInLocaleDomainDef;
@ -88,7 +88,7 @@ plug_ins_init (Gimp *gimp,
gchar *filename;
gchar *basename;
gchar *path;
GSList *tmp;
GSList *list;
GList *extensions = NULL;
gdouble n_plugins;
gdouble n_extensions;
@ -149,11 +149,9 @@ plug_ins_init (Gimp *gimp,
(* status_callback) (_("Querying new Plug-ins"), "", 0);
n_plugins = g_slist_length (gimp->plug_in_defs);
for (tmp = gimp->plug_in_defs, nth = 0;
tmp;
tmp = g_slist_next (tmp), nth++)
for (list = gimp->plug_in_defs, nth = 0; list; list = list->next, nth++)
{
PlugInDef *plug_in_def = tmp->data;
PlugInDef *plug_in_def = list->data;
basename = g_path_get_basename (plug_in_def->prog);
(* status_callback) (NULL, gimp_filename_to_utf8 (basename),
@ -177,11 +175,9 @@ plug_ins_init (Gimp *gimp,
/* initialize the plug-ins */
(* status_callback) (_("Initializing Plug-ins"), "", 0);
for (tmp = gimp->plug_in_defs, nth = 0;
tmp;
tmp = g_slist_next (tmp), nth++)
for (list = gimp->plug_in_defs, nth = 0; list; list = list->next, nth++)
{
PlugInDef *plug_in_def = tmp->data;
PlugInDef *plug_in_def = list->data;
basename = g_path_get_basename (plug_in_def->prog);
(* status_callback) (NULL, gimp_filename_to_utf8 (basename),
@ -201,14 +197,14 @@ plug_ins_init (Gimp *gimp,
(* status_callback) (NULL, NULL, 1.0);
/* insert the proc defs */
for (tmp = gimp->plug_in_defs; tmp; tmp = g_slist_next (tmp))
for (list = gimp->plug_in_defs; list; list = list->next)
{
PlugInDef *plug_in_def = tmp->data;
GSList *tmp2;
PlugInDef *plug_in_def = list->data;
GSList *list2;
for (tmp2 = plug_in_def->proc_defs; tmp2; tmp2 = g_slist_next (tmp2))
for (list2 = plug_in_def->proc_defs; list2; list2 = list2->next)
{
PlugInProcDef *proc_def = tmp2->data;
PlugInProcDef *proc_def = list2->data;
PlugInProcDef *overridden_proc_def;
proc_def->mtime = plug_in_def->mtime;
@ -217,7 +213,7 @@ plug_ins_init (Gimp *gimp,
if (overridden_proc_def)
{
GSList *tmp3;
GSList *list3;
g_printerr ("removing duplicate PDB procedure \"%s\" "
"registered by '%s'\n",
@ -227,9 +223,9 @@ plug_ins_init (Gimp *gimp,
/* search the plugin list to see if any plugins had references to
* the overridden_proc_def.
*/
for (tmp3 = gimp->plug_in_defs; tmp3; tmp3 = g_slist_next (tmp3))
for (list3 = gimp->plug_in_defs; list3; list3 = list3->next)
{
PlugInDef *plug_in_def2 = tmp3->data;
PlugInDef *plug_in_def2 = list3->data;
plug_in_def2->proc_defs =
g_slist_remove (plug_in_def2->proc_defs,
@ -277,9 +273,9 @@ plug_ins_init (Gimp *gimp,
gimp);
/* create help_path and locale_domain lists */
for (tmp = gimp->plug_in_defs; tmp; tmp = g_slist_next (tmp))
for (list = gimp->plug_in_defs; list; list = list->next)
{
PlugInDef *plug_in_def = tmp->data;
PlugInDef *plug_in_def = list->data;
if (plug_in_def->locale_domain_name)
{
@ -327,11 +323,9 @@ plug_ins_init (Gimp *gimp,
gimp_menus_init (gimp, gimp->plug_in_defs, STD_PLUGINS_DOMAIN);
/* build list of automatically started extensions */
for (tmp = gimp->plug_in_proc_defs, nth = 0;
tmp;
tmp = g_slist_next (tmp), nth++)
for (list = gimp->plug_in_proc_defs, nth = 0; list; list = list->next, nth++)
{
PlugInProcDef *proc_def = tmp->data;
PlugInProcDef *proc_def = list->data;
if (proc_def->prog &&
proc_def->db_info.proc_type == GIMP_EXTENSION &&
@ -351,9 +345,7 @@ plug_ins_init (Gimp *gimp,
(* status_callback) (_("Starting Extensions"), "", 0);
for (list = extensions, nth = 0;
list;
list = g_list_next (list), nth++)
for (list = extensions, nth = 0; list; list = g_list_next (list), nth++)
{
PlugInProcDef *proc_def = list->data;
@ -372,8 +364,8 @@ plug_ins_init (Gimp *gimp,
}
/* free up stuff */
for (tmp = gimp->plug_in_defs; tmp; tmp = g_slist_next (tmp))
plug_in_def_free (tmp->data, FALSE);
for (list = gimp->plug_in_defs; list; list = list->next)
plug_in_def_free (list->data, FALSE);
g_slist_free (gimp->plug_in_defs);
gimp->plug_in_defs = NULL;
@ -388,7 +380,7 @@ plug_ins_exit (Gimp *gimp)
plug_in_exit (gimp);
for (list = gimp->plug_in_locale_domains; list; list = g_slist_next (list))
for (list = gimp->plug_in_locale_domains; list; list = list->next)
{
PlugInLocaleDomainDef *def = list->data;
@ -401,7 +393,7 @@ plug_ins_exit (Gimp *gimp)
g_slist_free (gimp->plug_in_locale_domains);
gimp->plug_in_locale_domains = NULL;
for (list = gimp->plug_in_help_domains; list; list = g_slist_next (list))
for (list = gimp->plug_in_help_domains; list; list = list->next)
{
PlugInHelpDomainDef *def = list->data;
@ -427,11 +419,11 @@ plug_ins_add_internal (Gimp *gimp,
}
PlugInProcDef *
plug_ins_file_handler (Gimp *gimp,
gchar *name,
gchar *extensions,
gchar *prefixes,
gchar *magics)
plug_ins_file_register_magic (Gimp *gimp,
const gchar *name,
const gchar *extensions,
const gchar *prefixes,
const gchar *magics)
{
GSList *list;
@ -443,41 +435,36 @@ plug_ins_file_handler (Gimp *gimp,
else
list = gimp->plug_in_proc_defs;
for (; list; list = g_slist_next (list))
for (; list; list = list->next)
{
PlugInProcDef *proc_def;
proc_def = list->data;
PlugInProcDef *proc_def = list->data;
if (strcmp (proc_def->db_info.name, name) == 0)
{
/* EXTENSIONS can be proc_def->extensions */
if (proc_def->extensions != extensions)
{
if (proc_def->extensions)
g_free (proc_def->extensions);
if (proc_def->extensions)
g_free (proc_def->extensions);
proc_def->extensions = g_strdup (extensions);
}
proc_def->extensions_list =
plug_ins_extensions_parse (proc_def->extensions);
/* PREFIXES can be proc_def->prefixes */
if (proc_def->prefixes != prefixes)
{
if (proc_def->prefixes)
g_free (proc_def->prefixes);
if (proc_def->prefixes)
g_free (proc_def->prefixes);
proc_def->prefixes = g_strdup (prefixes);
}
proc_def->prefixes_list =
plug_ins_extensions_parse (proc_def->prefixes);
/* MAGICS can be proc_def->magics */
if (proc_def->magics != magics)
{
if (proc_def->magics)
g_free (proc_def->magics);
if (proc_def->magics)
g_free (proc_def->magics);
proc_def->magics = g_strdup (magics);
}
@ -491,6 +478,39 @@ plug_ins_file_handler (Gimp *gimp,
return NULL;
}
PlugInProcDef *
plug_ins_file_register_mime (Gimp *gimp,
const gchar *name,
const gchar *mime_type)
{
GSList *list;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (mime_type != NULL, NULL);
if (gimp->current_plug_in)
list = gimp->current_plug_in->plug_in_def->proc_defs;
else
list = gimp->plug_in_proc_defs;
for (; list; list = list->next)
{
PlugInProcDef *proc_def = list->data;
if (strcmp (proc_def->db_info.name, name) == 0)
{
if (proc_def->mime_type)
g_free (proc_def->mime_type);
proc_def->mime_type = g_strdup (mime_type);
}
return proc_def;
}
return NULL;
}
void
plug_ins_def_add_from_rc (Gimp *gimp,
PlugInDef *plug_in_def)
@ -518,7 +538,7 @@ plug_ins_def_add_from_rc (Gimp *gimp,
* loader needs to be able to register no extensions, prefixes or
* magics. -- austin 13/Feb/99
*/
for (list = plug_in_def->proc_defs; list; list = g_slist_next (list))
for (list = plug_in_def->proc_defs; list; list = list->next)
{
PlugInProcDef *proc_def;
@ -538,7 +558,7 @@ plug_ins_def_add_from_rc (Gimp *gimp,
/* Check if the entry mentioned in pluginrc matches an executable
* found in the plug_in_path.
*/
for (list = gimp->plug_in_defs; list; list = g_slist_next (list))
for (list = gimp->plug_in_defs; list; list = list->next)
{
PlugInDef *ondisk_plug_in_def;
gchar *basename2;
@ -639,7 +659,7 @@ plug_ins_locale_domain (Gimp *gimp,
if (! prog_name)
return NULL;
for (list = gimp->plug_in_locale_domains; list; list = g_slist_next (list))
for (list = gimp->plug_in_locale_domains; list; list = list->next)
{
PlugInLocaleDomainDef *def = list->data;
@ -671,7 +691,7 @@ plug_ins_help_domain (Gimp *gimp,
if (! prog_name)
return NULL;
for (list = gimp->plug_in_help_domains; list; list = g_slist_next (list))
for (list = gimp->plug_in_help_domains; list; list = list->next)
{
PlugInHelpDomainDef *def = list->data;
@ -705,9 +725,7 @@ plug_ins_help_domains (Gimp *gimp,
*help_domains = g_new0 (gchar *, n_domains);
*help_uris = g_new0 (gchar *, n_domains);
for (list = gimp->plug_in_help_domains, i = 0;
list;
list = g_slist_next (list), i++)
for (list = gimp->plug_in_help_domains, i = 0; list; list = list->next, i++)
{
PlugInHelpDomainDef *def = list->data;
@ -727,7 +745,7 @@ plug_ins_proc_def_find (Gimp *gimp,
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (proc_rec != NULL, NULL);
for (list = gimp->plug_in_proc_defs; list; list = g_slist_next (list))
for (list = gimp->plug_in_proc_defs; list; list = list->next)
{
PlugInProcDef *proc_def;
@ -872,7 +890,7 @@ plug_ins_init_file (const GimpDatafileData *file_data,
plug_in_defs = (GSList **) user_data;
for (list = *plug_in_defs; list; list = g_slist_next (list))
for (list = *plug_in_defs; list; list = list->next)
{
gchar *plug_in_name;
@ -908,9 +926,9 @@ plug_ins_add_to_db (Gimp *gimp,
PlugInProcDef *proc_def;
GSList *list;
for (list = gimp->plug_in_proc_defs; list; list = g_slist_next (list))
for (list = gimp->plug_in_proc_defs; list; list = list->next)
{
proc_def = (PlugInProcDef *) list->data;
proc_def = list->data;
if (proc_def->prog && (proc_def->db_info.proc_type != GIMP_INTERNAL))
{
@ -921,12 +939,11 @@ plug_ins_add_to_db (Gimp *gimp,
for (list = gimp->plug_in_proc_defs; list; list = list->next)
{
proc_def = (PlugInProcDef *) list->data;
proc_def = list->data;
if (proc_def->extensions || proc_def->prefixes || proc_def->magics)
{
Argument args[4];
Argument *return_vals;
Argument args[4];
args[0].arg_type = GIMP_PDB_STRING;
args[0].value.pdb_pointer = proc_def->db_info.name;
@ -940,22 +957,11 @@ plug_ins_add_to_db (Gimp *gimp,
args[3].arg_type = GIMP_PDB_STRING;
args[3].value.pdb_pointer = proc_def->magics;
if (proc_def->image_types)
{
return_vals =
procedural_db_execute (gimp, context,
"gimp_register_save_handler",
args);
g_free (return_vals);
}
else
{
return_vals =
procedural_db_execute (gimp, context,
"gimp_register_magic_load_handler",
args);
g_free (return_vals);
}
g_free (procedural_db_execute (gimp, context,
proc_def->image_types ?
"gimp_register_save_handler" :
"gimp_register_magic_load_handler",
args));
}
}
}
@ -966,7 +972,7 @@ plug_ins_proc_def_insert (Gimp *gimp,
{
GSList *list;
for (list = gimp->plug_in_proc_defs; list; list = g_slist_next (list))
for (list = gimp->plug_in_proc_defs; list; list = list->next)
{
PlugInProcDef *tmp_proc_def = list->data;
@ -978,7 +984,8 @@ plug_ins_proc_def_insert (Gimp *gimp,
}
}
gimp->plug_in_proc_defs = g_slist_prepend (gimp->plug_in_proc_defs, proc_def);
gimp->plug_in_proc_defs = g_slist_prepend (gimp->plug_in_proc_defs,
proc_def);
return NULL;
}

View File

@ -32,11 +32,15 @@ void plug_ins_add_internal (Gimp *gimp,
PlugInProcDef *proc_def);
/* Add in the file load/save handler fields procedure. */
PlugInProcDef * plug_ins_file_handler (Gimp *gimp,
gchar *name,
gchar *extensions,
gchar *prefixes,
gchar *magics);
PlugInProcDef * plug_ins_file_register_magic (Gimp *gimp,
const gchar *name,
const gchar *extensions,
const gchar *prefixes,
const gchar *magics);
PlugInProcDef * plug_ins_file_register_mime (Gimp *gimp,
const gchar *name,
const gchar *mime_type);
/* Add a plug-in definition. */
void plug_ins_def_add_from_rc (Gimp *gimp,

View File

@ -36,11 +36,7 @@
PlugInProcDef *
plug_in_proc_def_new (void)
{
PlugInProcDef *proc_def;
proc_def = g_new0 (PlugInProcDef, 1);
return proc_def;
return g_new0 (PlugInProcDef, 1);
}
void
@ -81,6 +77,7 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
g_free (proc_def->extensions);
g_free (proc_def->prefixes);
g_free (proc_def->magics);
g_free (proc_def->mime_type);
g_free (proc_def->image_types);
g_free (proc_def);

View File

@ -32,6 +32,7 @@ struct _PlugInProcDef
gchar *extensions;
gchar *prefixes;
gchar *magics;
gchar *mime_type;
gchar *image_types;
PlugInImageType image_types_val;
ProcRecord db_info;

View File

@ -36,11 +36,7 @@
PlugInProcDef *
plug_in_proc_def_new (void)
{
PlugInProcDef *proc_def;
proc_def = g_new0 (PlugInProcDef, 1);
return proc_def;
return g_new0 (PlugInProcDef, 1);
}
void
@ -81,6 +77,7 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
g_free (proc_def->extensions);
g_free (proc_def->prefixes);
g_free (proc_def->magics);
g_free (proc_def->mime_type);
g_free (proc_def->image_types);
g_free (proc_def);

View File

@ -32,6 +32,7 @@ struct _PlugInProcDef
gchar *extensions;
gchar *prefixes;
gchar *magics;
gchar *mime_type;
gchar *image_types;
PlugInImageType image_types_val;
ProcRecord db_info;

View File

@ -36,11 +36,7 @@
PlugInProcDef *
plug_in_proc_def_new (void)
{
PlugInProcDef *proc_def;
proc_def = g_new0 (PlugInProcDef, 1);
return proc_def;
return g_new0 (PlugInProcDef, 1);
}
void
@ -81,6 +77,7 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
g_free (proc_def->extensions);
g_free (proc_def->prefixes);
g_free (proc_def->magics);
g_free (proc_def->mime_type);
g_free (proc_def->image_types);
g_free (proc_def);

View File

@ -32,6 +32,7 @@ struct _PlugInProcDef
gchar *extensions;
gchar *prefixes;
gchar *magics;
gchar *mime_type;
gchar *image_types;
PlugInImageType image_types_val;
ProcRecord db_info;

View File

@ -55,6 +55,8 @@ static GTokenType plug_in_menu_path_deserialize (GScanner *scanner,
PlugInProcDef *proc_def);
static GTokenType plug_in_proc_arg_deserialize (GScanner *scanner,
ProcArg *arg);
static GTokenType plug_in_mime_type_deserialize (GScanner *scanner,
PlugInProcDef *proc_def);
static GTokenType plug_in_locale_def_deserialize (GScanner *scanner,
PlugInDef *plug_in_def);
static GTokenType plug_in_help_def_deserialize (GScanner *scanner,
@ -72,7 +74,8 @@ enum
HELP_DEF,
HAS_INIT,
PROC_ARG,
MENU_PATH
MENU_PATH,
MIME_TYPE
};
@ -112,6 +115,8 @@ plug_in_rc_parse (Gimp *gimp,
"proc-arg", GINT_TO_POINTER (PROC_ARG));
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
"menu-path", GINT_TO_POINTER (MENU_PATH));
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
"mime-type", GINT_TO_POINTER (MIME_TYPE));
token = G_TOKEN_LEFT_PAREN;
@ -338,6 +343,14 @@ plug_in_proc_def_deserialize (GScanner *scanner,
return token;
}
if (g_scanner_peek_next_token (scanner) == G_TOKEN_LEFT_PAREN)
{
token = plug_in_mime_type_deserialize (scanner, proc_def);
if (token != G_TOKEN_LEFT_PAREN)
return token;
}
if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
return G_TOKEN_RIGHT_PAREN;
@ -368,6 +381,33 @@ plug_in_menu_path_deserialize (GScanner *scanner,
return G_TOKEN_LEFT_PAREN;
}
static GTokenType
plug_in_mime_type_deserialize (GScanner *scanner,
PlugInProcDef *proc_def)
{
gchar *mime_type;
if (! gimp_scanner_parse_token (scanner, G_TOKEN_LEFT_PAREN))
return G_TOKEN_LEFT_PAREN;
if (! gimp_scanner_parse_token (scanner, G_TOKEN_SYMBOL) ||
GPOINTER_TO_INT (scanner->value.v_symbol) != MIME_TYPE)
return G_TOKEN_SYMBOL;
if (! gimp_scanner_parse_string (scanner, &mime_type))
return G_TOKEN_STRING;
if (proc_def->mime_type)
g_free (proc_def->mime_type);
proc_def->mime_type = mime_type;
if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
return G_TOKEN_RIGHT_PAREN;
return G_TOKEN_LEFT_PAREN;
}
static GTokenType
plug_in_proc_arg_deserialize (GScanner *scanner,
ProcArg *arg)
@ -569,6 +609,13 @@ plug_in_rc_write (GSList *plug_in_defs,
gimp_config_writer_close (writer);
}
if (proc_def->mime_type)
{
gimp_config_writer_open (writer, "mime-type");
gimp_config_writer_string (writer, proc_def->mime_type);
gimp_config_writer_close (writer);
}
gimp_config_writer_close (writer);
}

View File

@ -49,7 +49,7 @@
#include "gimp-intl.h"
#define STD_PLUGINS_DOMAIN GETTEXT_PACKAGE "-std-plug-ins"
#define STD_PLUGINS_DOMAIN GETTEXT_PACKAGE "-std-plug-ins"
typedef struct _PlugInLocaleDomainDef PlugInLocaleDomainDef;
@ -88,7 +88,7 @@ plug_ins_init (Gimp *gimp,
gchar *filename;
gchar *basename;
gchar *path;
GSList *tmp;
GSList *list;
GList *extensions = NULL;
gdouble n_plugins;
gdouble n_extensions;
@ -149,11 +149,9 @@ plug_ins_init (Gimp *gimp,
(* status_callback) (_("Querying new Plug-ins"), "", 0);
n_plugins = g_slist_length (gimp->plug_in_defs);
for (tmp = gimp->plug_in_defs, nth = 0;
tmp;
tmp = g_slist_next (tmp), nth++)
for (list = gimp->plug_in_defs, nth = 0; list; list = list->next, nth++)
{
PlugInDef *plug_in_def = tmp->data;
PlugInDef *plug_in_def = list->data;
basename = g_path_get_basename (plug_in_def->prog);
(* status_callback) (NULL, gimp_filename_to_utf8 (basename),
@ -177,11 +175,9 @@ plug_ins_init (Gimp *gimp,
/* initialize the plug-ins */
(* status_callback) (_("Initializing Plug-ins"), "", 0);
for (tmp = gimp->plug_in_defs, nth = 0;
tmp;
tmp = g_slist_next (tmp), nth++)
for (list = gimp->plug_in_defs, nth = 0; list; list = list->next, nth++)
{
PlugInDef *plug_in_def = tmp->data;
PlugInDef *plug_in_def = list->data;
basename = g_path_get_basename (plug_in_def->prog);
(* status_callback) (NULL, gimp_filename_to_utf8 (basename),
@ -201,14 +197,14 @@ plug_ins_init (Gimp *gimp,
(* status_callback) (NULL, NULL, 1.0);
/* insert the proc defs */
for (tmp = gimp->plug_in_defs; tmp; tmp = g_slist_next (tmp))
for (list = gimp->plug_in_defs; list; list = list->next)
{
PlugInDef *plug_in_def = tmp->data;
GSList *tmp2;
PlugInDef *plug_in_def = list->data;
GSList *list2;
for (tmp2 = plug_in_def->proc_defs; tmp2; tmp2 = g_slist_next (tmp2))
for (list2 = plug_in_def->proc_defs; list2; list2 = list2->next)
{
PlugInProcDef *proc_def = tmp2->data;
PlugInProcDef *proc_def = list2->data;
PlugInProcDef *overridden_proc_def;
proc_def->mtime = plug_in_def->mtime;
@ -217,7 +213,7 @@ plug_ins_init (Gimp *gimp,
if (overridden_proc_def)
{
GSList *tmp3;
GSList *list3;
g_printerr ("removing duplicate PDB procedure \"%s\" "
"registered by '%s'\n",
@ -227,9 +223,9 @@ plug_ins_init (Gimp *gimp,
/* search the plugin list to see if any plugins had references to
* the overridden_proc_def.
*/
for (tmp3 = gimp->plug_in_defs; tmp3; tmp3 = g_slist_next (tmp3))
for (list3 = gimp->plug_in_defs; list3; list3 = list3->next)
{
PlugInDef *plug_in_def2 = tmp3->data;
PlugInDef *plug_in_def2 = list3->data;
plug_in_def2->proc_defs =
g_slist_remove (plug_in_def2->proc_defs,
@ -277,9 +273,9 @@ plug_ins_init (Gimp *gimp,
gimp);
/* create help_path and locale_domain lists */
for (tmp = gimp->plug_in_defs; tmp; tmp = g_slist_next (tmp))
for (list = gimp->plug_in_defs; list; list = list->next)
{
PlugInDef *plug_in_def = tmp->data;
PlugInDef *plug_in_def = list->data;
if (plug_in_def->locale_domain_name)
{
@ -327,11 +323,9 @@ plug_ins_init (Gimp *gimp,
gimp_menus_init (gimp, gimp->plug_in_defs, STD_PLUGINS_DOMAIN);
/* build list of automatically started extensions */
for (tmp = gimp->plug_in_proc_defs, nth = 0;
tmp;
tmp = g_slist_next (tmp), nth++)
for (list = gimp->plug_in_proc_defs, nth = 0; list; list = list->next, nth++)
{
PlugInProcDef *proc_def = tmp->data;
PlugInProcDef *proc_def = list->data;
if (proc_def->prog &&
proc_def->db_info.proc_type == GIMP_EXTENSION &&
@ -351,9 +345,7 @@ plug_ins_init (Gimp *gimp,
(* status_callback) (_("Starting Extensions"), "", 0);
for (list = extensions, nth = 0;
list;
list = g_list_next (list), nth++)
for (list = extensions, nth = 0; list; list = g_list_next (list), nth++)
{
PlugInProcDef *proc_def = list->data;
@ -372,8 +364,8 @@ plug_ins_init (Gimp *gimp,
}
/* free up stuff */
for (tmp = gimp->plug_in_defs; tmp; tmp = g_slist_next (tmp))
plug_in_def_free (tmp->data, FALSE);
for (list = gimp->plug_in_defs; list; list = list->next)
plug_in_def_free (list->data, FALSE);
g_slist_free (gimp->plug_in_defs);
gimp->plug_in_defs = NULL;
@ -388,7 +380,7 @@ plug_ins_exit (Gimp *gimp)
plug_in_exit (gimp);
for (list = gimp->plug_in_locale_domains; list; list = g_slist_next (list))
for (list = gimp->plug_in_locale_domains; list; list = list->next)
{
PlugInLocaleDomainDef *def = list->data;
@ -401,7 +393,7 @@ plug_ins_exit (Gimp *gimp)
g_slist_free (gimp->plug_in_locale_domains);
gimp->plug_in_locale_domains = NULL;
for (list = gimp->plug_in_help_domains; list; list = g_slist_next (list))
for (list = gimp->plug_in_help_domains; list; list = list->next)
{
PlugInHelpDomainDef *def = list->data;
@ -427,11 +419,11 @@ plug_ins_add_internal (Gimp *gimp,
}
PlugInProcDef *
plug_ins_file_handler (Gimp *gimp,
gchar *name,
gchar *extensions,
gchar *prefixes,
gchar *magics)
plug_ins_file_register_magic (Gimp *gimp,
const gchar *name,
const gchar *extensions,
const gchar *prefixes,
const gchar *magics)
{
GSList *list;
@ -443,41 +435,36 @@ plug_ins_file_handler (Gimp *gimp,
else
list = gimp->plug_in_proc_defs;
for (; list; list = g_slist_next (list))
for (; list; list = list->next)
{
PlugInProcDef *proc_def;
proc_def = list->data;
PlugInProcDef *proc_def = list->data;
if (strcmp (proc_def->db_info.name, name) == 0)
{
/* EXTENSIONS can be proc_def->extensions */
if (proc_def->extensions != extensions)
{
if (proc_def->extensions)
g_free (proc_def->extensions);
if (proc_def->extensions)
g_free (proc_def->extensions);
proc_def->extensions = g_strdup (extensions);
}
proc_def->extensions_list =
plug_ins_extensions_parse (proc_def->extensions);
/* PREFIXES can be proc_def->prefixes */
if (proc_def->prefixes != prefixes)
{
if (proc_def->prefixes)
g_free (proc_def->prefixes);
if (proc_def->prefixes)
g_free (proc_def->prefixes);
proc_def->prefixes = g_strdup (prefixes);
}
proc_def->prefixes_list =
plug_ins_extensions_parse (proc_def->prefixes);
/* MAGICS can be proc_def->magics */
if (proc_def->magics != magics)
{
if (proc_def->magics)
g_free (proc_def->magics);
if (proc_def->magics)
g_free (proc_def->magics);
proc_def->magics = g_strdup (magics);
}
@ -491,6 +478,39 @@ plug_ins_file_handler (Gimp *gimp,
return NULL;
}
PlugInProcDef *
plug_ins_file_register_mime (Gimp *gimp,
const gchar *name,
const gchar *mime_type)
{
GSList *list;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (mime_type != NULL, NULL);
if (gimp->current_plug_in)
list = gimp->current_plug_in->plug_in_def->proc_defs;
else
list = gimp->plug_in_proc_defs;
for (; list; list = list->next)
{
PlugInProcDef *proc_def = list->data;
if (strcmp (proc_def->db_info.name, name) == 0)
{
if (proc_def->mime_type)
g_free (proc_def->mime_type);
proc_def->mime_type = g_strdup (mime_type);
}
return proc_def;
}
return NULL;
}
void
plug_ins_def_add_from_rc (Gimp *gimp,
PlugInDef *plug_in_def)
@ -518,7 +538,7 @@ plug_ins_def_add_from_rc (Gimp *gimp,
* loader needs to be able to register no extensions, prefixes or
* magics. -- austin 13/Feb/99
*/
for (list = plug_in_def->proc_defs; list; list = g_slist_next (list))
for (list = plug_in_def->proc_defs; list; list = list->next)
{
PlugInProcDef *proc_def;
@ -538,7 +558,7 @@ plug_ins_def_add_from_rc (Gimp *gimp,
/* Check if the entry mentioned in pluginrc matches an executable
* found in the plug_in_path.
*/
for (list = gimp->plug_in_defs; list; list = g_slist_next (list))
for (list = gimp->plug_in_defs; list; list = list->next)
{
PlugInDef *ondisk_plug_in_def;
gchar *basename2;
@ -639,7 +659,7 @@ plug_ins_locale_domain (Gimp *gimp,
if (! prog_name)
return NULL;
for (list = gimp->plug_in_locale_domains; list; list = g_slist_next (list))
for (list = gimp->plug_in_locale_domains; list; list = list->next)
{
PlugInLocaleDomainDef *def = list->data;
@ -671,7 +691,7 @@ plug_ins_help_domain (Gimp *gimp,
if (! prog_name)
return NULL;
for (list = gimp->plug_in_help_domains; list; list = g_slist_next (list))
for (list = gimp->plug_in_help_domains; list; list = list->next)
{
PlugInHelpDomainDef *def = list->data;
@ -705,9 +725,7 @@ plug_ins_help_domains (Gimp *gimp,
*help_domains = g_new0 (gchar *, n_domains);
*help_uris = g_new0 (gchar *, n_domains);
for (list = gimp->plug_in_help_domains, i = 0;
list;
list = g_slist_next (list), i++)
for (list = gimp->plug_in_help_domains, i = 0; list; list = list->next, i++)
{
PlugInHelpDomainDef *def = list->data;
@ -727,7 +745,7 @@ plug_ins_proc_def_find (Gimp *gimp,
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (proc_rec != NULL, NULL);
for (list = gimp->plug_in_proc_defs; list; list = g_slist_next (list))
for (list = gimp->plug_in_proc_defs; list; list = list->next)
{
PlugInProcDef *proc_def;
@ -872,7 +890,7 @@ plug_ins_init_file (const GimpDatafileData *file_data,
plug_in_defs = (GSList **) user_data;
for (list = *plug_in_defs; list; list = g_slist_next (list))
for (list = *plug_in_defs; list; list = list->next)
{
gchar *plug_in_name;
@ -908,9 +926,9 @@ plug_ins_add_to_db (Gimp *gimp,
PlugInProcDef *proc_def;
GSList *list;
for (list = gimp->plug_in_proc_defs; list; list = g_slist_next (list))
for (list = gimp->plug_in_proc_defs; list; list = list->next)
{
proc_def = (PlugInProcDef *) list->data;
proc_def = list->data;
if (proc_def->prog && (proc_def->db_info.proc_type != GIMP_INTERNAL))
{
@ -921,12 +939,11 @@ plug_ins_add_to_db (Gimp *gimp,
for (list = gimp->plug_in_proc_defs; list; list = list->next)
{
proc_def = (PlugInProcDef *) list->data;
proc_def = list->data;
if (proc_def->extensions || proc_def->prefixes || proc_def->magics)
{
Argument args[4];
Argument *return_vals;
Argument args[4];
args[0].arg_type = GIMP_PDB_STRING;
args[0].value.pdb_pointer = proc_def->db_info.name;
@ -940,22 +957,11 @@ plug_ins_add_to_db (Gimp *gimp,
args[3].arg_type = GIMP_PDB_STRING;
args[3].value.pdb_pointer = proc_def->magics;
if (proc_def->image_types)
{
return_vals =
procedural_db_execute (gimp, context,
"gimp_register_save_handler",
args);
g_free (return_vals);
}
else
{
return_vals =
procedural_db_execute (gimp, context,
"gimp_register_magic_load_handler",
args);
g_free (return_vals);
}
g_free (procedural_db_execute (gimp, context,
proc_def->image_types ?
"gimp_register_save_handler" :
"gimp_register_magic_load_handler",
args));
}
}
}
@ -966,7 +972,7 @@ plug_ins_proc_def_insert (Gimp *gimp,
{
GSList *list;
for (list = gimp->plug_in_proc_defs; list; list = g_slist_next (list))
for (list = gimp->plug_in_proc_defs; list; list = list->next)
{
PlugInProcDef *tmp_proc_def = list->data;
@ -978,7 +984,8 @@ plug_ins_proc_def_insert (Gimp *gimp,
}
}
gimp->plug_in_proc_defs = g_slist_prepend (gimp->plug_in_proc_defs, proc_def);
gimp->plug_in_proc_defs = g_slist_prepend (gimp->plug_in_proc_defs,
proc_def);
return NULL;
}

View File

@ -32,11 +32,15 @@ void plug_ins_add_internal (Gimp *gimp,
PlugInProcDef *proc_def);
/* Add in the file load/save handler fields procedure. */
PlugInProcDef * plug_ins_file_handler (Gimp *gimp,
gchar *name,
gchar *extensions,
gchar *prefixes,
gchar *magics);
PlugInProcDef * plug_ins_file_register_magic (Gimp *gimp,
const gchar *name,
const gchar *extensions,
const gchar *prefixes,
const gchar *magics);
PlugInProcDef * plug_ins_file_register_mime (Gimp *gimp,
const gchar *name,
const gchar *mime_type);
/* Add a plug-in definition. */
void plug_ins_def_add_from_rc (Gimp *gimp,

View File

@ -81,11 +81,12 @@ static ProcArg xcf_load_return_vals[] =
static PlugInProcDef xcf_plug_in_load_proc =
{
"gimp_xcf_load",
"XCF (GIMP)",
N_("GIMP XCF image"),
NULL,
"xcf",
"",
"0,string,gimp\\040xcf\\040",
"image/x-xcf",
NULL, /* ignored for load */
0, /* ignored for load */
{
@ -130,11 +131,12 @@ static ProcArg xcf_save_args[] =
static PlugInProcDef xcf_plug_in_save_proc =
{
"gimp_xcf_save",
"XCF (GIMP)",
N_("GIMP XCF image"),
NULL,
"xcf",
"",
NULL,
"image/x-xcf",
"RGB*, GRAY*, INDEXED*",
0, /* fill me in at runtime */
{

View File

@ -257,3 +257,39 @@ gimp_register_save_handler (const gchar *procedure_name,
return success;
}
/**
* 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\".
*
* 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.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.2
*/
gboolean
gimp_register_file_handler_mime (const gchar *procedure_name,
const gchar *mime_type)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_register_file_handler_mime",
&nreturn_vals,
GIMP_PDB_STRING, procedure_name,
GIMP_PDB_STRING, mime_type,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}

View File

@ -48,6 +48,8 @@ gboolean gimp_register_load_handler (const gchar *procedure_name,
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);
G_END_DECLS

View File

@ -117,32 +117,37 @@ query (void)
"Alexander Schulz",
"Alexander Schulz",
"1997",
"<Load>/BMP",
N_("Windows BMP image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_bmp_load", "<Load>");
gimp_register_file_handler_mime ("file_bmp_load", "image/bmp");
gimp_register_magic_load_handler ("file_bmp_load",
"bmp",
"",
"0,string,BM");
gimp_install_procedure ("file_bmp_save",
"Saves files in Windows BMP file format",
"Saves files in Windows BMP file format",
"Alexander Schulz",
"Alexander Schulz",
"1997",
"<Save>/BMP",
N_("Windows BMP image"),
"INDEXED, GRAY, RGB",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_bmp_load",
"bmp",
"",
"0,string,BM");
gimp_register_save_handler ("file_bmp_save",
"bmp",
"");
gimp_plugin_menu_register ("file_bmp_save", "<Save>");
gimp_register_file_handler_mime ("file_bmp_save", "image/bmp");
gimp_register_save_handler ("file_bmp_save",
"bmp",
"");
}
static void

View File

@ -105,12 +105,14 @@ query (void)
"Tim Janik",
"Tim Janik",
"1999",
"<Save>/C-Source",
N_("C source code"),
"RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_plugin_menu_register ("file_csource_save", "<Save>");
gimp_register_file_handler_mime ("file_csource_save", "text/x-csrc");
gimp_register_save_handler ("file_csource_save",
"c",
"");

View File

@ -121,6 +121,31 @@ query (void)
{ GIMP_PDB_STRING, "raw_filename", "The name of the file to save" },
};
gimp_install_procedure ("file_dicom_load",
"loads files of the dicom file format",
"Load a file in the DICOM standard format."
"The standard is defined at "
"http://medical.nema.org/. The plug-in currently "
"only supports reading images with uncompressed "
"pixel sections.",
"Dov Grobgeld",
"Dov Grobgeld <dov@imagic.weizmann.ac.il>",
"2003",
N_("Digital Imaging and Communications in Medicine image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_dicom_load", "<Load>");
gimp_register_file_handler_mime ("file_dicom_load", "image/x-dcm");
gimp_register_magic_load_handler ("file_dicom_load",
"dcm,DCM,dicom,DICOM",
"",
"128,string,DICM"
);
gimp_install_procedure ("file_dicom_save",
"Save file in the DICOM file format",
"Save an image in the medical standard DICOM image "
@ -132,37 +157,17 @@ query (void)
"Dov Grobgeld",
"Dov Grobgeld <dov@imagic.weizmann.ac.il>",
"2003",
"<Save>/DICOM",
N_("Digital Imaging and Communications in Medicine image"),
"RGB, GRAY",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_install_procedure ("file_dicom_load",
"loads files of the dicom file format",
"Load a file in the DICOM standard format."
"The standard is defined at "
"http://medical.nema.org/. The plug-in currently "
"only supports reading images with uncompressed "
"pixel sections.",
"Dov Grobgeld",
"Dov Grobgeld <dov@imagic.weizmann.ac.il>",
"2003",
"<Load>/DICOM",
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_register_magic_load_handler ("file_dicom_load",
"dcm,DCM,dicom,DICOM",
"",
"128,string,DICM"
);
gimp_register_save_handler ("file_dicom_save",
"dicom,dcm,DCM,DICOM",
"");
gimp_plugin_menu_register ("file_dicom_save", "<Save>");
gimp_register_file_handler_mime ("file_dicom_save", "image/x-dcm");
gimp_register_save_handler ("file_dicom_save",
"dicom,dcm,DCM,DICOM",
"");
}
static void

View File

@ -399,12 +399,14 @@ query (void)
"Spencer Kimball, Peter Mattis, Adam Moss, David Koblas",
"Spencer Kimball, Peter Mattis, Adam Moss, David Koblas",
"1995-1997",
"<Save>/GIF",
N_("GIF image"),
"INDEXED*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_plugin_menu_register ("file_gif_save", "<Save>");
gimp_register_file_handler_mime ("file_gif_save", "image/gif");
gimp_register_save_handler ("file_gif_save",
"gif",
"");

View File

@ -140,13 +140,16 @@ query (void)
"Spencer Kimball, Peter Mattis, Adam Moss, David Koblas",
"Spencer Kimball, Peter Mattis, Adam Moss, David Koblas",
"1995-1997",
"<Load>/GIF",
N_("GIF image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_gif_load", "<Load>");
gimp_register_file_handler_mime ("file_gif_load", "image/gif");
gimp_register_magic_load_handler ("file_gif_load",
"gif",
"",

View File

@ -330,32 +330,37 @@ query (void)
"Spencer Kimball, Peter Mattis & others",
"Spencer Kimball & Peter Mattis",
"1995-1999",
"<Load>/Jpeg",
N_("JPEG image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_jpeg_load", "<Load>");
gimp_register_file_handler_mime ("file_jpeg_load", "image/jpeg");
gimp_register_magic_load_handler ("file_jpeg_load",
"jpg,jpeg,jpe",
"",
"6,string,JFIF,6,string,Exif");
gimp_install_procedure ("file_jpeg_save",
"saves files in the JPEG file format",
"saves files in the lossy, widely supported JPEG format",
"Spencer Kimball, Peter Mattis & others",
"Spencer Kimball & Peter Mattis",
"1995-1999",
"<Save>/JPEG",
N_("JPEG image"),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_jpeg_load",
"jpg,jpeg,jpe",
"",
"6,string,JFIF,6,string,Exif");
gimp_register_save_handler ("file_jpeg_save",
"jpg,jpeg,jpe",
"");
gimp_plugin_menu_register ("file_jpeg_save", "<Save>");
gimp_register_file_handler_mime ("file_jpeg_save", "image/jpeg");
gimp_register_save_handler ("file_jpeg_save",
"jpg,jpeg,jpe",
"");
}
static void

View File

@ -1465,11 +1465,14 @@ query (void)
"S. Mukund <muks@mukund.org>",
"S. Mukund <muks@mukund.org>",
"November 19, 2002",
"<Save>/MNG", "RGB*,GRAY*",
N_("MNG animation"),
"RGB*,GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_plugin_menu_register ("file_mng_save", "<Save>");
gimp_register_file_handler_mime ("file_mng_save", "image/x-mng");
gimp_register_save_handler ("file_mng_save", "mng", "");
}

View File

@ -243,25 +243,32 @@ query (void)
"Michael Sweet <mike@easysw.com>, Daniel Skarda <0rfelyus@atrey.karlin.mff.cuni.cz>",
"Michael Sweet <mike@easysw.com>, Daniel Skarda <0rfelyus@atrey.karlin.mff.cuni.cz>, Nick Lamb <njl195@zepler.org.uk>",
PLUG_IN_VERSION,
"<Load>/PNG",
N_("PNG image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_png_load", "<Load>");
gimp_register_file_handler_mime ("file_png_load", "image/png");
gimp_register_magic_load_handler ("file_png_load",
"png", "", "0,string,\211PNG\r\n\032\n");
gimp_install_procedure ("file_png_save",
"Saves files in PNG file format",
"This plug-in saves Portable Network Graphics (PNG) files.",
"Michael Sweet <mike@easysw.com>, Daniel Skarda <0rfelyus@atrey.karlin.mff.cuni.cz>",
"Michael Sweet <mike@easysw.com>, Daniel Skarda <0rfelyus@atrey.karlin.mff.cuni.cz>, Nick Lamb <njl195@zepler.org.uk>",
PLUG_IN_VERSION,
NULL,
N_("PNG image"),
"RGB*,GRAY*,INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_file_handler_mime ("file_png_save", "image/png");
gimp_install_procedure ("file_png_save2",
"Saves files in PNG file format",
"This plug-in saves Portable Network Graphics (PNG) files. "
@ -269,29 +276,28 @@ query (void)
"Michael Sweet <mike@easysw.com>, Daniel Skarda <0rfelyus@atrey.karlin.mff.cuni.cz>",
"Michael Sweet <mike@easysw.com>, Daniel Skarda <0rfelyus@atrey.karlin.mff.cuni.cz>, Nick Lamb <njl195@zepler.org.uk>",
PLUG_IN_VERSION,
NULL,
N_("PNG image"),
"RGB*,GRAY*,INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args2), 0,
save_args2, NULL);
/* We only register a save menu path for this one, since it is the only one
* registered as a save handler below.
*/
gimp_register_file_handler_mime ("file_png_save2", "image/png");
gimp_install_procedure ("file_png_save_defaults",
"Saves files in PNG file format",
"This plug-in saves Portable Network Graphics (PNG) files, using the default settings stored as a parasite.",
"Michael Sweet <mike@easysw.com>, Daniel Skarda <0rfelyus@atrey.karlin.mff.cuni.cz>",
"Michael Sweet <mike@easysw.com>, Daniel Skarda <0rfelyus@atrey.karlin.mff.cuni.cz>, Nick Lamb <njl195@zepler.org.uk>",
PLUG_IN_VERSION,
"<Save>/PNG",
N_("PNG image"),
"RGB*,GRAY*,INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args_defaults), 0,
save_args_defaults, NULL);
gimp_register_magic_load_handler ("file_png_load",
"png", "", "0,string,\211PNG\r\n\032\n");
gimp_plugin_menu_register ("file_png_save_defaults", "<Save>");
gimp_register_file_handler_mime ("file_png_save_defaults", "image/png");
gimp_register_save_handler ("file_png_save_defaults", "png", "");
gimp_install_procedure ("file_png_get_defaults",

View File

@ -557,18 +557,65 @@ query (void)
};
gimp_install_procedure ("file_ps_load",
"load file of PostScript/PDF file format",
"load file of PostScript/PDF file format",
"load PostScript documents",
"load PostScript documents",
"Peter Kirchgessner <peter@kirchgessner.net>",
"Peter Kirchgessner",
dversio,
"<Load>/PostScript",
N_("PostScript document"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_ps_load", "<Load>");
gimp_register_file_handler_mime ("file_ps_load", "application/postscript");
gimp_register_magic_load_handler ("file_ps_load",
"ps",
"",
"0,string,%!,0,long,0xc5d0d3c6");
gimp_install_procedure ("file_eps_load",
"load Encapsulated PostScript images",
"load Encapsulated PostScript images",
"Peter Kirchgessner <peter@kirchgessner.net>",
"Peter Kirchgessner",
dversio,
N_("Encapsulated PostScript image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_eps_load", "<Load>");
gimp_register_file_handler_mime ("file_eps_load", "image/x-eps");
gimp_register_magic_load_handler ("file_eps_load",
"eps",
"",
"0,string,%!,0,long,0xc5d0d3c6");
gimp_install_procedure ("file_pdf_load",
"load PDF documents",
"load PDF documents",
"Peter Kirchgessner <peter@kirchgessner.net>",
"Peter Kirchgessner",
dversio,
N_("PDF document"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_pdf_load", "<Load>");
gimp_register_file_handler_mime ("file_pdf_load", "application/pdf");
gimp_register_magic_load_handler ("file_pdf_load",
"pdf",
"",
"0,string,%PDF");
gimp_install_procedure ("file_ps_load_setargs",
"set additional parameters for procedure file_ps_load",
"set additional parameters for procedure file_ps_load",
@ -582,24 +629,40 @@ query (void)
set_load_args, NULL);
gimp_install_procedure ("file_ps_save",
"save file in PostScript file format",
"save image as PostScript docuement",
"PostScript saving handles all image types except those with alpha channels.",
"Peter Kirchgessner <peter@kirchgessner.net>",
"Peter Kirchgessner",
dversio,
"<Save>/PostScript",
N_("PostScript document"),
"RGB, GRAY, INDEXED",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_ps_load",
"ps,eps,pdf",
"",
"0,string,%!,0,string,%PDF,0,long,0xc5d0d3c6");
gimp_register_save_handler ("file_ps_save",
"ps,eps",
"");
gimp_plugin_menu_register ("file_ps_save", "<Save>");
gimp_register_file_handler_mime ("file_ps_save", "application/postscript");
gimp_register_save_handler ("file_ps_save",
"ps",
"");
gimp_install_procedure ("file_eps_save",
"save image as Encapsulated PostScript image",
"PostScript saving handles all image types except those with alpha channels.",
"Peter Kirchgessner <peter@kirchgessner.net>",
"Peter Kirchgessner",
dversio,
N_("Encapsulated PostScript image"),
"RGB, GRAY, INDEXED",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_plugin_menu_register ("file_eps_save", "<Save>");
gimp_register_file_handler_mime ("file_eps_save", "application/x-eps");
gimp_register_save_handler ("file_eps_save",
"eps",
"");
}
static void
@ -654,7 +717,6 @@ run (const gchar *name,
gint32 drawable_ID = -1;
gint32 orig_image_ID = -1;
GimpExportReturn export = GIMP_EXPORT_CANCEL;
gint k;
l_run_mode = run_mode = param[0].data.d_int32;
@ -665,7 +727,9 @@ run (const gchar *name,
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
if (strcmp (name, "file_ps_load") == 0)
if (strcmp (name, "file_ps_load") == 0 ||
strcmp (name, "file_eps_load") == 0 ||
strcmp (name, "file_pdf_load") == 0)
{
switch (run_mode)
{
@ -715,8 +779,11 @@ run (const gchar *name,
if (status == GIMP_PDB_SUCCESS)
gimp_set_data ("file_ps_load", &plvals, sizeof (PSLoadVals));
}
else if (strcmp (name, "file_ps_save") == 0)
else if (strcmp (name, "file_ps_save") == 0 ||
strcmp (name, "file_eps_save") == 0)
{
psvals.eps = strcmp (name, "file_ps_save");
image_ID = orig_image_ID = param[1].data.d_int32;
drawable_ID = param[2].data.d_int32;
@ -726,7 +793,8 @@ run (const gchar *name,
case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init ("ps", FALSE);
export = gimp_export_image (&image_ID, &drawable_ID, "PS",
export = gimp_export_image (&image_ID, &drawable_ID,
psvals.eps ? "EPS" : "PostScript",
(GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED));
@ -744,12 +812,7 @@ run (const gchar *name,
{
case GIMP_RUN_INTERACTIVE:
/* Possibly retrieve data */
gimp_get_data ("file_ps_save", &psvals);
/* About to save an EPS-file ? Switch on eps-flag in dialog */
k = strlen (param[3].data.d_string);
if ((k >= 4) && (strcmp (param[3].data.d_string+k-4, ".eps") == 0))
psvals.eps = 1;
gimp_get_data (name, &psvals);
ps_set_save_size (&psvals, orig_image_ID);
@ -782,7 +845,7 @@ run (const gchar *name,
case GIMP_RUN_WITH_LAST_VALS:
/* Possibly retrieve data */
gimp_get_data ("file_ps_save", &psvals);
gimp_get_data (name, &psvals);
break;
default:
@ -798,7 +861,7 @@ run (const gchar *name,
if (save_image (param[3].data.d_string, image_ID, drawable_ID))
{
/* Store psvals data */
gimp_set_data ("file_ps_save", &psvals, sizeof (PSSaveVals));
gimp_set_data (name, &psvals, sizeof (PSSaveVals));
}
else
{

View File

@ -428,13 +428,15 @@ query (void)
"Adam D. Moss & Torsten Martinsen",
"Adam D. Moss & Torsten Martinsen",
"1996-1998",
"<Load>/PSD",
"Photoshop image",
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_psd_load", "<Load>");
gimp_register_file_handler_mime ("file_psd_load", "image/x-psd");
gimp_register_magic_load_handler ("file_psd_load",
"psd",
"",

View File

@ -178,11 +178,14 @@ query ()
"Monigotes",
"Monigotes",
"2000",
"<Save>/PSD",
N_("Photoshop image"),
"RGB*, GRAY*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_plugin_menu_register ("file_psd_save", "<Save>");
gimp_register_file_handler_mime ("file_psd_save", "image/x-psd");
gimp_register_save_handler ("file_psd_save", "psd", "");
}

View File

@ -214,13 +214,20 @@ query (void)
"Peter Kirchgessner",
"Peter Kirchgessner",
"1996",
"<Load>/SUNRAS",
N_("SUN Rasterfile image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_sunras_load", "<Load>");
gimp_register_file_handler_mime ("file_sunras_load", "image/x-sun-raster");
gimp_register_magic_load_handler ("file_sunras_load",
"im1,im8,im24,im32,rs,ras",
"",
"0,long,0x59a66a95");
gimp_install_procedure ("file_sunras_save",
"save file in the SunRaster file format",
"SUNRAS saving handles all image types except "
@ -228,20 +235,17 @@ query (void)
"Peter Kirchgessner",
"Peter Kirchgessner",
"1996",
"<Save>/SUNRAS",
N_("SUN Rasterfile image"),
"RGB, GRAY, INDEXED",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
/* Magic information for sunras would be "0,long,0x59a66a95" */
gimp_register_magic_load_handler ("file_sunras_load",
"im1,im8,im24,im32,rs,ras",
"",
"0,long,0x59a66a95");
gimp_register_save_handler ("file_sunras_save",
"im1,im8,im24,im32,rs,ras",
"");
gimp_plugin_menu_register ("file_sunrad_save", "<Save>");
gimp_register_file_handler_mime ("file_sunras_save", "image/x-sun-raster");
gimp_register_save_handler ("file_sunras_save",
"im1,im8,im24,im32,rs,ras",
"");
}

View File

@ -121,13 +121,15 @@ query (void)
"Dom Lachowicz, Sven Neumann",
"Dom Lachowicz <cinamod@hotmail.com>",
SVG_VERSION,
"<Load>/SVG",
N_("Scalable SVG image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_svg_load", "<Load>");
gimp_register_file_handler_mime ("file_svg_load", "image/svg+xml");
gimp_register_magic_load_handler ("file_svg_load",
"svg", "",
"0,string,<?xml,0,string,<svg");

View File

@ -230,27 +230,31 @@ query (void)
"Raphael FRANCOIS, Gordon Matzigkeit",
"Raphael FRANCOIS, Gordon Matzigkeit",
"1997",
"<Load>/TGA",
N_("TarGA image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_tga_load", "<Load>");
gimp_register_file_handler_mime ("file_tga_load", "image/x-tga");
gimp_register_load_handler ("file_tga_load", "tga", "");
gimp_install_procedure ("file_tga_save",
"saves files in the Targa file format",
"FIXME: write help for tga_save",
"Raphael FRANCOIS, Gordon Matzigkeit",
"Raphael FRANCOIS, Gordon Matzigkeit",
"1997",
"<Save>/TGA",
N_("TarGA image"),
"RGB*, GRAY*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_load_handler ("file_tga_load", "tga", "");
gimp_plugin_menu_register ("file_tga_save", "<Save>");
gimp_register_file_handler_mime ("file_tga_save", "image/x-tga");
gimp_register_save_handler ("file_tga_save", "tga", "");
}

View File

@ -208,13 +208,20 @@ query (void)
"Spencer Kimball, Peter Mattis & Nick Lamb",
"Nick Lamb <njl195@zepler.org.uk>",
"1995-1996,1998-2003",
"<Load>/Tiff",
N_("TIFF images"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_tiff_load", "<Load>");
gimp_register_file_handler_mime ("file_tiff_load", "image/tiff");
gimp_register_magic_load_handler ("file_tiff_load",
"tif,tiff",
"",
"0,string,II*\\0,0,string,MM\\0*");
gimp_install_procedure ("file_tiff_save",
"saves files in the tiff file format",
"Saves files in the Tagged Image File Format. "
@ -223,14 +230,18 @@ query (void)
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996,2000-2003",
"<Save>/Tiff",
N_("TIFF image"),
"RGB*, GRAY*, INDEXED",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args_old), 0,
save_args_old, NULL);
/* Add a save menu path for this procedure, since it is registered as a
* save handler below. */
gimp_plugin_menu_register ("file_tiff_save", "<Save>");
gimp_register_file_handler_mime ("file_tiff_save", "image/tiff");
gimp_register_save_handler ("file_tiff_save",
"tif,tiff",
"");
gimp_install_procedure ("file_tiff_save2",
"saves files in the tiff file format",
"Saves files in the Tagged Image File Format. "
@ -239,19 +250,13 @@ query (void)
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996,2000-2003",
NULL,
N_("TIFF image"),
"RGB*, GRAY*, INDEXED",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_tiff_load",
"tif,tiff",
"",
"0,string,II*\\0,0,string,MM\\0*");
gimp_register_save_handler ("file_tiff_save",
"tif,tiff",
"");
gimp_register_file_handler_mime ("file_tiff_save2", "image/tiff");
}
static void

View File

@ -101,13 +101,15 @@ query (void)
"Dom Lachowicz <cinamod@hotmail.com>",
"Dom Lachowicz <cinamod@hotmail.com>",
"(c) 2003 - Version 0.3.0",
"<Load>/WMF",
N_("Microsoft WMF file"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_wmf_load", "<Load>");
gimp_register_file_handler_mime ("file_wmf_load", "image/x-wmf");
gimp_register_magic_load_handler ("file_wmf_load",
"wmf,apm", "",
"0,string,\\327\\315\\306\\232,0,string,\\1\\0\\11\\0");

View File

@ -166,28 +166,33 @@ query (void)
"Gordon Matzigkeit",
"Gordon Matzigkeit",
"1998",
"<Load>/XBM",
N_("X BitMap image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_xbm_load", "<Load>");
gimp_register_file_handler_mime ("file_xbm_load", "image/x-xbitmap");
gimp_register_load_handler ("file_xbm_load",
"xbm,icon,bitmap",
"");
gimp_install_procedure ("file_xbm_save",
"Save a file in X10 or X11 bitmap (XBM) file format",
"Save a file in X10 or X11 bitmap (XBM) file format. XBM is a lossless format for flat black-and-white (two color indexed) images.",
"Gordon Matzigkeit",
"Gordon Matzigkeit",
"1998",
"<Save>/XBM",
N_("X BitMap image"),
"INDEXED",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_load_handler ("file_xbm_load",
"xbm,icon,bitmap",
"");
gimp_plugin_menu_register ("file_xbm_save", "<Save>");
gimp_register_file_handler_mime ("file_xbm_save", "image/x-xbitmap");
gimp_register_save_handler ("file_xbm_save",
"xbm,icon,bitmap",
"");

View File

@ -161,29 +161,34 @@ query (void)
"Spencer Kimball & Peter Mattis & Ray Lehtiniemi",
"Spencer Kimball & Peter Mattis",
"1997",
"<Load>/Xpm",
N_("X PixMap image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_xpm_load", "<Load>");
gimp_register_file_handler_mime ("file_xpm_load", "image/x-xpixmap");
gimp_register_magic_load_handler ("file_xpm_load",
"xpm",
"<Load>/Xpm",
"0, string,/*\\040XPM\\040*/");
gimp_install_procedure ("file_xpm_save",
"saves files in the xpm file format (if you're on a 16 bit display...)",
"FIXME: write help for xpm",
"Spencer Kimball & Peter Mattis & Ray Lehtiniemi & Nathan Summers",
"Spencer Kimball & Peter Mattis",
"1997",
"<Save>/Xpm",
N_("X PixMap image"),
"RGB*, GRAY*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_xpm_load",
"xpm",
"<Load>/Xpm",
"0, string,/*\\040XPM\\040*/");
gimp_plugin_menu_register ("file_xpm_save", "<Save>");
gimp_register_file_handler_mime ("file_xpm_save", "image/x-xpixmap");
gimp_register_save_handler ("file_xpm_save",
"xpm",
"<Save>/Xpm");

View File

@ -238,13 +238,20 @@ query (void)
"Peter Kirchgessner",
"Peter Kirchgessner",
"1996",
"<Load>/XWD",
N_("X window image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_xwd_load", "<Load>");
gimp_register_file_handler_mime ("file_xwd_load", "image/x-xwindowdump");
gimp_register_magic_load_handler ("file_xwd_load",
"xwd",
"",
"4,long,0x00000007");
gimp_install_procedure ("file_xwd_save",
"saves files in the XWD file format",
"XWD saving handles all image types except \
@ -252,16 +259,14 @@ those with alpha channels.",
"Peter Kirchgessner",
"Peter Kirchgessner",
"1996",
"<Save>/XWD",
N_("X window image"),
"RGB, GRAY, INDEXED",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_xwd_load",
"xwd",
"",
"4,long,0x00000007");
gimp_plugin_menu_register ("file_xwd_save", "<Save>");
gimp_register_file_handler_mime ("file_xwd_save", "image/x-xwindowdump");
gimp_register_save_handler ("file_xwd_save",
"xwd",
"");

View File

@ -97,13 +97,15 @@ void query (void)
"Jochen Friedrich",
"Jochen Friedrich, Gert Doering, Spencer Kimball & Peter Mattis",
VERSION,
"<Load>/Fax G3",
N_("G3 fax image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_faxg3_load", "<Load>");
gimp_register_file_handler_mime ("file_faxg3_load", "image/g3-fax");
gimp_register_magic_load_handler ("file_faxg3_load",
"g3",
"",

View File

@ -330,32 +330,37 @@ query (void)
"Spencer Kimball, Peter Mattis & others",
"Spencer Kimball & Peter Mattis",
"1995-1999",
"<Load>/Jpeg",
N_("JPEG image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_jpeg_load", "<Load>");
gimp_register_file_handler_mime ("file_jpeg_load", "image/jpeg");
gimp_register_magic_load_handler ("file_jpeg_load",
"jpg,jpeg,jpe",
"",
"6,string,JFIF,6,string,Exif");
gimp_install_procedure ("file_jpeg_save",
"saves files in the JPEG file format",
"saves files in the lossy, widely supported JPEG format",
"Spencer Kimball, Peter Mattis & others",
"Spencer Kimball & Peter Mattis",
"1995-1999",
"<Save>/JPEG",
N_("JPEG image"),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_jpeg_load",
"jpg,jpeg,jpe",
"",
"6,string,JFIF,6,string,Exif");
gimp_register_save_handler ("file_jpeg_save",
"jpg,jpeg,jpe",
"");
gimp_plugin_menu_register ("file_jpeg_save", "<Save>");
gimp_register_file_handler_mime ("file_jpeg_save", "image/jpeg");
gimp_register_save_handler ("file_jpeg_save",
"jpg,jpeg,jpe",
"");
}
static void

View File

@ -330,32 +330,37 @@ query (void)
"Spencer Kimball, Peter Mattis & others",
"Spencer Kimball & Peter Mattis",
"1995-1999",
"<Load>/Jpeg",
N_("JPEG image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_jpeg_load", "<Load>");
gimp_register_file_handler_mime ("file_jpeg_load", "image/jpeg");
gimp_register_magic_load_handler ("file_jpeg_load",
"jpg,jpeg,jpe",
"",
"6,string,JFIF,6,string,Exif");
gimp_install_procedure ("file_jpeg_save",
"saves files in the JPEG file format",
"saves files in the lossy, widely supported JPEG format",
"Spencer Kimball, Peter Mattis & others",
"Spencer Kimball & Peter Mattis",
"1995-1999",
"<Save>/JPEG",
N_("JPEG image"),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_jpeg_load",
"jpg,jpeg,jpe",
"",
"6,string,JFIF,6,string,Exif");
gimp_register_save_handler ("file_jpeg_save",
"jpg,jpeg,jpe",
"");
gimp_plugin_menu_register ("file_jpeg_save", "<Save>");
gimp_register_file_handler_mime ("file_jpeg_save", "image/jpeg");
gimp_register_save_handler ("file_jpeg_save",
"jpg,jpeg,jpe",
"");
}
static void

View File

@ -330,32 +330,37 @@ query (void)
"Spencer Kimball, Peter Mattis & others",
"Spencer Kimball & Peter Mattis",
"1995-1999",
"<Load>/Jpeg",
N_("JPEG image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_jpeg_load", "<Load>");
gimp_register_file_handler_mime ("file_jpeg_load", "image/jpeg");
gimp_register_magic_load_handler ("file_jpeg_load",
"jpg,jpeg,jpe",
"",
"6,string,JFIF,6,string,Exif");
gimp_install_procedure ("file_jpeg_save",
"saves files in the JPEG file format",
"saves files in the lossy, widely supported JPEG format",
"Spencer Kimball, Peter Mattis & others",
"Spencer Kimball & Peter Mattis",
"1995-1999",
"<Save>/JPEG",
N_("JPEG image"),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_jpeg_load",
"jpg,jpeg,jpe",
"",
"6,string,JFIF,6,string,Exif");
gimp_register_save_handler ("file_jpeg_save",
"jpg,jpeg,jpe",
"");
gimp_plugin_menu_register ("file_jpeg_save", "<Save>");
gimp_register_file_handler_mime ("file_jpeg_save", "image/jpeg");
gimp_register_save_handler ("file_jpeg_save",
"jpg,jpeg,jpe",
"");
}
static void

View File

@ -330,32 +330,37 @@ query (void)
"Spencer Kimball, Peter Mattis & others",
"Spencer Kimball & Peter Mattis",
"1995-1999",
"<Load>/Jpeg",
N_("JPEG image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_jpeg_load", "<Load>");
gimp_register_file_handler_mime ("file_jpeg_load", "image/jpeg");
gimp_register_magic_load_handler ("file_jpeg_load",
"jpg,jpeg,jpe",
"",
"6,string,JFIF,6,string,Exif");
gimp_install_procedure ("file_jpeg_save",
"saves files in the JPEG file format",
"saves files in the lossy, widely supported JPEG format",
"Spencer Kimball, Peter Mattis & others",
"Spencer Kimball & Peter Mattis",
"1995-1999",
"<Save>/JPEG",
N_("JPEG image"),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_jpeg_load",
"jpg,jpeg,jpe",
"",
"6,string,JFIF,6,string,Exif");
gimp_register_save_handler ("file_jpeg_save",
"jpg,jpeg,jpe",
"");
gimp_plugin_menu_register ("file_jpeg_save", "<Save>");
gimp_register_file_handler_mime ("file_jpeg_save", "image/jpeg");
gimp_register_save_handler ("file_jpeg_save",
"jpg,jpeg,jpe",
"");
}
static void

View File

@ -330,32 +330,37 @@ query (void)
"Spencer Kimball, Peter Mattis & others",
"Spencer Kimball & Peter Mattis",
"1995-1999",
"<Load>/Jpeg",
N_("JPEG image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_jpeg_load", "<Load>");
gimp_register_file_handler_mime ("file_jpeg_load", "image/jpeg");
gimp_register_magic_load_handler ("file_jpeg_load",
"jpg,jpeg,jpe",
"",
"6,string,JFIF,6,string,Exif");
gimp_install_procedure ("file_jpeg_save",
"saves files in the JPEG file format",
"saves files in the lossy, widely supported JPEG format",
"Spencer Kimball, Peter Mattis & others",
"Spencer Kimball & Peter Mattis",
"1995-1999",
"<Save>/JPEG",
N_("JPEG image"),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_jpeg_load",
"jpg,jpeg,jpe",
"",
"6,string,JFIF,6,string,Exif");
gimp_register_save_handler ("file_jpeg_save",
"jpg,jpeg,jpe",
"");
gimp_plugin_menu_register ("file_jpeg_save", "<Save>");
gimp_register_file_handler_mime ("file_jpeg_save", "image/jpeg");
gimp_register_save_handler ("file_jpeg_save",
"jpg,jpeg,jpe",
"");
}
static void

View File

@ -330,32 +330,37 @@ query (void)
"Spencer Kimball, Peter Mattis & others",
"Spencer Kimball & Peter Mattis",
"1995-1999",
"<Load>/Jpeg",
N_("JPEG image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_jpeg_load", "<Load>");
gimp_register_file_handler_mime ("file_jpeg_load", "image/jpeg");
gimp_register_magic_load_handler ("file_jpeg_load",
"jpg,jpeg,jpe",
"",
"6,string,JFIF,6,string,Exif");
gimp_install_procedure ("file_jpeg_save",
"saves files in the JPEG file format",
"saves files in the lossy, widely supported JPEG format",
"Spencer Kimball, Peter Mattis & others",
"Spencer Kimball & Peter Mattis",
"1995-1999",
"<Save>/JPEG",
N_("JPEG image"),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_jpeg_load",
"jpg,jpeg,jpe",
"",
"6,string,JFIF,6,string,Exif");
gimp_register_save_handler ("file_jpeg_save",
"jpg,jpeg,jpe",
"");
gimp_plugin_menu_register ("file_jpeg_save", "<Save>");
gimp_register_file_handler_mime ("file_jpeg_save", "image/jpeg");
gimp_register_save_handler ("file_jpeg_save",
"jpg,jpeg,jpe",
"");
}
static void

View File

@ -88,32 +88,37 @@ query (void)
"Christian Kreibich <christian@whoop.org>",
"Christian Kreibich <christian@whoop.org>",
"2002",
N_("<Load>/ICO"),
N_("Microsoft Windows icon"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_ico_load", "<Load>");
gimp_register_file_handler_mime ("file_ico_load", "image/x-ico");
gimp_register_magic_load_handler ("file_ico_load",
"ico",
"",
"0,string,\\000\\001\\000\\000,0,string,\\000\\002\\000\\000");
gimp_install_procedure ("file_ico_save",
"Saves files in Windows ICO file format",
"Saves files in Windows ICO file format",
"Christian Kreibich <christian@whoop.org>",
"Christian Kreibich <christian@whoop.org>",
"2002",
N_("<Save>/ICO"),
N_("Microsoft Windows icon"),
"INDEXEDA, GRAYA, RGBA",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_ico_load",
"ico,wico",
"",
"0,string,\\000\\001\\000\\000,0,string,\\000\\002\\000\\000");
gimp_register_save_handler ("file_ico_save",
"ico,wico",
"");
gimp_plugin_menu_register ("file_ico_save", "<Save>");
gimp_register_file_handler_mime ("file_ico_save", "image/x-ico");
gimp_register_save_handler ("file_ico_save",
"ico",
"");
}

View File

@ -407,7 +407,8 @@ HELP
goto done;
}
file_proc = plug_ins_file_handler (gimp, name, extensions, prefixes, magics);
file_proc = plug_ins_file_register_magic (gimp, name,
extensions, prefixes, magics);
if (! file_proc)
{
@ -480,7 +481,8 @@ HELP
goto done;
}
file_proc = plug_ins_file_handler (gimp, name, extensions, prefixes, NULL);
file_proc = plug_ins_file_register_magic (gimp, name,
extensions, prefixes, NULL);
if (! file_proc)
{
@ -500,6 +502,35 @@ CODE
);
}
sub register_file_handler_mime {
$blurb = 'Associates a MIME type 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.
HELP
$author = $copyright = 'Sven Neumann';
$date = '2004';
$since = '2.2';
@inargs = (
{ name => 'procedure_name', type => 'string', alias => 'name',
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\"." }
);
%invoke = (
code => <<'CODE'
{
success = (plug_ins_file_register_mime (gimp, name, mime_type) != NULL);
}
CODE
);
}
@headers = qw(<sys/types.h> <unistd.h> <gdk-pixbuf/gdk-pixbuf.h>
"libgimpthumb/gimpthumb.h" "base/temp-buf.h"
"core/gimp.h" "core/gimpimagefile.h"
@ -508,8 +539,8 @@ CODE
@procs = qw(file_load file_save file_load_thumbnail file_save_thumbnail
temp_name register_magic_load_handler register_load_handler
register_save_handler);
%exports = (app => [@procs], lib => [@procs[0,1,4..7]]);
register_save_handler register_file_handler_mime);
%exports = (app => [@procs], lib => [@procs[0,1,4..8]]);
$desc = 'File Operations';