[gimp] plug-ins: fix all remaining GimpImageProcedure to new run() API.



commit 931b9fb539a40251ae19aec754a1064ba8bff7ab
Author: Jehan <jehan girinstud io>
Date:   Sat Apr 3 22:32:47 2021 +0200

    plug-ins: fix all remaining GimpImageProcedure to new run() API.

 plug-ins/common/compose.c                      | 39 ++++++++++++++++++++++++--
 plug-ins/common/hot.c                          | 28 ++++++++++++++++--
 plug-ins/common/nl-filter.c                    | 27 ++++++++++++++++--
 plug-ins/common/tile.c                         | 26 +++++++++++++++--
 plug-ins/common/wavelet-decompose.c            | 26 +++++++++++++++--
 plug-ins/fractal-explorer/fractal-explorer.c   | 26 +++++++++++++++--
 plug-ins/gfig/gfig.c                           | 30 +++++++++++++++++---
 plug-ins/gimpressionist/gimp.c                 | 25 +++++++++++++++--
 plug-ins/gradient-flare/gradient-flare.c       | 28 +++++++++++++++---
 plug-ins/ifs-compose/ifs-compose.c             | 26 +++++++++++++++--
 plug-ins/imagemap/imap_main.c                  | 29 +++++++++++++++----
 plug-ins/lighting/lighting-main.c              | 27 ++++++++++++++++--
 plug-ins/map-object/map-object-main.c          | 28 ++++++++++++++++--
 plug-ins/pagecurl/pagecurl.c                   | 26 +++++++++++++++--
 plug-ins/selection-to-path/selection-to-path.c | 10 +++++--
 15 files changed, 360 insertions(+), 41 deletions(-)
