Procedure


Description:

[ CCode ( has_construct_function = false ) ]
[ Version ( since = "3.0" ) ]
public Procedure (PlugIn plug_in, string name, PDBProcType proc_type, owned RunFunc run_func)

Creates a new procedure named name which will call run_func when invoked.

The name parameter is mandatory and should be unique, or it will overwrite an already existing procedure (overwrite procedures only if you know what you're doing).

proc_type should be [enum@Gimp.PDBProcType.PLUGIN] for "normal" plug-ins.

Using [enum@Gimp.PDBProcType.PERSISTENT] means that the plug-in will add temporary procedures. Therefore, the GIMP core will wait until the gimp_pdb_proc_type_persistent procedure has called [method@Procedure.persistent_ready], which means that the procedure has done its initialization, installed its temporary procedures and is ready to run.

*Not calling [method@Procedure.persistent_ready] from a gimp_pdb_proc_type_persistent procedure will cause the GIMP core to lock up.*

Additionally, a gimp_pdb_proc_type_persistent procedure with no arguments added is an "automatic" extension that will be automatically started on each GIMP startup.

[enum@Gimp.PDBProcType.TEMPORARY] must be used for temporary procedures that are created during a plug-ins lifetime. They must be added to the PlugIn using [method@PlugIn.add_temp_procedure].

run_func is called via [method@Procedure.run].

For gimp_pdb_proc_type_plugin and gimp_pdb_proc_type_persistent procedures the call of run_func is basically the lifetime of the plug-in.

Parameters:

plug_in

a PlugIn.

name

the new procedure's name.

proc_type

the new procedure's PDBProcType.

run_func

the run function for the new procedure.

run_data

user data passed to run_func.

run_data_destroy

free function for run_data, or null.

Returns:

a new Procedure.