mirror of https://github.com/GNOME/gimp.git
pdb, libgimp: add gimp_load_procedure_set_thumbnail_loader()
and move the old API to gimplegacy.[ch]
This commit is contained in:
parent
84629cc1d0
commit
fc065f8add
|
@ -569,9 +569,11 @@ EXPORTS
|
|||
gimp_layer_set_opacity
|
||||
gimp_layer_set_show_mask
|
||||
gimp_load_procedure_get_handles_raw
|
||||
gimp_load_procedure_get_thumbnail_loader
|
||||
gimp_load_procedure_get_type
|
||||
gimp_load_procedure_new
|
||||
gimp_load_procedure_set_handles_raw
|
||||
gimp_load_procedure_set_thumbnail_loader
|
||||
gimp_main
|
||||
gimp_main_legacy
|
||||
gimp_message
|
||||
|
|
|
@ -616,7 +616,7 @@ _gimp_register_file_handler_raw (const gchar *procedure_name)
|
|||
}
|
||||
|
||||
/**
|
||||
* gimp_register_thumbnail_loader:
|
||||
* _gimp_register_thumbnail_loader:
|
||||
* @load_proc: The name of the procedure the thumbnail loader with.
|
||||
* @thumb_proc: The name of the thumbnail load procedure.
|
||||
*
|
||||
|
@ -634,7 +634,7 @@ _gimp_register_file_handler_raw (const gchar *procedure_name)
|
|||
* Since: 2.2
|
||||
**/
|
||||
gboolean
|
||||
gimp_register_thumbnail_loader (const gchar *load_proc,
|
||||
_gimp_register_thumbnail_loader (const gchar *load_proc,
|
||||
const gchar *thumb_proc)
|
||||
{
|
||||
GimpPDB *pdb = gimp_get_pdb ();
|
||||
|
|
|
@ -65,7 +65,7 @@ G_GNUC_INTERNAL gboolean _gimp_register_file_handler_mime (const gchar *proc
|
|||
const gchar *mime_types);
|
||||
G_GNUC_INTERNAL gboolean _gimp_register_file_handler_uri (const gchar *procedure_name);
|
||||
G_GNUC_INTERNAL gboolean _gimp_register_file_handler_raw (const gchar *procedure_name);
|
||||
gboolean gimp_register_thumbnail_loader (const gchar *load_proc,
|
||||
G_GNUC_INTERNAL gboolean _gimp_register_thumbnail_loader (const gchar *load_proc,
|
||||
const gchar *thumb_proc);
|
||||
|
||||
|
||||
|
|
|
@ -1396,6 +1396,33 @@ gimp_register_file_handler_raw (const gchar *procedure_name)
|
|||
return _gimp_register_file_handler_raw (procedure_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_register_thumbnail_loader:
|
||||
* @load_proc: The name of the procedure the thumbnail loader with.
|
||||
* @thumb_proc: The name of the thumbnail load procedure.
|
||||
*
|
||||
* Associates a thumbnail loader with a file load procedure.
|
||||
*
|
||||
* Some file formats allow for embedded thumbnails, other file formats
|
||||
* contain a scalable image or provide the image data in different
|
||||
* resolutions. A file plug-in for such a format may register a special
|
||||
* procedure that allows GIMP to load a thumbnail preview of the image.
|
||||
* This procedure is then associated with the standard load procedure
|
||||
* using this function.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
gboolean
|
||||
gimp_register_thumbnail_loader (const gchar *load_proc,
|
||||
const gchar *thumb_proc)
|
||||
{
|
||||
ASSERT_NO_PLUG_IN_EXISTS (G_STRFUNC);
|
||||
|
||||
return _gimp_register_thumbnail_loader (load_proc, thumb_proc);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_pdb_temp_name:
|
||||
*
|
||||
|
|
|
@ -328,6 +328,8 @@ 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);
|
||||
|
||||
/* pdb stuff that should now be done using GimpPDB
|
||||
*/
|
||||
|
|
|
@ -34,6 +34,7 @@ struct _GimpLoadProcedurePrivate
|
|||
GDestroyNotify run_data_destroy;
|
||||
|
||||
gboolean handles_raw;
|
||||
gchar *thumbnail_proc;
|
||||
};
|
||||
|
||||
|
||||
|
@ -111,6 +112,8 @@ gimp_load_procedure_finalize (GObject *object)
|
|||
if (procedure->priv->run_data_destroy)
|
||||
procedure->priv->run_data_destroy (procedure->priv->run_data);
|
||||
|
||||
g_clear_pointer (&procedure->priv->thumbnail_proc, g_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -153,6 +156,10 @@ gimp_load_procedure_install (GimpProcedure *procedure)
|
|||
|
||||
if (load_proc->priv->handles_raw)
|
||||
_gimp_register_file_handler_raw (gimp_procedure_get_name (procedure));
|
||||
|
||||
if (load_proc->priv->thumbnail_proc)
|
||||
_gimp_register_thumbnail_loader (gimp_procedure_get_name (procedure),
|
||||
load_proc->priv->thumbnail_proc);
|
||||
}
|
||||
|
||||
static GimpValueArray *
|
||||
|
@ -260,3 +267,46 @@ gimp_load_procedure_get_handles_raw (GimpLoadProcedure *procedure)
|
|||
|
||||
return procedure->priv->handles_raw;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_load_procedure_set_thumbnail_loader:
|
||||
* @procedure: A #GimpLoadProcedure.
|
||||
* @thumbnail_proc: The name of the thumbnail load procedure.
|
||||
*
|
||||
* Associates a thumbnail loader with a file load procedure.
|
||||
*
|
||||
* Some file formats allow for embedded thumbnails, other file formats
|
||||
* contain a scalable image or provide the image data in different
|
||||
* resolutions. A file plug-in for such a format may register a
|
||||
* special procedure that allows GIMP to load a thumbnail preview of
|
||||
* the image. This procedure is then associated with the standard
|
||||
* load procedure using this function.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gimp_load_procedure_set_thumbnail_loader (GimpLoadProcedure *procedure,
|
||||
const gchar *thumbnail_proc)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_LOAD_PROCEDURE (procedure));
|
||||
|
||||
g_free (procedure->priv->thumbnail_proc);
|
||||
procedure->priv->thumbnail_proc = g_strdup (thumbnail_proc);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_load_procedure_get_thumbnail_loader:
|
||||
* @procedure: A #GimpLoadProcedure.
|
||||
*
|
||||
* Returns: The procedure's thumbnail loader procedure as set with
|
||||
* gimp_load_procedure_set_thumbnail_procedure().
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
const gchar *
|
||||
gimp_load_procedure_get_thumbnail_loader (GimpLoadProcedure *procedure)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_LOAD_PROCEDURE (procedure), NULL);
|
||||
|
||||
return procedure->priv->thumbnail_proc;
|
||||
}
|
||||
|
|
|
@ -89,6 +89,10 @@ void gimp_load_procedure_set_handles_raw (GimpLoadProcedure *procedur
|
|||
gboolean handles_raw);
|
||||
gboolean gimp_load_procedure_get_handles_raw (GimpLoadProcedure *procedure);
|
||||
|
||||
void gimp_load_procedure_set_thumbnail_loader (GimpLoadProcedure *procedure,
|
||||
const gchar *thumbnail_proc);
|
||||
const gchar * gimp_load_procedure_get_thumbnail_loader (GimpLoadProcedure *procedure);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -712,6 +712,8 @@ HELP
|
|||
|
||||
&neo_pdb_misc('2004', '2.2');
|
||||
|
||||
$lib_private = 1;
|
||||
|
||||
@inargs = (
|
||||
{ name => 'load_proc', type => 'string', non_empty => 1,
|
||||
desc => "The name of the procedure the thumbnail loader with." },
|
||||
|
|
Loading…
Reference in New Issue