---
diff --git a/plug-ins/common/compose.c b/plug-ins/common/compose.c
index fc0c421a63..f0a03a81c5 100644
--- a/plug-ins/common/compose.c
+++ b/plug-ins/common/compose.c
@@ -137,7 +137,8 @@ static GimpProcedure  * compose_create_procedure (GimpPlugIn           *plug_in,
 static GimpValueArray * compose_run              (GimpProcedure        *procedure,
                                                   GimpRunMode           run_mode,
                                                   GimpImage            *image,
-                                                  GimpDrawable         *drawable,
+                                                  gint                  n_drawables,
+                                                  GimpDrawable        **drawables,
                                                   const GimpValueArray *args,
                                                   gpointer              run_data);
 
@@ -390,6 +391,10 @@ compose_create_procedure (GimpPlugIn  *plug_in,
                                             compose_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "GRAY*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE  |
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLES |
+                                           GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES);
 
       gimp_procedure_set_menu_label (procedure, N_("C_ompose..."));
       gimp_procedure_add_menu_path (procedure, "<Image>/Colors/Components");
@@ -442,6 +447,8 @@ compose_create_procedure (GimpPlugIn  *plug_in,
                                             compose_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "GRAY*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
 
       gimp_procedure_set_documentation (procedure,
                                         "Compose an image from multiple "
@@ -491,6 +498,10 @@ compose_create_procedure (GimpPlugIn  *plug_in,
                                             compose_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "GRAY*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE  |
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLES |
+                                           GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES);
 
       gimp_procedure_set_menu_label (procedure, N_("R_ecompose"));
       gimp_procedure_add_menu_path (procedure, "<Image>/Colors/Components");
@@ -519,12 +530,14 @@ static GimpValueArray *
 compose_run (GimpProcedure        *procedure,
              GimpRunMode           run_mode,
              GimpImage            *image,
-             GimpDrawable         *drawable,
+             gint                  n_drawables,
+             GimpDrawable        **drawables,
              const GimpValueArray *args,
              gpointer              run_data)
 {
   GimpValueArray *return_vals;
-  const gchar    *name = gimp_procedure_get_name (procedure);
+  GimpDrawable   *drawable = NULL;
+  const gchar    *name     = gimp_procedure_get_name (procedure);
   gint            compose_by_drawable;
   gint            i;
 
@@ -533,6 +546,26 @@ compose_run (GimpProcedure        *procedure,
 
   compose_by_drawable = ! strcmp (name, DRAWABLE_COMPOSE_PROC);
 
+  if (compose_by_drawable)
+    {
+      if (n_drawables != 1)
+        {
+          GError *error = NULL;
+
+          g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
+                       _("Procedure '%s' only works with one drawable."),
+                       name);
+
+          return gimp_procedure_new_return_values (procedure,
+                                                   GIMP_PDB_CALLING_ERROR,
+                                                   error);
+        }
+      else
+        {
+          drawable = drawables[0];
+        }
+    }
+
   if (! strcmp (name, RECOMPOSE_PROC))
     {
       GimpParasite *parasite = gimp_image_get_parasite (image,
diff --git a/plug-ins/common/hot.c b/plug-ins/common/hot.c
index 49e6888c90..d8941c1a5e 100644
--- a/plug-ins/common/hot.c
+++ b/plug-ins/common/hot.c
@@ -163,7 +163,8 @@ static GimpProcedure  * hot_create_procedure (GimpPlugIn           *plug_in,
 static GimpValueArray * hot_run              (GimpProcedure        *procedure,
                                               GimpRunMode           run_mode,
                                               GimpImage            *image,
-                                              GimpDrawable         *drawable,
+                                              gint                  n_drawables,
+                                              GimpDrawable        **drawables,
                                               const GimpValueArray *args,
                                               gpointer              run_data);
 
@@ -246,6 +247,8 @@ hot_create_procedure (GimpPlugIn  *plug_in,
                                             hot_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "RGB");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
 
       gimp_procedure_set_menu_label (procedure, N_("_Hot..."));
       gimp_procedure_add_menu_path (procedure, "<Image>/Colors/Modify");
@@ -294,15 +297,34 @@ static GimpValueArray *
 hot_run (GimpProcedure        *procedure,
          GimpRunMode           run_mode,
          GimpImage            *image,
-         GimpDrawable         *drawable,
+         gint                  n_drawables,
+         GimpDrawable        **drawables,
          const GimpValueArray *args,
          gpointer              run_data)
 {
-  piArgs pi_args;
+  GimpDrawable *drawable;
+  piArgs        pi_args;
 
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
+  if (n_drawables != 1)
+    {
+      GError *error = NULL;
+
+      g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
+                   _("Procedure '%s' only works with one drawable."),
+                   gimp_procedure_get_name (procedure));
+
+      return gimp_procedure_new_return_values (procedure,
+                                               GIMP_PDB_CALLING_ERROR,
+                                               error);
+    }
+  else
+    {
+      drawable = drawables[0];
+    }
+
   pi_args.mode       = GIMP_VALUES_GET_INT     (args, 0);
   pi_args.action     = GIMP_VALUES_GET_INT     (args, 1);
   pi_args.new_layerp = GIMP_VALUES_GET_BOOLEAN (args, 2);
diff --git a/plug-ins/common/nl-filter.c b/plug-ins/common/nl-filter.c
index da484d5796..7336134afd 100644
--- a/plug-ins/common/nl-filter.c
+++ b/plug-ins/common/nl-filter.c
@@ -84,7 +84,8 @@ static GimpProcedure  * nlfilter_create_procedure (GimpPlugIn           *plug_in
 static GimpValueArray * nlfilter_run              (GimpProcedure        *procedure,
                                                    GimpRunMode           run_mode,
                                                    GimpImage            *image,
-                                                   GimpDrawable         *drawable,
+                                                   gint                  n_drawables,
+                                                   GimpDrawable        **drawables,
                                                    const GimpValueArray *args,
                                                    gpointer              run_data);
 
@@ -157,6 +158,8 @@ nlfilter_create_procedure (GimpPlugIn  *plug_in,
                                             nlfilter_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "RGB, GRAY");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
 
       gimp_procedure_set_menu_label (procedure, N_("_NL Filter..."));
       gimp_procedure_add_menu_path (procedure,"<Image>/Filters/Enhance");
@@ -202,13 +205,33 @@ static GimpValueArray *
 nlfilter_run (GimpProcedure        *procedure,
               GimpRunMode           run_mode,
               GimpImage            *image,
-              GimpDrawable         *drawable,
+              gint                  n_drawables,
+              GimpDrawable        **drawables,
               const GimpValueArray *args,
               gpointer              run_data)
 {
+  GimpDrawable *drawable;
+
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
+  if (n_drawables != 1)
+    {
+      GError *error = NULL;
+
+      g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
+                   _("Procedure '%s' only works with one drawable."),
+                   gimp_procedure_get_name (procedure));
+
+      return gimp_procedure_new_return_values (procedure,
+                                               GIMP_PDB_CALLING_ERROR,
+                                               error);
+    }
+  else
+    {
+      drawable = drawables[0];
+    }
+
   switch (run_mode)
     {
     case GIMP_RUN_INTERACTIVE:
diff --git a/plug-ins/common/tile.c b/plug-ins/common/tile.c
index 4a07809b39..545032cfc9 100644
--- a/plug-ins/common/tile.c
+++ b/plug-ins/common/tile.c
@@ -68,7 +68,8 @@ static GimpProcedure  * tile_create_procedure (GimpPlugIn           *plug_in,
 static GimpValueArray * tile_run              (GimpProcedure        *procedure,
                                                GimpRunMode           run_mode,
                                                GimpImage            *image,
-                                               GimpDrawable         *drawable,
+                                               gint                  n_drawables,
+                                               GimpDrawable        **drawables,
                                                const GimpValueArray *args,
                                                gpointer              run_data);
 
@@ -135,6 +136,8 @@ tile_create_procedure (GimpPlugIn  *plug_in,
                                             tile_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
 
       gimp_procedure_set_menu_label (procedure, N_("_Tile..."));
       gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Map");
@@ -195,17 +198,36 @@ static GimpValueArray *
 tile_run (GimpProcedure        *procedure,
           GimpRunMode           run_mode,
           GimpImage            *image,
-          GimpDrawable         *drawable,
+          gint                  n_drawables,
+          GimpDrawable        **drawables,
           const GimpValueArray *args,
           gpointer              run_data)
 {
   GimpValueArray *return_vals;
   GimpLayer      *new_layer;
   GimpImage      *new_image;
+  GimpDrawable   *drawable;
 
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
+  if (n_drawables != 1)
+    {
+      GError *error = NULL;
+
+      g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
+                   _("Procedure '%s' only works with one drawable."),
+                   gimp_procedure_get_name (procedure));
+
+      return gimp_procedure_new_return_values (procedure,
+                                               GIMP_PDB_CALLING_ERROR,
+                                               error);
+    }
+  else
+    {
+      drawable = drawables[0];
+    }
+
   switch (run_mode)
     {
     case GIMP_RUN_INTERACTIVE:
diff --git a/plug-ins/common/wavelet-decompose.c b/plug-ins/common/wavelet-decompose.c
index e07bf4857d..7b9b1003da 100644
--- a/plug-ins/common/wavelet-decompose.c
+++ b/plug-ins/common/wavelet-decompose.c
@@ -64,7 +64,8 @@ static GimpProcedure  * wavelet_create_procedure (GimpPlugIn           *plug_in,
 static GimpValueArray * wavelet_run              (GimpProcedure        *procedure,
                                                   GimpRunMode           run_mode,
                                                   GimpImage            *image,
-                                                  GimpDrawable         *drawable,
+                                                  gint                  n_drawables,
+                                                  GimpDrawable        **drawables,
                                                   const GimpValueArray *args,
                                                   gpointer              run_data);
 
@@ -122,6 +123,8 @@ wavelet_create_procedure (GimpPlugIn  *plug_in,
                                             wavelet_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
 
       gimp_procedure_set_menu_label (procedure, N_("_Wavelet-decompose..."));
       gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Enhance");
@@ -162,13 +165,15 @@ static GimpValueArray *
 wavelet_run (GimpProcedure        *procedure,
               GimpRunMode           run_mode,
               GimpImage            *image,
-              GimpDrawable         *drawable,
+              gint                  n_drawables,
+              GimpDrawable        **drawables,
               const GimpValueArray *args,
               gpointer              run_data)
 {
   GimpLayer    **scale_layers;
   GimpLayer     *new_scale;
   GimpLayer     *parent             = NULL;
+  GimpDrawable  *drawable;
   GimpLayerMode  grain_extract_mode = GIMP_LAYER_MODE_GRAIN_EXTRACT;
   GimpLayerMode  grain_merge_mode   = GIMP_LAYER_MODE_GRAIN_MERGE;
   gint           id;
@@ -176,6 +181,23 @@ wavelet_run (GimpProcedure        *procedure,
   INIT_I18N();
   gegl_init (NULL, NULL);
 
+  if (n_drawables != 1)
+    {
+      GError *error = NULL;
+
+      g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
+                   _("Procedure '%s' only works with one drawable."),
+                   gimp_procedure_get_name (procedure));
+
+      return gimp_procedure_new_return_values (procedure,
+                                               GIMP_PDB_CALLING_ERROR,
+                                               error);
+    }
+  else
+    {
+      drawable = drawables[0];
+    }
+
   switch (run_mode)
     {
     case GIMP_RUN_INTERACTIVE:
diff --git a/plug-ins/fractal-explorer/fractal-explorer.c b/plug-ins/fractal-explorer/fractal-explorer.c
index 593a041752..d4760e85a0 100644
--- a/plug-ins/fractal-explorer/fractal-explorer.c
+++ b/plug-ins/fractal-explorer/fractal-explorer.c
@@ -96,7 +96,8 @@ static GimpProcedure  * explorer_create_procedure (GimpPlugIn           *plug_in
 static GimpValueArray * explorer_run              (GimpProcedure        *procedure,
                                                    GimpRunMode           run_mode,
                                                    GimpImage            *image,
-                                                   GimpDrawable         *drawable,
+                                                   gint                  n_drawables,
+                                                   GimpDrawable        **drawables,
                                                    const GimpValueArray *args,
                                                    gpointer              run_data);
 
@@ -232,6 +233,8 @@ explorer_create_procedure (GimpPlugIn  *plug_in,
                                             explorer_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
 
       gimp_procedure_set_menu_label (procedure, N_("_Fractal Explorer..."));
       gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Render/Fractals");
@@ -372,10 +375,12 @@ static GimpValueArray *
 explorer_run (GimpProcedure        *procedure,
               GimpRunMode           run_mode,
               GimpImage            *image,
-              GimpDrawable         *drawable,
+              gint                  n_drawables,
+              GimpDrawable        **drawables,
               const GimpValueArray *args,
               gpointer              run_data)
 {
+  GimpDrawable      *drawable;
   gint               pwidth;
   gint               pheight;
   GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
@@ -385,6 +390,23 @@ explorer_run (GimpProcedure        *procedure,
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
+  if (n_drawables != 1)
+    {
+      GError *error = NULL;
+
+      g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
+                   _("Procedure '%s' only works with one drawable."),
+                   gimp_procedure_get_name (procedure));
+
+      return gimp_procedure_new_return_values (procedure,
+                                               GIMP_PDB_CALLING_ERROR,
+                                               error);
+    }
+  else
+    {
+      drawable = drawables[0];
+    }
+
   if (! gimp_drawable_mask_intersect (drawable,
                                       &sel_x, &sel_y,
                                       &sel_width, &sel_height))
diff --git a/plug-ins/gfig/gfig.c b/plug-ins/gfig/gfig.c
index c0cd2c3c9a..3188254f35 100644
--- a/plug-ins/gfig/gfig.c
+++ b/plug-ins/gfig/gfig.c
@@ -83,7 +83,8 @@ static GimpProcedure  * gfig_create_procedure (GimpPlugIn           *plug_in,
 static GimpValueArray * gfig_run              (GimpProcedure        *procedure,
                                                GimpRunMode           run_mode,
                                                GimpImage            *image,
-                                               GimpDrawable         *drawable,
+                                               gint                  n_drawables,
+                                               GimpDrawable        **drawables,
                                                const GimpValueArray *args,
                                                gpointer              run_data);
 
@@ -159,6 +160,8 @@ gfig_create_procedure (GimpPlugIn  *plug_in,
                                             gfig_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
 
       gimp_procedure_set_menu_label (procedure, N_("_Gfig..."));
       gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Render");
@@ -190,15 +193,34 @@ static GimpValueArray *
 gfig_run (GimpProcedure        *procedure,
           GimpRunMode           run_mode,
           GimpImage            *image,
-          GimpDrawable         *drawable,
+          gint                  n_drawables,
+          GimpDrawable        **drawables,
           const GimpValueArray *args,
           gpointer              run_data)
 {
-  GimpPDBStatusType status = GIMP_PDB_SUCCESS;
-  gint              pwidth, pheight;
+  GimpDrawable      *drawable;
+  GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
+  gint               pwidth, pheight;
 
   INIT_I18N ();
 
+  if (n_drawables != 1)
+    {
+      GError *error = NULL;
+
+      g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
+                   _("Procedure '%s' only works with one drawable."),
+                   gimp_procedure_get_name (procedure));
+
+      return gimp_procedure_new_return_values (procedure,
+                                               GIMP_PDB_CALLING_ERROR,
+                                               error);
+    }
+  else
+    {
+      drawable = drawables[0];
+    }
+
   gfig_context = g_new0 (GFigContext, 1);
 
   gfig_context->show_background = TRUE;
diff --git a/plug-ins/gimpressionist/gimp.c b/plug-ins/gimpressionist/gimp.c
index 0b66bb3f2e..f15cd56455 100644
--- a/plug-ins/gimpressionist/gimp.c
+++ b/plug-ins/gimpressionist/gimp.c
@@ -62,7 +62,8 @@ static GimpProcedure  * gimpressionist_create_procedure (GimpPlugIn           *p
 static GimpValueArray * gimpressionist_run              (GimpProcedure        *procedure,
                                                          GimpRunMode           run_mode,
                                                          GimpImage            *image,
-                                                         GimpDrawable         *drawable,
+                                                         gint                  n_drawables,
+                                                         GimpDrawable        **drawables,
                                                          const GimpValueArray *args,
                                                          gpointer              run_data);
 
@@ -112,6 +113,8 @@ gimpressionist_create_procedure (GimpPlugIn  *plug_in,
                                             gimpressionist_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
 
       gimp_procedure_set_menu_label (procedure, N_("_GIMPressionist..."));
       gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Artistic");
@@ -156,7 +159,8 @@ static GimpValueArray *
 gimpressionist_run (GimpProcedure        *procedure,
                     GimpRunMode           run_mode,
                     GimpImage            *image,
-                    GimpDrawable         *_drawable,
+                    gint                  n_drawables,
+                    GimpDrawable        **drawables,
                     const GimpValueArray *args,
                     gpointer              run_data)
 {
@@ -165,7 +169,22 @@ gimpressionist_run (GimpProcedure        *procedure,
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
-  drawable = _drawable;
+  if (n_drawables != 1)
+    {
+      GError *error = NULL;
+
+      g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
+                   _("Procedure '%s' only works with one drawable."),
+                   gimp_procedure_get_name (procedure));
+
+      return gimp_procedure_new_return_values (procedure,
+                                               GIMP_PDB_CALLING_ERROR,
+                                               error);
+    }
+  else
+    {
+      drawable = drawables[0];
+    }
 
   img_has_alpha = gimp_drawable_has_alpha (drawable);
 
diff --git a/plug-ins/gradient-flare/gradient-flare.c b/plug-ins/gradient-flare/gradient-flare.c
index 7d654881dc..f64cc398fb 100644
--- a/plug-ins/gradient-flare/gradient-flare.c
+++ b/plug-ins/gradient-flare/gradient-flare.c
@@ -393,7 +393,8 @@ static GimpProcedure  * gflare_create_procedure (GimpPlugIn           *plug_in,
 static GimpValueArray * gflare_run              (GimpProcedure        *procedure,
                                                  GimpRunMode           run_mode,
                                                  GimpImage            *image,
-                                                 GimpDrawable         *drawable,
+                                                 gint                  n_drawables,
+                                                 GimpDrawable        **drawables,
                                                  const GimpValueArray *args,
                                                  gpointer              run_data);
 
@@ -810,6 +811,8 @@ gflare_create_procedure (GimpPlugIn  *plug_in,
                                             gflare_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
 
       gimp_procedure_set_menu_label (procedure, N_("_Gradient Flare..."));
       gimp_procedure_add_menu_path (procedure,
@@ -911,7 +914,8 @@ static GimpValueArray *
 gflare_run (GimpProcedure        *procedure,
             GimpRunMode           run_mode,
             GimpImage            *_image,
-            GimpDrawable         *_drawable,
+            gint                  n_drawables,
+            GimpDrawable        **drawables,
             const GimpValueArray *args,
             gpointer              run_data)
 {
@@ -920,8 +924,24 @@ gflare_run (GimpProcedure        *procedure,
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
-  image   =  _image;
-  drawable = _drawable;
+  image = _image;
+
+  if (n_drawables != 1)
+    {
+      GError *error = NULL;
+
+      g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
+                   _("Procedure '%s' only works with one drawable."),
+                   gimp_procedure_get_name (procedure));
+
+      return gimp_procedure_new_return_values (procedure,
+                                               GIMP_PDB_CALLING_ERROR,
+                                               error);
+    }
+  else
+    {
+      drawable = drawables[0];
+    }
 
   dinfo.is_color  = gimp_drawable_is_rgb (drawable);
   dinfo.has_alpha = gimp_drawable_has_alpha (drawable);
diff --git a/plug-ins/ifs-compose/ifs-compose.c b/plug-ins/ifs-compose/ifs-compose.c
index 6d203a52b8..cc15137f22 100644
--- a/plug-ins/ifs-compose/ifs-compose.c
+++ b/plug-ins/ifs-compose/ifs-compose.c
@@ -202,7 +202,8 @@ static GimpProcedure  * ifs_create_procedure (GimpPlugIn           *plug_in,
 static GimpValueArray * ifs_run              (GimpProcedure        *procedure,
                                               GimpRunMode           run_mode,
                                               GimpImage            *image,
-                                              GimpDrawable         *drawable,
+                                              gint                  n_drawables,
+                                              GimpDrawable        **drawables,
                                               const GimpValueArray *args,
                                               gpointer              run_data);
 
@@ -363,6 +364,8 @@ ifs_create_procedure (GimpPlugIn  *plug_in,
                                             ifs_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
 
       gimp_procedure_set_menu_label (procedure, N_("_IFS Fractal..."));
       gimp_procedure_add_menu_path (procedure,
@@ -393,16 +396,35 @@ static GimpValueArray *
 ifs_run (GimpProcedure        *procedure,
          GimpRunMode           run_mode,
          GimpImage            *image,
-         GimpDrawable         *drawable,
+         gint                  n_drawables,
+         GimpDrawable        **drawables,
          const GimpValueArray *args,
          gpointer              run_data)
 {
+  GimpDrawable *drawable;
   GimpParasite *parasite = NULL;
   gboolean      found_parasite = FALSE;
 
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
+  if (n_drawables != 1)
+    {
+      GError *error = NULL;
+
+      g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
+                   _("Procedure '%s' only works with one drawable."),
+                   gimp_procedure_get_name (procedure));
+
+      return gimp_procedure_new_return_values (procedure,
+                                               GIMP_PDB_CALLING_ERROR,
+                                               error);
+    }
+  else
+    {
+      drawable = drawables[0];
+    }
+
   switch (run_mode)
     {
     case GIMP_RUN_INTERACTIVE:
diff --git a/plug-ins/imagemap/imap_main.c b/plug-ins/imagemap/imap_main.c
index 74e0fe4f44..da246776e4 100644
--- a/plug-ins/imagemap/imap_main.c
+++ b/plug-ins/imagemap/imap_main.c
@@ -87,7 +87,8 @@ static GimpProcedure  * imap_create_procedure (GimpPlugIn           *plug_in,
 static GimpValueArray * imap_run              (GimpProcedure        *procedure,
                                                GimpRunMode           run_mode,
                                                GimpImage            *image,
-                                               GimpDrawable         *drawable,
+                                               gint                  n_drawables,
+                                               GimpDrawable        **drawables,
                                                const GimpValueArray *args,
                                                gpointer              run_data);
 
@@ -159,6 +160,8 @@ imap_create_procedure (GimpPlugIn  *plug_in,
                                             imap_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
 
       gimp_procedure_set_menu_label (procedure, N_("_Image Map..."));
       gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Web");
@@ -180,27 +183,43 @@ static GimpValueArray *
 imap_run (GimpProcedure        *procedure,
          GimpRunMode           run_mode,
          GimpImage            *image,
-         GimpDrawable         *drawable,
+         gint                  n_drawables,
+         GimpDrawable        **drawables,
          const GimpValueArray *args,
          gpointer              run_data)
 {
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
-  _drawable = drawable;
+  if (n_drawables != 1)
+    {
+      GError *error = NULL;
+
+      g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
+                   _("Procedure '%s' only works with one drawable."),
+                   gimp_procedure_get_name (procedure));
+
+      return gimp_procedure_new_return_values (procedure,
+                                               GIMP_PDB_CALLING_ERROR,
+                                               error);
+    }
+  else
+    {
+      _drawable = drawables[0];
+    }
 
   _image_name   = gimp_image_get_name (image);
   _image_width  = gimp_image_width (image);
   _image_height = gimp_image_height (image);
 
-  _map_info.color = gimp_drawable_is_rgb (drawable);
+  _map_info.color = gimp_drawable_is_rgb (_drawable);
 
   if (run_mode != GIMP_RUN_INTERACTIVE)
     return gimp_procedure_new_return_values (procedure,
                                              GIMP_PDB_CALLING_ERROR,
                                              NULL);
 
-  if (! dialog (drawable))
+  if (! dialog (_drawable))
     return gimp_procedure_new_return_values (procedure,
                                              GIMP_PDB_EXECUTION_ERROR,
                                              NULL);
diff --git a/plug-ins/lighting/lighting-main.c b/plug-ins/lighting/lighting-main.c
index a69a890bea..bb88a2a7f0 100644
--- a/plug-ins/lighting/lighting-main.c
+++ b/plug-ins/lighting/lighting-main.c
@@ -64,7 +64,8 @@ static GimpProcedure  * lighting_create_procedure (GimpPlugIn           *plug_in
 static GimpValueArray * lighting_run              (GimpProcedure        *procedure,
                                                    GimpRunMode           run_mode,
                                                    GimpImage            *image,
-                                                   GimpDrawable         *drawable,
+                                                   gint                  n_drawables,
+                                                   GimpDrawable        **drawables,
                                                    const GimpValueArray *args,
                                                    gpointer              run_data);
 
@@ -112,6 +113,8 @@ lighting_create_procedure (GimpPlugIn  *plug_in,
                                             lighting_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "RGB*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
 
       gimp_procedure_set_menu_label (procedure, N_("_Lighting Effects..."));
       gimp_procedure_add_menu_path (procedure,
@@ -382,13 +385,33 @@ static GimpValueArray *
 lighting_run (GimpProcedure        *procedure,
               GimpRunMode           run_mode,
               GimpImage            *image,
-              GimpDrawable         *drawable,
+              gint                  n_drawables,
+              GimpDrawable        **drawables,
               const GimpValueArray *args,
               gpointer              run_data)
 {
+  GimpDrawable *drawable;
+
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
+  if (n_drawables != 1)
+    {
+      GError *error = NULL;
+
+      g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
+                   _("Procedure '%s' only works with one drawable."),
+                   gimp_procedure_get_name (procedure));
+
+      return gimp_procedure_new_return_values (procedure,
+                                               GIMP_PDB_CALLING_ERROR,
+                                               error);
+    }
+  else
+    {
+      drawable = drawables[0];
+    }
+
   set_default_settings ();
 
   gimp_get_data (PLUG_IN_PROC, &mapvals);
diff --git a/plug-ins/map-object/map-object-main.c b/plug-ins/map-object/map-object-main.c
index 87594e764b..78315ff715 100644
--- a/plug-ins/map-object/map-object-main.c
+++ b/plug-ins/map-object/map-object-main.c
@@ -64,7 +64,8 @@ static GimpProcedure  * map_create_procedure (GimpPlugIn           *plug_in,
 static GimpValueArray * map_run              (GimpProcedure        *procedure,
                                               GimpRunMode           run_mode,
                                               GimpImage            *image,
-                                              GimpDrawable         *drawable,
+                                              gint                  n_drawables,
+                                              GimpDrawable        **drawables,
                                               const GimpValueArray *args,
                                               gpointer              run_data);
 
@@ -112,6 +113,8 @@ map_create_procedure (GimpPlugIn  *plug_in,
                                             map_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "RGB*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
 
       gimp_procedure_set_menu_label (procedure, N_("Map _Object..."));
       gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Map");
@@ -471,17 +474,36 @@ static GimpValueArray *
 map_run (GimpProcedure        *procedure,
          GimpRunMode           run_mode,
          GimpImage            *_image,
-         GimpDrawable         *drawable,
+         gint                  n_drawables,
+         GimpDrawable        **drawables,
          const GimpValueArray *args,
          gpointer              run_data)
 {
-  gint i;
+  GimpDrawable *drawable;
+  gint          i;
 
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
   image = _image;
 
+  if (n_drawables != 1)
+    {
+      GError *error = NULL;
+
+      g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
+                   _("Procedure '%s' only works with one drawable."),
+                   gimp_procedure_get_name (procedure));
+
+      return gimp_procedure_new_return_values (procedure,
+                                               GIMP_PDB_CALLING_ERROR,
+                                               error);
+    }
+  else
+    {
+      drawable = drawables[0];
+    }
+
   set_default_settings ();
 
   switch (run_mode)
diff --git a/plug-ins/pagecurl/pagecurl.c b/plug-ins/pagecurl/pagecurl.c
index da8f04c671..5f778e6a8b 100644
--- a/plug-ins/pagecurl/pagecurl.c
+++ b/plug-ins/pagecurl/pagecurl.c
@@ -129,7 +129,8 @@ static GimpProcedure  * pagecurl_create_procedure (GimpPlugIn           *plug_in
 static GimpValueArray * pagecurl_run              (GimpProcedure        *procedure,
                                                    GimpRunMode           run_mode,
                                                    GimpImage            *image,
-                                                   GimpDrawable         *drawable,
+                                                   gint                  n_drawables,
+                                                   GimpDrawable        **drawables,
                                                    const GimpValueArray *args,
                                                    gpointer              run_data);
 
@@ -222,6 +223,8 @@ pagecurl_create_procedure (GimpPlugIn  *plug_in,
                                             pagecurl_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
 
       gimp_procedure_set_menu_label (procedure, N_("_Pagecurl..."));
       gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Distorts");
@@ -277,10 +280,12 @@ static GimpValueArray *
 pagecurl_run (GimpProcedure        *procedure,
               GimpRunMode           run_mode,
               GimpImage            *_image,
-              GimpDrawable         *drawable,
+              gint                  n_drawables,
+              GimpDrawable        **drawables,
               const GimpValueArray *args,
               gpointer              run_data)
 {
+  GimpDrawable   *drawable;
   GimpValueArray *return_vals = NULL;
 
   INIT_I18N ();
@@ -288,6 +293,23 @@ pagecurl_run (GimpProcedure        *procedure,
 
   image = _image;
 
+  if (n_drawables != 1)
+    {
+      GError *error = NULL;
+
+      g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
+                   _("Procedure '%s' only works with one drawable."),
+                   gimp_procedure_get_name (procedure));
+
+      return gimp_procedure_new_return_values (procedure,
+                                               GIMP_PDB_CALLING_ERROR,
+                                               error);
+    }
+  else
+    {
+      drawable = drawables[0];
+    }
+
   curl.colors      = GIMP_VALUES_GET_INT     (args, 0);
   curl.edge        = GIMP_VALUES_GET_INT     (args, 1);
   curl.orientation = GIMP_VALUES_GET_INT     (args, 2);
diff --git a/plug-ins/selection-to-path/selection-to-path.c b/plug-ins/selection-to-path/selection-to-path.c
index c2a4d25969..08815224d6 100644
--- a/plug-ins/selection-to-path/selection-to-path.c
+++ b/plug-ins/selection-to-path/selection-to-path.c
@@ -79,7 +79,8 @@ static GimpProcedure  * sel2path_create_procedure (GimpPlugIn           *plug_in
 static GimpValueArray * sel2path_run              (GimpProcedure        *procedure,
                                                    GimpRunMode           run_mode,
                                                    GimpImage            *image,
-                                                   GimpDrawable         *drawable,
+                                                   gint                  n_drawables,
+                                                   GimpDrawable        **drawables,
                                                    const GimpValueArray *args,
                                                    gpointer              run_data);
 
@@ -136,6 +137,10 @@ sel2path_create_procedure (GimpPlugIn  *plug_in,
                                             sel2path_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "*");
+      gimp_procedure_set_sensitivity_mask (procedure,
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLE  |
+                                           GIMP_PROCEDURE_SENSITIVE_DRAWABLES |
+                                           GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES);
 
       gimp_procedure_set_documentation (procedure,
                                         "Converts a selection to a path",
@@ -274,7 +279,8 @@ static GimpValueArray *
 sel2path_run (GimpProcedure        *procedure,
               GimpRunMode           run_mode,
               GimpImage            *image,
-              GimpDrawable         *drawable,
+              gint                  n_drawables,
+              GimpDrawable        **drawables,
               const GimpValueArray *args,
               gpointer              run_data)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]