Gimp.Procedure.new
Description: Reference for Gimp.Procedure.new

### Constructor

# Gimp Procedurenew

since: 3.0

#### Declaration [src]

    GimpProcedure*
    gimp_procedure_new (
      GimpPlugIn* plug_in,
      const gchar* name,
      GimpPDBProcType proc_type,
      GimpRunFunc run_func,
      gpointer run_data,
      GDestroyNotify run_data_destroy
    )

#### Description [src]

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 `GIMP_PDB_PROC_TYPE_PLUGIN` for “normal” plug-ins.

Using `GIMP_PDB_PROC_TYPE_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 `gimp_procedure_persistent_ready()`, which means that the procedure has done its initialization, installed its temporary procedures and is ready to run.

Not calling `gimp_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.

`GIMP_PDB_PROC_TYPE_TEMPORARY` must be used for temporary procedures that are created during a plug-ins lifetime. They must be added to the `GimpPlugIn` using `gimp_plug_in_add_temp_procedure()`.

`run_func` is called via `gimp_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.

Available since: 3.0

#### Parameters

`plug_in`

  Type: `GimpPlugIn`

  A `GimpPlugIn`.

  The data is owned by the caller of the function.

`name`

  Type: `const gchar*`

  The new procedure’s name.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`proc_type`

  Type: `GimpPDBProcType`

  The new procedure’s `GimpPDBProcType`.

`run_func`

  Type: `GimpRunFunc`

  The run function for the new procedure.

`run_data`

  Type: `gpointer`

  User data passed to `run_func`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`run_data_destroy`

  Type: `GDestroyNotify`

  Free function for `run_data`, or `NULL`.

  The argument can be `NULL`.

#### Return value

Type: `GimpProcedure`

A new `GimpProcedure`.

The caller of the function takes ownership of the data, and is responsible for freeing it.