Commit b4ac9568 authored by Ell's avatar Ell

app, pdb: add gimp-register-file-handler-priority procedure

Add a gimp-register-file-handler-priority procedure, which can be
used to set the priority of a file-handler procedure.  When more
than one file-handler procedure matches a file, the procedure with
the lowest priority is used; if more than one procedure has the
lowest priority, it is unspecified which one of them is used.  The
default priority of file-handler procedures is 0.

Add the necessary plumbing (plus some fixes) to the plug-in manager
to handle file-handler priorities.  In particular, use two
different lists for each type of file-handler procedures: one meant
for searching, and is sorted according to priority, and one meant
for display, and is sorted alphabetically.
parent e707e55f
......@@ -1521,7 +1521,7 @@ prefs_dialog_new (Gimp *gimp,
gtk_box_pack_start (GTK_BOX (vbox2), scrolled_window, TRUE, TRUE, 0);
gtk_widget_show (scrolled_window);
view = gimp_plug_in_view_new (gimp->plug_in_manager->raw_load_procs);
view = gimp_plug_in_view_new (gimp->plug_in_manager->display_raw_load_procs);
gimp_plug_in_view_set_plug_in (GIMP_PLUG_IN_VIEW (view),
core_config->import_raw_plug_in);
gtk_container_add (GTK_CONTAINER (scrolled_window), view);
......
......@@ -505,6 +505,35 @@ register_save_handler_invoker (GimpProcedure *procedure,
error ? *error : NULL);
}
static GimpValueArray *
register_file_handler_priority_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
const gchar *procedure_name;
gint32 priority;
procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
priority = g_value_get_int (gimp_value_array_index (args, 1));
if (success)
{
gchar *canonical = gimp_canonicalize_identifier (procedure_name);
success = gimp_plug_in_manager_register_priority (gimp->plug_in_manager,
canonical, priority);
g_free (canonical);
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GimpValueArray *
register_file_handler_mime_invoker (GimpProcedure *procedure,
Gimp *gimp,
......@@ -1013,6 +1042,36 @@ register_fileops_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-register-file-handler-priority
*/
procedure = gimp_procedure_new (register_file_handler_priority_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-register-file-handler-priority");
gimp_procedure_set_static_strings (procedure,
"gimp-register-file-handler-priority",
"Sets the priority of a file handler procedure.",
"Sets the priority of a file handler procedure. When more than one procedure matches a given file, the procedure with the lowest priority is used; if more than one procedure has the lowest priority, it is unspecified which one of them is used. The default priority for file handler procedures is 0.",
"Ell",
"Ell",
"2018",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("procedure-name",
"procedure name",
"The name of the procedure to set the priority of.",
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("priority",
"priority",
"The procedure priority.",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-register-file-handler-mime
*/
......
......@@ -28,7 +28,7 @@
#include "internal-procs.h"
/* 734 procedures registered total */
/* 735 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
......
......@@ -157,6 +157,32 @@ gimp_plug_in_manager_register_save_handler (GimpPlugInManager *manager,
return TRUE;
}
gboolean
gimp_plug_in_manager_register_priority (GimpPlugInManager *manager,
const gchar *name,
gint priority)
{
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);
if (manager->current_plug_in && manager->current_plug_in->plug_in_def)
list = manager->current_plug_in->plug_in_def->procedures;
else
list = manager->plug_in_procedures;
file_proc = gimp_plug_in_procedure_find (list, name);
if (! file_proc)
return FALSE;
gimp_plug_in_procedure_set_priority (file_proc, priority);
return TRUE;
}
gboolean
gimp_plug_in_manager_register_mime_types (GimpPlugInManager *manager,
const gchar *name,
......@@ -273,13 +299,13 @@ gimp_plug_in_manager_get_file_procedures (GimpPlugInManager *manager,
return NULL;
case GIMP_FILE_PROCEDURE_GROUP_OPEN:
return manager->load_procs;
return manager->display_load_procs;
case GIMP_FILE_PROCEDURE_GROUP_SAVE:
return manager->save_procs;
return manager->display_save_procs;
case GIMP_FILE_PROCEDURE_GROUP_EXPORT:
return manager->export_procs;
return manager->display_export_procs;
default:
g_return_val_if_reached (NULL);
......
......@@ -31,6 +31,11 @@ gboolean gimp_plug_in_manager_register_save_handler (GimpPlugInManager *manage
const gchar *extensions,
const gchar *prefixes);
gboolean gimp_plug_in_manager_register_priority (GimpPlugInManager *manager,
const gchar *name,
gint priority);
gboolean gimp_plug_in_manager_register_mime_types (GimpPlugInManager *manager,
const gchar *name,
const gchar *mime_types);
......
......@@ -903,14 +903,40 @@ gimp_plug_in_manager_sort_file_procs (GimpPlugInManager *manager)
manager->load_procs =
g_slist_sort_with_data (manager->load_procs,
gimp_plug_in_manager_file_proc_compare, manager);
gimp_plug_in_manager_file_proc_compare,
GINT_TO_POINTER (FALSE));
manager->save_procs =
g_slist_sort_with_data (manager->save_procs,
gimp_plug_in_manager_file_proc_compare, manager);
gimp_plug_in_manager_file_proc_compare,
GINT_TO_POINTER (FALSE));
manager->export_procs =
g_slist_sort_with_data (manager->export_procs,
gimp_plug_in_manager_file_proc_compare, manager);
gimp_plug_in_manager_file_proc_compare,
GINT_TO_POINTER (FALSE));
g_clear_pointer (&manager->display_load_procs, g_slist_free);
g_clear_pointer (&manager->display_save_procs, g_slist_free);
g_clear_pointer (&manager->display_export_procs, g_slist_free);
manager->display_load_procs = g_slist_copy (manager->load_procs);
manager->display_save_procs = g_slist_copy (manager->save_procs);
manager->display_export_procs = g_slist_copy (manager->export_procs);
manager->display_load_procs =
g_slist_sort_with_data (manager->display_load_procs,
gimp_plug_in_manager_file_proc_compare,
GINT_TO_POINTER (TRUE));
manager->display_save_procs =
g_slist_sort_with_data (manager->display_save_procs,
gimp_plug_in_manager_file_proc_compare,
GINT_TO_POINTER (TRUE));
manager->display_export_procs =
g_slist_sort_with_data (manager->display_export_procs,
gimp_plug_in_manager_file_proc_compare,
GINT_TO_POINTER (TRUE));
g_clear_pointer (&manager->raw_load_procs, g_slist_free);
g_clear_pointer (&manager->display_raw_load_procs, g_slist_free);
if (config->import_raw_plug_in)
{
......@@ -932,8 +958,8 @@ gimp_plug_in_manager_sort_file_procs (GimpPlugInManager *manager)
{
GFile *file;
manager->raw_load_procs = g_slist_append (manager->raw_load_procs,
file_proc);
manager->raw_load_procs = g_slist_prepend (manager->raw_load_procs,
file_proc);
file = gimp_plug_in_procedure_get_file (file_proc);
......@@ -946,6 +972,13 @@ gimp_plug_in_manager_sort_file_procs (GimpPlugInManager *manager)
}
}
manager->raw_load_procs = g_slist_reverse (manager->raw_load_procs);
manager->display_raw_load_procs = g_slist_copy (manager->raw_load_procs);
manager->display_raw_load_procs =
g_slist_sort_with_data (manager->display_raw_load_procs,
gimp_plug_in_manager_file_proc_compare,
GINT_TO_POINTER (TRUE));
if (config_plug_in)
g_object_unref (config_plug_in);
......@@ -1003,8 +1036,10 @@ gimp_plug_in_manager_sort_file_procs (GimpPlugInManager *manager)
! g_file_equal (gimp_plug_in_procedure_get_file (file_proc),
raw_plug_in))
{
manager->load_procs = g_slist_remove (manager->load_procs,
file_proc);
manager->load_procs =
g_slist_remove (manager->load_procs, file_proc);
manager->display_load_procs =
g_slist_remove (manager->display_load_procs, file_proc);
}
}
}
......@@ -1014,23 +1049,49 @@ gimp_plug_in_manager_file_proc_compare (gconstpointer a,
gconstpointer b,
gpointer data)
{
GimpPlugInProcedure *proc_a = GIMP_PLUG_IN_PROCEDURE (a);
GimpPlugInProcedure *proc_b = GIMP_PLUG_IN_PROCEDURE (b);
GimpPlugInProcedure *proc_a = GIMP_PLUG_IN_PROCEDURE (a);
GimpPlugInProcedure *proc_b = GIMP_PLUG_IN_PROCEDURE (b);
gboolean display = GPOINTER_TO_INT (data);
const gchar *label_a;
const gchar *label_b;
gint retval = 0;
gint retval = 0;
if (g_str_has_prefix (gimp_file_get_utf8_name (proc_a->file), "gimp-xcf"))
return -1;
if (g_str_has_prefix (gimp_file_get_utf8_name (proc_a->file),
"gimp-xcf"))
{
if (! g_str_has_prefix (gimp_file_get_utf8_name (proc_b->file),
"gimp-xcf"))
{
return -1;
}
}
else if (g_str_has_prefix (gimp_file_get_utf8_name (proc_b->file),
"gimp-xcf"))
{
return 1;
}
if (g_str_has_prefix (gimp_file_get_utf8_name (proc_b->file), "gimp-xcf"))
return 1;
if (! display && proc_a->priority != proc_b->priority)
return proc_a->priority - proc_b->priority;
label_a = gimp_procedure_get_label (GIMP_PROCEDURE (proc_a));
label_b = gimp_procedure_get_label (GIMP_PROCEDURE (proc_b));
if (label_a && label_b)
retval = g_utf8_collate (label_a, label_b);
if (label_a)
{
if (label_b)
retval = g_utf8_collate (label_a, label_b);
else
return -1;
}
else if (label_b)
{
return 1;
}
else
{
retval = (proc_b < proc_a) - (proc_a < proc_b);
}
return retval;
}
......@@ -137,6 +137,11 @@ gimp_plug_in_manager_finalize (GObject *object)
g_clear_pointer (&manager->export_procs, g_slist_free);
g_clear_pointer (&manager->raw_load_procs, g_slist_free);
g_clear_pointer (&manager->display_load_procs, g_slist_free);
g_clear_pointer (&manager->display_save_procs, g_slist_free);
g_clear_pointer (&manager->display_export_procs, g_slist_free);
g_clear_pointer (&manager->display_raw_load_procs, g_slist_free);
if (manager->plug_in_procedures)
{
g_slist_free_full (manager->plug_in_procedures,
......@@ -180,6 +185,11 @@ gimp_plug_in_manager_get_memsize (GimpObject *object,
memsize += gimp_g_slist_get_memsize (manager->load_procs, 0);
memsize += gimp_g_slist_get_memsize (manager->save_procs, 0);
memsize += gimp_g_slist_get_memsize (manager->export_procs, 0);
memsize += gimp_g_slist_get_memsize (manager->raw_load_procs, 0);
memsize += gimp_g_slist_get_memsize (manager->display_load_procs, 0);
memsize += gimp_g_slist_get_memsize (manager->display_save_procs, 0);
memsize += gimp_g_slist_get_memsize (manager->display_export_procs, 0);
memsize += gimp_g_slist_get_memsize (manager->display_raw_load_procs, 0);
memsize += gimp_g_slist_get_memsize (manager->menu_branches, 0 /* FIXME */);
memsize += gimp_g_slist_get_memsize (manager->locale_domains, 0 /* FIXME */);
......@@ -304,9 +314,14 @@ gimp_plug_in_manager_add_procedure (GimpPlugInManager *manager,
}
/* also remove it from the lists of load, save and export procs */
manager->load_procs = g_slist_remove (manager->load_procs, tmp_proc);
manager->save_procs = g_slist_remove (manager->save_procs, tmp_proc);
manager->export_procs = g_slist_remove (manager->export_procs, tmp_proc);
manager->load_procs = g_slist_remove (manager->load_procs, tmp_proc);
manager->save_procs = g_slist_remove (manager->save_procs, tmp_proc);
manager->export_procs = g_slist_remove (manager->export_procs, tmp_proc);
manager->raw_load_procs = g_slist_remove (manager->raw_load_procs, tmp_proc);
manager->display_load_procs = g_slist_remove (manager->display_load_procs, tmp_proc);
manager->display_save_procs = g_slist_remove (manager->display_save_procs, tmp_proc);
manager->display_export_procs = g_slist_remove (manager->display_export_procs, tmp_proc);
manager->display_raw_load_procs = g_slist_remove (manager->display_raw_load_procs, tmp_proc);
/* and from the history */
gimp_filter_history_remove (manager->gimp, GIMP_PROCEDURE (tmp_proc));
......
......@@ -49,6 +49,11 @@ struct _GimpPlugInManager
GSList *export_procs;
GSList *raw_load_procs;
GSList *display_load_procs;
GSList *display_save_procs;
GSList *display_export_procs;
GSList *display_raw_load_procs;
GSList *menu_branches;
GSList *locale_domains;
GSList *help_domains;
......
......@@ -1162,6 +1162,15 @@ gimp_plug_in_procedure_set_file_proc (GimpPlugInProcedure *proc,
proc->magics_list = extensions_parse (proc->magics);
}
void
gimp_plug_in_procedure_set_priority (GimpPlugInProcedure *proc,
gint priority)
{
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc));
proc->priority = priority;
}
void
gimp_plug_in_procedure_set_mime_types (GimpPlugInProcedure *proc,
const gchar *mime_types)
......
......@@ -60,6 +60,7 @@ struct _GimpPlugInProcedure
gchar *extensions;
gchar *prefixes;
gchar *magics;
gint priority;
gchar *mime_types;
gboolean handles_uri;
gboolean handles_raw;
......@@ -120,6 +121,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_priority (GimpPlugInProcedure *proc,
gint priority);
void gimp_plug_in_procedure_set_mime_types (GimpPlugInProcedure *proc,
const gchar *mime_ypes);
void gimp_plug_in_procedure_set_handles_uri (GimpPlugInProcedure *proc);
......
......@@ -91,6 +91,7 @@ enum
EXTENSIONS,
PREFIXES,
MAGICS,
PRIORITY,
MIME_TYPES,
HANDLES_URI,
HANDLES_RAW,
......@@ -155,6 +156,8 @@ plug_in_rc_parse (Gimp *gimp,
"prefixes", GINT_TO_POINTER (PREFIXES));
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
"magics", GINT_TO_POINTER (MAGICS));
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
"priority", GINT_TO_POINTER (PRIORITY));
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
"mime-types", GINT_TO_POINTER (MIME_TYPES));
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
......@@ -168,6 +171,8 @@ plug_in_rc_parse (Gimp *gimp,
"extensions", GINT_TO_POINTER (EXTENSIONS));
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
"prefixes", GINT_TO_POINTER (PREFIXES));
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
"priority", GINT_TO_POINTER (PRIORITY));
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
"mime-types", GINT_TO_POINTER (MIME_TYPES));
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
......@@ -603,9 +608,8 @@ static GTokenType
plug_in_file_proc_deserialize (GScanner *scanner,
GimpPlugInProcedure *proc)
{
GTokenType token;
gint symbol;
gchar *value;
GTokenType token;
gint symbol;
if (! gimp_scanner_parse_token (scanner, G_TOKEN_LEFT_PAREN))
return G_TOKEN_LEFT_PAREN;
......@@ -633,38 +637,66 @@ plug_in_file_proc_deserialize (GScanner *scanner,
symbol = GPOINTER_TO_INT (scanner->value.v_symbol);
if (symbol == MAGICS)
{
if (! gimp_scanner_parse_string_no_validate (scanner, &value))
return G_TOKEN_STRING;
}
else if (symbol != HANDLES_URI &&
symbol != HANDLES_RAW)
{
if (! gimp_scanner_parse_string (scanner, &value))
return G_TOKEN_STRING;
}
switch (symbol)
{
case EXTENSIONS:
g_free (proc->extensions);
proc->extensions = value;
{
gchar *extensions;
if (! gimp_scanner_parse_string (scanner, &extensions))
return G_TOKEN_STRING;
g_free (proc->extensions);
proc->extensions = extensions;
}
break;
case PREFIXES:
g_free (proc->prefixes);
proc->prefixes = value;
{
gchar *prefixes;
if (! gimp_scanner_parse_string (scanner, &prefixes))
return G_TOKEN_STRING;
g_free (proc->prefixes);
proc->extensions = prefixes;
}
break;
case MAGICS:
g_free (proc->magics);
proc->magics = value;
{
gchar *magics;
if (! gimp_scanner_parse_string_no_validate (scanner, &magics))
return G_TOKEN_STRING;
g_free (proc->magics);
proc->magics = magics;
}
break;
case PRIORITY:
{
gint priority;
if (! gimp_scanner_parse_int (scanner, &priority))
return G_TOKEN_INT;
gimp_plug_in_procedure_set_priority (proc, priority);
}
break;
case MIME_TYPES:
gimp_plug_in_procedure_set_mime_types (proc, value);
g_free (value);
{
gchar *mime_types;
if (! gimp_scanner_parse_string (scanner, &mime_types))
return G_TOKEN_STRING;
gimp_plug_in_procedure_set_mime_types (proc, mime_types);
g_free (mime_types);
}
break;
case HANDLES_URI:
......@@ -676,8 +708,16 @@ plug_in_file_proc_deserialize (GScanner *scanner,
break;
case THUMB_LOADER:
gimp_plug_in_procedure_set_thumb_loader (proc, value);
g_free (value);
{
gchar *thumb_loader;
if (! gimp_scanner_parse_string (scanner, &thumb_loader))
return G_TOKEN_STRING;
gimp_plug_in_procedure_set_thumb_loader (proc, thumb_loader);
g_free (thumb_loader);
}
break;
default:
......@@ -961,6 +1001,13 @@ plug_in_rc_write (GSList *plug_in_defs,
gimp_config_writer_close (writer);
}
if (proc->priority)
{
gimp_config_writer_open (writer, "priority");
gimp_config_writer_printf (writer, "%d", proc->priority);
gimp_config_writer_close (writer);
}
if (proc->mime_types && *proc->mime_types)
{
gimp_config_writer_open (writer, "mime-types");
......@@ -968,6 +1015,13 @@ plug_in_rc_write (GSList *plug_in_defs,
gimp_config_writer_close (writer);
}
if (proc->priority)
{
gimp_config_writer_open (writer, "priority");
gimp_config_writer_printf (writer, "%d", proc->priority);
gimp_config_writer_close (writer);
}
if (proc->handles_uri)
{
gimp_config_writer_open (writer, "handles-uri");
......
......@@ -166,6 +166,10 @@
<title>Index of new symbols in GIMP 2.10.4</title>
<xi:include href="xml/api-index-2.10.4.xml"><xi:fallback /></xi:include>
</index>
<index role="2.10.6" id="api-index-2-10-6">
<title>Index of new symbols in GIMP 2.10.6</title>
<xi:include href="xml/api-index-2.10.6.xml"><xi:fallback /></xi:include>
</index>
<index role="deprecated" id="api-index-deprecated">
<title>Index of deprecated symbols</title>
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
......
......@@ -507,6 +507,7 @@ gimp_file_save_thumbnail
gimp_register_magic_load_handler
gimp_register_load_handler
gimp_register_save_handler
gimp_register_file_handler_priority
gimp_register_file_handler_mime
gimp_register_file_handler_uri
gimp_register_file_handler_raw
......
......@@ -642,6 +642,7 @@ EXPORTS
gimp_quit
gimp_read_expect_msg
gimp_register_file_handler_mime
gimp_register_file_handler_priority
gimp_register_file_handler_raw
gimp_register_file_handler_uri
gimp_register_load_handler
......
......@@ -365,6 +365,44 @@ gimp_register_save_handler (const gchar *procedure_name,
return success;
}
/**
* gimp_register_file_handler_priority:
* @procedure_name: The name of the procedure to set the priority of.
* @priority: The procedure priority.
*
* Sets the priority of a file handler procedure.
*
* Sets the priority of a file handler procedure. When more than one
* procedure matches a given file, the procedure with the lowest
* priority is used; if more than one procedure has the lowest
* priority, it is unspecified which one of them is used. The default
* priority for file handler procedures is 0.
*
* Returns: TRUE on success.
*
* Since: 2.10.6
**/
gboolean
gimp_register_file_handler_priority (const gchar *procedure_name,
gint priority)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-register-file-handler-priority",
&nreturn_vals,
GIMP_PDB_STRING, procedure_name,
GIMP_PDB_INT32, priority,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_register_file_handler_mime:
* @procedure_name: The name of the procedure to associate a MIME type with.
......
......@@ -32,39 +32,41 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gint32 gimp_file_load (GimpRunMode run_mode,
const gchar *filename,
const gchar *raw_filename);
gint32 gimp_file_load_layer (GimpRunMode run_mode,
gint32 image_ID,
const gchar *filename);
gint* gimp_file_load_layers (GimpRunMode run_mode,
gint32 image_ID,
const gchar *filename,
gint *num_layers);
gboolean gimp_file_save (GimpRunMode run_mode,
gint32 image_ID,
gint32 drawable_ID,
const gchar *filename,
const gchar *raw_filename);
gboolean gimp_file_save_thumbnail (gint32 image_ID,
const gchar *filename);
gboolean gimp_register_magic_load_handler (const gchar *procedure_name,
const gchar *extensions,
const gchar *prefixes,
const gchar *magics);
gboolean gimp_register_load_handler (const gchar *procedure_name,
const gchar *extensions,
const gchar *prefixes);
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_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,
const gchar *thumb_proc);
gint32 gimp_file_load (GimpRunMode run_mode,
const gchar *filename,
const gchar *raw_filename);
gint32 gimp_file_load_layer (GimpRunMode run_mode,
gint32 image_ID,
const gchar *filename);
gint* gimp_file_load_layers (GimpRunMode run_mode,
gint32 image_ID,
const gchar *filename,
gint *num_layers);
gboolean gimp_file_save (GimpRunMode run_mode,
gint32 image_ID,
gint32 drawable_ID,
const gchar *filename,
const gchar *raw_filename);
gboolean gimp_file_save_thumbnail (gint32 image_ID,
const gchar *filename);
gboolean gimp_register_magic_load_handler (const gchar *procedure_name,
const gchar *extensions,
const gchar *prefixes,
const gchar *magics);
gboolean gimp_register_load_handler (const gchar *procedure_name,
const gchar *extensions,
const gchar *prefixes);
gboolean gimp_register_save_handler (const gchar *procedure_name,
const gchar *extensions,
const gchar *prefixes);
gboolean gimp_register_file_handler_priority (const gchar *procedure_name,
gint priority);
gboolean gimp_register_file_handler_mime (const gchar *procedure_name,
const gchar *mime_types);
gboolean gimp_register_file_handler_uri (const gchar *procedure_name);
gboolean gimp_register_file_handler_raw (const gchar *procedure_name);
gboolean gimp_register_thumbnail_loader (const gchar *load_proc,
const gchar *thumb_proc);
G_END_DECLS
......
......@@ -555,6 +555,40 @@ CODE
);
}
sub register_file_handler_priority {
$blurb = 'Sets the priority of a file handler procedure.';
$help = <<'HELP';
Sets the priority of a file handler procedure. When more than one
procedure matches a given file, the procedure with the lowest priority
is used; if more than one procedure has the lowest priority, it is
unspecified which one of them is used. The default priority for file
handler procedures is 0.
HELP
&ell_pdb_misc('2018', '2.10.6');
@inargs = (
{ name => 'procedure_name', type => 'string', non_empty => 1,
desc => "The name of the procedure to set the priority of." },
{ name => 'priority', type => 'int32',
desc => "The procedure priority." }
);