[gimp] plug-ins: port many plug-ins from GimpProcedure to GimpImageProcedure



commit 15019fef52e8661d2059347b183ef5222b0cc4ba
Author: Michael Natterer <mitch gimp org>
Date:   Sun Aug 18 13:45:58 2019 +0200

    plug-ins: port many plug-ins from GimpProcedure to GimpImageProcedure
    
    Also move the call to set_icon_name() after set_menu_label(), all
    ported plug-ins should look the same so we are a good example for copy
    and paste ;)

 plug-ins/common/animation-play.c             | 38 ++++---------
 plug-ins/common/colormap-remap.c             | 79 +++++++---------------------
 plug-ins/common/file-gbr.c                   |  7 +--
 plug-ins/common/file-gih.c                   |  4 +-
 plug-ins/common/file-pat.c                   |  7 +--
 plug-ins/common/film.c                       | 37 ++++---------
 plug-ins/common/mail.c                       | 47 +++++------------
 plug-ins/common/plugin-browser.c             |  4 +-
 plug-ins/common/procedure-browser.c          |  1 -
 plug-ins/common/unit-editor.c                |  4 +-
 plug-ins/file-ico/ico.c                      |  6 +--
 plug-ins/file-sgi/sgi.c                      |  3 +-
 plug-ins/fractal-explorer/fractal-explorer.c | 32 +++--------
 plug-ins/gfig/gfig.c                         | 41 ++++-----------
 plug-ins/goat-exercises/goat-exercise-c.c    |  7 +--
 plug-ins/pagecurl/pagecurl.c                 | 35 ++++--------
 plug-ins/print/print.c                       | 46 +++++-----------
 17 files changed, 106 insertions(+), 292 deletions(-)
---
diff --git a/plug-ins/common/animation-play.c b/plug-ins/common/animation-play.c
index 2e0ee71baa..3b37af413d 100644
--- a/plug-ins/common/animation-play.c
+++ b/plug-ins/common/animation-play.c
@@ -95,6 +95,9 @@ static GimpProcedure  * play_create_procedure (GimpPlugIn           *plug_in,
                                                const gchar          *name);
 
 static GimpValueArray * play_run              (GimpProcedure        *procedure,
+                                               GimpRunMode           run_mode,
+                                               gint32                image_id,
+                                               gint32                drawable_id,
                                                const GimpValueArray *args,
                                                gpointer              run_data);
 
@@ -239,12 +242,13 @@ play_create_procedure (GimpPlugIn  *plug_in,
 
   if (! strcmp (name, PLUG_IN_PROC))
     {
-      procedure = gimp_procedure_new (plug_in, name, GIMP_PLUGIN,
-                                      play_run, NULL, NULL);
+      procedure = gimp_image_procedure_new (plug_in, name, GIMP_PLUGIN,
+                                            play_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "*");
 
       gimp_procedure_set_menu_label (procedure, N_("_Playback..."));
+      gimp_procedure_set_icon_name (procedure, "media-playback-start");
       gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Animation/");
 
       gimp_procedure_set_documentation (procedure,
@@ -256,28 +260,6 @@ play_create_procedure (GimpPlugIn  *plug_in,
                                       "Adam D. Moss <adam gimp org>",
                                       "Adam D. Moss <adam gimp org>",
                                       "1997, 1998...");
-
-      gimp_procedure_set_icon_name (procedure, "media-playback-start");
-
-      gimp_procedure_add_argument (procedure,
-                                   g_param_spec_enum ("run-mode",
-                                                      "Run mode",
-                                                      "The run mode",
-                                                      GIMP_TYPE_RUN_MODE,
-                                                      GIMP_RUN_NONINTERACTIVE,
-                                                      G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_image_id ("image",
-                                                             "Image",
-                                                             "The input image",
-                                                             FALSE,
-                                                             G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_drawable_id ("drawable",
-                                                                "Drawable",
-                                                                "The input drawable",
-                                                                FALSE,
-                                                                G_PARAM_READWRITE));
     }
 
   return procedure;
@@ -285,16 +267,16 @@ play_create_procedure (GimpPlugIn  *plug_in,
 
 static GimpValueArray *
 play_run (GimpProcedure        *procedure,
+          GimpRunMode           run_mode,
+          gint32                image,
+          gint32                drawable,
           const GimpValueArray *args,
           gpointer              run_data)
 {
-  GimpRunMode run_mode;
-
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
-  run_mode = g_value_get_enum        (gimp_value_array_index (args, 0));
-  image_id = gimp_value_get_image_id (gimp_value_array_index (args, 1));
+  image_id = image;
 
   gimp_get_data (PLUG_IN_PROC, &settings);
 
diff --git a/plug-ins/common/colormap-remap.c b/plug-ins/common/colormap-remap.c
index 4c18f2bdb9..49e88b6521 100644
--- a/plug-ins/common/colormap-remap.c
+++ b/plug-ins/common/colormap-remap.c
@@ -67,6 +67,9 @@ static GimpProcedure  * remap_create_procedure (GimpPlugIn           *plug_in,
                                                 const gchar          *name);
 
 static GimpValueArray * remap_run              (GimpProcedure        *procedure,
+                                                GimpRunMode           run_mode,
+                                                gint32                image_id,
+                                                gint32                drawable_id,
                                                 const GimpValueArray *args,
                                                 gpointer              run_data);
 
@@ -116,12 +119,13 @@ remap_create_procedure (GimpPlugIn  *plug_in,
 
   if (! strcmp (name, PLUG_IN_PROC_REMAP))
     {
-      procedure = gimp_procedure_new (plug_in, name, GIMP_PLUGIN,
-                                      remap_run, NULL, NULL);
+      procedure = gimp_image_procedure_new (plug_in, name, GIMP_PLUGIN,
+                                            remap_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "INDEXED*");
 
       gimp_procedure_set_menu_label (procedure, N_("R_earrange Colormap..."));
+      gimp_procedure_set_icon_name (procedure, GIMP_ICON_COLORMAP);
       gimp_procedure_add_menu_path (procedure, "<Image>/Colors/Map/Colormap");
       gimp_procedure_add_menu_path (procedure, "<Colormap>");
 
@@ -137,27 +141,6 @@ remap_create_procedure (GimpPlugIn  *plug_in,
                                       "Mukund Sivaraman <muks mukund org>",
                                       "June 2006");
 
-      gimp_procedure_set_icon_name (procedure, GIMP_ICON_COLORMAP);
-
-      gimp_procedure_add_argument (procedure,
-                                   g_param_spec_enum ("run-mode",
-                                                      "Run mode",
-                                                      "The run mode",
-                                                      GIMP_TYPE_RUN_MODE,
-                                                      GIMP_RUN_NONINTERACTIVE,
-                                                      G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_image_id ("image",
-                                                             "Image",
-                                                             "The input image",
-                                                             FALSE,
-                                                             G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_drawable_id ("drawable",
-                                                                "Drawable",
-                                                                "The input drawable",
-                                                                FALSE,
-                                                                G_PARAM_READWRITE));
       gimp_procedure_add_argument (procedure,
                                    g_param_spec_int ("num-colors",
                                                      "Num colors",
@@ -174,12 +157,13 @@ remap_create_procedure (GimpPlugIn  *plug_in,
     }
   else if (! strcmp (name, PLUG_IN_PROC_SWAP))
     {
-      procedure = gimp_procedure_new (plug_in, name, GIMP_PLUGIN,
-                                      remap_run, NULL, NULL);
+      procedure = gimp_image_procedure_new (plug_in, name, GIMP_PLUGIN,
+                                            remap_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "INDEXED*");
 
       gimp_procedure_set_menu_label (procedure, N_("_Swap Colors"));
+      gimp_procedure_set_icon_name (procedure, GIMP_ICON_COLORMAP);
 
       gimp_procedure_set_documentation (procedure,
                                         N_("Swap two colors in the colormap"),
@@ -194,27 +178,6 @@ remap_create_procedure (GimpPlugIn  *plug_in,
                                       "Mukund Sivaraman <muks mukund org>",
                                       "June 2006");
 
-      gimp_procedure_set_icon_name (procedure, GIMP_ICON_COLORMAP);
-
-      gimp_procedure_add_argument (procedure,
-                                   g_param_spec_enum ("run-mode",
-                                                      "Run mode",
-                                                      "The run mode",
-                                                      GIMP_TYPE_RUN_MODE,
-                                                      GIMP_RUN_NONINTERACTIVE,
-                                                      G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_image_id ("image",
-                                                             "Image",
-                                                             "The input image",
-                                                             FALSE,
-                                                             G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_drawable_id ("drawable",
-                                                                "Drawable",
-                                                                "The input drawable",
-                                                                FALSE,
-                                                                G_PARAM_READWRITE));
       gimp_procedure_add_argument (procedure,
                                    g_param_spec_uchar ("index1",
                                                        "Index 1",
@@ -236,22 +199,20 @@ remap_create_procedure (GimpPlugIn  *plug_in,
 
 static GimpValueArray *
 remap_run (GimpProcedure        *procedure,
+           GimpRunMode           run_mode,
+           gint32                image_id,
+           gint32                drawable_id,
            const GimpValueArray *args,
            gpointer              run_data)
 {
-  GimpRunMode run_mode;
-  gint32      image_ID;
-  guchar      map[256];
-  gint        i;
+  guchar map[256];
+  gint   i;
 
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
-  run_mode = g_value_get_enum (gimp_value_array_index (args, 0));
-  image_ID = gimp_value_get_image_id (gimp_value_array_index (args, 1));
-
   /*  Make sure that the image is indexed  */
-  if (gimp_image_base_type (image_ID) != GIMP_INDEXED)
+  if (gimp_image_base_type (image_id) != GIMP_INDEXED)
     return gimp_procedure_new_return_values (procedure,
                                              GIMP_PDB_EXECUTION_ERROR,
                                              NULL);
@@ -266,7 +227,7 @@ remap_run (GimpProcedure        *procedure,
       gint          n_col_args;
       const guchar *col_args;
 
-      g_free (gimp_image_get_colormap (image_ID, &n_cols));
+      g_free (gimp_image_get_colormap (image_id, &n_cols));
 
       n_col_args = g_value_get_int            (gimp_value_array_index (args, 3));
       col_args   = gimp_value_get_uint8_array (gimp_value_array_index (args, 4));
@@ -274,7 +235,7 @@ remap_run (GimpProcedure        *procedure,
       switch (run_mode)
         {
         case GIMP_RUN_INTERACTIVE:
-          if (! remap_dialog (image_ID, map))
+          if (! remap_dialog (image_id, map))
             return gimp_procedure_new_return_values (procedure,
                                                      GIMP_PDB_CANCEL,
                                                      NULL);
@@ -295,7 +256,7 @@ remap_run (GimpProcedure        *procedure,
           break;
         }
 
-      if (! remap (image_ID, n_cols, map))
+      if (! remap (image_id, n_cols, map))
         return gimp_procedure_new_return_values (procedure,
                                                  GIMP_PDB_EXECUTION_ERROR,
                                                  NULL);
@@ -319,7 +280,7 @@ remap_run (GimpProcedure        *procedure,
                                                  GIMP_PDB_CALLING_ERROR,
                                                  NULL);
 
-      g_free (gimp_image_get_colormap (image_ID, &n_cols));
+      g_free (gimp_image_get_colormap (image_id, &n_cols));
 
       if (index1 >= n_cols || index2 >= n_cols)
         return gimp_procedure_new_return_values (procedure,
@@ -330,7 +291,7 @@ remap_run (GimpProcedure        *procedure,
       map[index1] = map[index2];
       map[index2] = tmp;
 
-      if (! remap (image_ID, n_cols, map))
+      if (! remap (image_id, n_cols, map))
         return gimp_procedure_new_return_values (procedure,
                                                  GIMP_PDB_EXECUTION_ERROR,
                                                  NULL);
diff --git a/plug-ins/common/file-gbr.c b/plug-ins/common/file-gbr.c
index 91a8de05b3..ed2eaca7b0 100644
--- a/plug-ins/common/file-gbr.c
+++ b/plug-ins/common/file-gbr.c
@@ -130,10 +130,10 @@ gbr_create_procedure (GimpPlugIn  *plug_in,
       procedure = gimp_save_procedure_new (plug_in, name, GIMP_PLUGIN,
                                            gbr_save, NULL, NULL);
 
-      gimp_procedure_set_image_types (procedure,
-                                      "RGB*, INDEXED*, GRAY*");
+      gimp_procedure_set_image_types (procedure, "*");
 
       gimp_procedure_set_menu_label (procedure, N_("GIMP brush"));
+      gimp_procedure_set_icon_name (procedure, GIMP_ICON_BRUSH);
 
       gimp_procedure_set_documentation (procedure,
                                         "Exports files in the GIMP brush "
@@ -141,7 +141,6 @@ gbr_create_procedure (GimpPlugIn  *plug_in,
                                         "Exports files in the GIMP brush "
                                         "file format",
                                         SAVE_PROC);
-
       gimp_procedure_set_attribution (procedure,
                                       "Tim Newsome, Jens Lautenbacher, "
                                       "Sven Neumann",
@@ -149,8 +148,6 @@ gbr_create_procedure (GimpPlugIn  *plug_in,
                                       "Sven Neumann",
                                       "1997-2000");
 
-      gimp_procedure_set_icon_name (procedure, GIMP_ICON_BRUSH);
-
       gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
                                           "image/x-gimp-gbr");
       gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
diff --git a/plug-ins/common/file-gih.c b/plug-ins/common/file-gih.c
index 72233a03e4..8bc6750044 100644
--- a/plug-ins/common/file-gih.c
+++ b/plug-ins/common/file-gih.c
@@ -172,6 +172,7 @@ gih_create_procedure (GimpPlugIn  *plug_in,
       gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
 
       gimp_procedure_set_menu_label (procedure, N_("GIMP brush (animated)"));
+      gimp_procedure_set_icon_name (procedure, GIMP_ICON_BRUSH);
 
       gimp_procedure_set_documentation (procedure,
                                         "exports images in GIMP brush pipe "
@@ -185,14 +186,11 @@ gih_create_procedure (GimpPlugIn  *plug_in,
                                         "layers can be divided into a "
                                         "rectangular array of brushes.",
                                         SAVE_PROC);
-
       gimp_procedure_set_attribution (procedure,
                                       "Tor Lillqvist",
                                       "Tor Lillqvist",
                                       "1999");
 
-      gimp_procedure_set_icon_name (procedure, GIMP_ICON_BRUSH);
-
       gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
                                           "image/x-gimp-gih");
       gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
diff --git a/plug-ins/common/file-pat.c b/plug-ins/common/file-pat.c
index 2224abfa09..0f4e39a2c6 100644
--- a/plug-ins/common/file-pat.c
+++ b/plug-ins/common/file-pat.c
@@ -104,10 +104,10 @@ pat_create_procedure (GimpPlugIn  *plug_in,
       procedure = gimp_save_procedure_new (plug_in, name, GIMP_PLUGIN,
                                            pat_save, NULL, NULL);
 
-      gimp_procedure_set_image_types (procedure,
-                                      "RGB*, INDEXED*, GRAY*");
+      gimp_procedure_set_image_types (procedure, "*");
 
       gimp_procedure_set_menu_label (procedure, N_("GIMP pattern"));
+      gimp_procedure_set_icon_name (procedure, GIMP_ICON_PATTERN);
 
       gimp_procedure_set_documentation (procedure,
                                         "Exports Gimp pattern file (.PAT)",
@@ -115,14 +115,11 @@ pat_create_procedure (GimpPlugIn  *plug_in,
                                         "by exporting them in the "
                                         "appropriate place with this plug-in.",
                                         SAVE_PROC);
-
       gimp_procedure_set_attribution (procedure,
                                       "Tim Newsome",
                                       "Tim Newsome",
                                       "1997");
 
-      gimp_procedure_set_icon_name (procedure, GIMP_ICON_PATTERN);
-
       gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
                                           "image/x-gimp-pat");
       gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
diff --git a/plug-ins/common/film.c b/plug-ins/common/film.c
index 4cdb231a92..f1aeef0ddb 100644
--- a/plug-ins/common/film.c
+++ b/plug-ins/common/film.c
@@ -97,6 +97,9 @@ static GimpProcedure  * film_create_procedure (GimpPlugIn           *plug_in,
                                                const gchar          *name);
 
 static GimpValueArray * film_run              (GimpProcedure        *procedure,
+                                               GimpRunMode           run_mode,
+                                               gint32                image_id,
+                                               gint32                drawable_id,
                                                const GimpValueArray *args,
                                                gpointer              run_data);
 
@@ -187,8 +190,6 @@ static FilmInterface filmint =
   NULL, NULL  /* image list widgets */
 };
 
-static GimpRunMode run_mode;
-
 
 static void
 film_class_init (FilmClass *klass)
@@ -212,14 +213,14 @@ film_query_procedures (GimpPlugIn *plug_in)
 
 static GimpProcedure *
 film_create_procedure (GimpPlugIn  *plug_in,
-                           const gchar *name)
+                       const gchar *name)
 {
   GimpProcedure *procedure = NULL;
 
   if (! strcmp (name, PLUG_IN_PROC))
     {
-      procedure = gimp_procedure_new (plug_in, name, GIMP_PLUGIN,
-                                      film_run, NULL, NULL);
+      procedure = gimp_image_procedure_new (plug_in, name, GIMP_PLUGIN,
+                                            film_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "*");
 
@@ -236,25 +237,6 @@ film_create_procedure (GimpPlugIn  *plug_in,
                                       "Peter Kirchgessner (peter kirchgessner net)",
                                       "1997");
 
-      gimp_procedure_add_argument (procedure,
-                                   g_param_spec_enum ("run-mode",
-                                                      "Run mode",
-                                                      "The run mode",
-                                                      GIMP_TYPE_RUN_MODE,
-                                                      GIMP_RUN_NONINTERACTIVE,
-                                                      G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_image_id ("image",
-                                                             "Image",
-                                                             "The input image",
-                                                             FALSE,
-                                                             G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_drawable_id ("drawable",
-                                                                "Drawable",
-                                                                "The input drawable",
-                                                                FALSE,
-                                                                G_PARAM_READWRITE));
       gimp_procedure_add_argument (procedure,
                                    g_param_spec_int ("film-height",
                                                      "Film height",
@@ -327,6 +309,9 @@ film_create_procedure (GimpPlugIn  *plug_in,
 
 static GimpValueArray *
 film_run (GimpProcedure        *procedure,
+          GimpRunMode           run_mode,
+          gint32                image_id,
+          gint32                drawable_id,
           const GimpValueArray *args,
           gpointer              run_data)
 {
@@ -336,8 +321,6 @@ film_run (GimpProcedure        *procedure,
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
-  run_mode = g_value_get_enum (gimp_value_array_index (args, 0));
-
   switch (run_mode)
     {
     case GIMP_RUN_INTERACTIVE:
@@ -345,7 +328,7 @@ film_run (GimpProcedure        *procedure,
       gimp_get_data (PLUG_IN_PROC, &filmvals);
 
       /*  First acquire information with a dialog  */
-      if (! film_dialog (gimp_value_get_image_id (gimp_value_array_index (args, 1))))
+      if (! film_dialog (image_id))
         return gimp_procedure_new_return_values (procedure, GIMP_PDB_CANCEL,
                                                  NULL);
       break;
diff --git a/plug-ins/common/mail.c b/plug-ins/common/mail.c
index 378c7b5cce..065a0030d2 100644
--- a/plug-ins/common/mail.c
+++ b/plug-ins/common/mail.c
@@ -86,6 +86,9 @@ static GimpProcedure  * mail_create_procedure (GimpPlugIn           *plug_in,
                                                const gchar          *name);
 
 static GimpValueArray * mail_run              (GimpProcedure        *procedure,
+                                               GimpRunMode           run_mode,
+                                               gint32                image_id,
+                                               gint32                drawable_id,
                                                const GimpValueArray *args,
                                                gpointer              run_data);
 
@@ -184,12 +187,13 @@ mail_create_procedure (GimpPlugIn  *plug_in,
 
   if (! strcmp (name, PLUG_IN_PROC))
     {
-      procedure = gimp_procedure_new (plug_in, name, GIMP_PLUGIN,
-                                      mail_run, NULL, NULL);
+      procedure = gimp_image_procedure_new (plug_in, name, GIMP_PLUGIN,
+                                            mail_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "*");
 
       gimp_procedure_set_menu_label (procedure, N_("Send by E_mail..."));
+      gimp_procedure_set_icon_name (procedure, GIMP_ICON_EDIT);
       gimp_procedure_add_menu_path (procedure, "<Image>/File/Send");
 
       gimp_procedure_set_documentation (procedure,
@@ -210,27 +214,6 @@ mail_create_procedure (GimpPlugIn  *plug_in,
                                       "Spencer Kimball and Peter Mattis",
                                       "1995-1997");
 
-      gimp_procedure_set_icon_name (procedure, GIMP_ICON_EDIT);
-
-      gimp_procedure_add_argument (procedure,
-                                   g_param_spec_enum ("run-mode",
-                                                      "Run mode",
-                                                      "The run mode",
-                                                      GIMP_TYPE_RUN_MODE,
-                                                      GIMP_RUN_NONINTERACTIVE,
-                                                      G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_image_id ("image",
-                                                             "Image",
-                                                             "The input image",
-                                                             FALSE,
-                                                             G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_drawable_id ("drawable",
-                                                                "Drawable",
-                                                                "The input drawable",
-                                                                FALSE,
-                                                                G_PARAM_READWRITE));
       gimp_procedure_add_argument (procedure,
                                    g_param_spec_string ("filename",
                                                         "Filename",
@@ -271,26 +254,22 @@ mail_create_procedure (GimpPlugIn  *plug_in,
 
 static GimpValueArray *
 mail_run (GimpProcedure        *procedure,
+          GimpRunMode           run_mode,
+          gint32                image_id,
+          gint32                drawable_id,
           const GimpValueArray *args,
           gpointer              run_data)
 {
-  GimpRunMode        run_mode;
-  GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
-  gint32             image_ID;
-  gint32             drawable_ID;
+  GimpPDBStatusType status = GIMP_PDB_SUCCESS;
 
   INIT_I18N ();
 
-  run_mode    = g_value_get_enum           (gimp_value_array_index (args, 0));
-  image_ID    = gimp_value_get_image_id    (gimp_value_array_index (args, 1));
-  drawable_ID = gimp_value_get_drawable_id (gimp_value_array_index (args, 2));
-
   switch (run_mode)
     {
     case GIMP_RUN_INTERACTIVE:
       gimp_get_data (PLUG_IN_PROC, &mail_info);
       {
-        gchar *filename = gimp_image_get_filename (image_ID);
+        gchar *filename = gimp_image_get_filename (image_id);
 
         if (filename)
           {
@@ -334,8 +313,8 @@ mail_run (GimpProcedure        *procedure,
     }
 
   status = send_image (mail_info.filename,
-                       image_ID,
-                       drawable_ID,
+                       image_id,
+                       drawable_id,
                        run_mode);
 
   if (status == GIMP_PDB_SUCCESS)
diff --git a/plug-ins/common/plugin-browser.c b/plug-ins/common/plugin-browser.c
index 37143130e2..a788a74520 100644
--- a/plug-ins/common/plugin-browser.c
+++ b/plug-ins/common/plugin-browser.c
@@ -165,9 +165,8 @@ browser_create_procedure (GimpPlugIn  *plug_in,
                                       browser_run, NULL, NULL);
 
       gimp_procedure_set_menu_label (procedure, N_("_Plug-In Browser"));
-      gimp_procedure_add_menu_path (procedure, "<Image>/Help/Programming");
-
       gimp_procedure_set_icon_name (procedure, GIMP_ICON_PLUGIN);
+      gimp_procedure_add_menu_path (procedure, "<Image>/Help/Programming");
 
       gimp_procedure_set_documentation (procedure,
                                         N_("Display information about plug-ins"),
@@ -180,7 +179,6 @@ browser_create_procedure (GimpPlugIn  *plug_in,
                                         "new plug-ins have installed "
                                         "themselves in the menus.",
                                         PLUG_IN_PROC);
-
       gimp_procedure_set_attribution (procedure,
                                       "Andy Thomas",
                                       "Andy Thomas",
diff --git a/plug-ins/common/procedure-browser.c b/plug-ins/common/procedure-browser.c
index 68f3f89620..e4861a663f 100644
--- a/plug-ins/common/procedure-browser.c
+++ b/plug-ins/common/procedure-browser.c
@@ -127,7 +127,6 @@ browser_create_procedure (GimpPlugIn  *plug_in,
                                         N_("List available procedures in the PDB"),
                                         NULL,
                                         PLUG_IN_PROC);
-
       gimp_procedure_set_attribution (procedure,
                                       "Thomas Noel",
                                       "Thomas Noel",
diff --git a/plug-ins/common/unit-editor.c b/plug-ins/common/unit-editor.c
index cf3cd22475..9fc1c99d69 100644
--- a/plug-ins/common/unit-editor.c
+++ b/plug-ins/common/unit-editor.c
@@ -179,20 +179,18 @@ editor_create_procedure (GimpPlugIn  *plug_in,
                                       editor_run, NULL, NULL);
 
       gimp_procedure_set_menu_label (procedure, N_("U_nits"));
+      gimp_procedure_set_icon_name (procedure, GIMP_ICON_TOOL_MEASURE);
       gimp_procedure_add_menu_path (procedure, "<Image>/Edit/Preferences");
 
       gimp_procedure_set_documentation (procedure,
                                         N_("Create or alter units used in GIMP"),
                                         "The GIMP unit editor",
                                         name);
-
       gimp_procedure_set_attribution (procedure,
                                       "Michael Natterer <mitch gimp org>",
                                       "Michael Natterer <mitch gimp org>",
                                       "2000");
 
-      gimp_procedure_set_icon_name (procedure, GIMP_ICON_TOOL_MEASURE);
-
       gimp_procedure_add_argument (procedure,
                                    g_param_spec_enum ("run-mode",
                                                       "Run mode",
diff --git a/plug-ins/file-ico/ico.c b/plug-ins/file-ico/ico.c
index dd3c90a860..6e13a8385b 100644
--- a/plug-ins/file-ico/ico.c
+++ b/plug-ins/file-ico/ico.c
@@ -121,6 +121,7 @@ ico_create_procedure (GimpPlugIn  *plug_in,
                                            ico_load, NULL, NULL);
 
       gimp_procedure_set_menu_label (procedure, N_("Microsoft Windows icon"));
+      gimp_procedure_set_icon_name (procedure, GIMP_ICON_BRUSH);
 
       gimp_procedure_set_documentation (procedure,
                                         "Loads files of Windows ICO file format",
@@ -131,8 +132,6 @@ ico_create_procedure (GimpPlugIn  *plug_in,
                                       "Christian Kreibich <christian whoop org>",
                                       "2002");
 
-      gimp_procedure_set_icon_name (procedure, GIMP_ICON_BRUSH);
-
       gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
                                           "image/x-ico");
       gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
@@ -201,6 +200,7 @@ ico_create_procedure (GimpPlugIn  *plug_in,
       gimp_procedure_set_image_types (procedure, "*");
 
       gimp_procedure_set_menu_label (procedure, N_("Microsoft Windows icon"));
+      gimp_procedure_set_icon_name (procedure, GIMP_ICON_BRUSH);
 
       gimp_procedure_set_documentation (procedure,
                                         "Saves files in Windows ICO file format",
@@ -211,8 +211,6 @@ ico_create_procedure (GimpPlugIn  *plug_in,
                                       "Christian Kreibich <christian whoop org>",
                                       "2002");
 
-      gimp_procedure_set_icon_name (procedure, GIMP_ICON_BRUSH);
-
       gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
                                           "image/x-ico");
       gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
diff --git a/plug-ins/file-sgi/sgi.c b/plug-ins/file-sgi/sgi.c
index 6d901adbd2..6d8b51af2e 100644
--- a/plug-ins/file-sgi/sgi.c
+++ b/plug-ins/file-sgi/sgi.c
@@ -165,6 +165,7 @@ sgi_create_procedure (GimpPlugIn  *plug_in,
 
       gimp_procedure_set_menu_label (procedure,
                                      N_("Silicon Graphics IRIS image"));
+      gimp_procedure_set_icon_name (procedure, GIMP_ICON_BRUSH);
 
       gimp_procedure_set_documentation (procedure,
                                         "Exports files in SGI image file format",
@@ -175,8 +176,6 @@ sgi_create_procedure (GimpPlugIn  *plug_in,
                                       "Copyright 1997-1998 by Michael Sweet",
                                       PLUG_IN_VERSION);
 
-      gimp_procedure_set_icon_name (procedure, GIMP_ICON_BRUSH);
-
       gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
                                           "image/x-sgi");
       gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
diff --git a/plug-ins/fractal-explorer/fractal-explorer.c b/plug-ins/fractal-explorer/fractal-explorer.c
index a19815d032..dece1eb8a6 100644
--- a/plug-ins/fractal-explorer/fractal-explorer.c
+++ b/plug-ins/fractal-explorer/fractal-explorer.c
@@ -94,6 +94,9 @@ static GimpProcedure  * explorer_create_procedure (GimpPlugIn           *plug_in
                                                    const gchar          *name);
 
 static GimpValueArray * explorer_run              (GimpProcedure        *procedure,
+                                                   GimpRunMode           run_mode,
+                                                   gint32                image_id,
+                                                   gint32                drawable_id,
                                                    const GimpValueArray *args,
                                                    gpointer              run_data);
 
@@ -157,7 +160,6 @@ gchar               *fractalexplorer_path = NULL;
 
 static gfloat        cx = -0.75;
 static gfloat        cy = -0.2;
-gint32               drawable_id;
 static GList        *fractalexplorer_list = NULL;
 
 explorer_interface_t wint =
@@ -225,8 +227,8 @@ explorer_create_procedure (GimpPlugIn  *plug_in,
 
   if (! strcmp (name, PLUG_IN_PROC))
     {
-      procedure = gimp_procedure_new (plug_in, name, GIMP_PLUGIN,
-                                      explorer_run, NULL, NULL);
+      procedure = gimp_image_procedure_new (plug_in, name, GIMP_PLUGIN,
+                                            explorer_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
 
@@ -244,25 +246,6 @@ explorer_create_procedure (GimpPlugIn  *plug_in,
                                       "www.multimania.com/cotting)",
                                       "December, 1998");
 
-      gimp_procedure_add_argument (procedure,
-                                   g_param_spec_enum ("run-mode",
-                                                      "Run mode",
-                                                      "The run mode",
-                                                      GIMP_TYPE_RUN_MODE,
-                                                      GIMP_RUN_NONINTERACTIVE,
-                                                      G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_image_id ("image",
-                                                             "Image",
-                                                             "The input image",
-                                                             FALSE,
-                                                             G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_drawable_id ("drawable",
-                                                                "Drawable",
-                                                                "The input drawable",
-                                                                FALSE,
-                                                                G_PARAM_READWRITE));
       gimp_procedure_add_argument (procedure,
                                    g_param_spec_int ("fractal-type",
                                                      "Fractal type",
@@ -414,10 +397,12 @@ explorer_create_procedure (GimpPlugIn  *plug_in,
 
 static GimpValueArray *
 explorer_run (GimpProcedure        *procedure,
+              GimpRunMode           run_mode,
+              gint32                image_id,
+              gint32                drawable_id,
               const GimpValueArray *args,
               gpointer              run_data)
 {
-  GimpRunMode        run_mode;
   gint               pwidth;
   gint               pheight;
   GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
@@ -427,7 +412,6 @@ explorer_run (GimpProcedure        *procedure,
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
-  run_mode    = g_value_get_enum           (gimp_value_array_index (args, 0));
   drawable_id = gimp_value_get_drawable_id (gimp_value_array_index (args, 2));
 
   if (! gimp_drawable_mask_intersect (drawable_id,
diff --git a/plug-ins/gfig/gfig.c b/plug-ins/gfig/gfig.c
index 3ba11e4c14..458b2add9c 100644
--- a/plug-ins/gfig/gfig.c
+++ b/plug-ins/gfig/gfig.c
@@ -81,6 +81,9 @@ static GimpProcedure  * gfig_create_procedure (GimpPlugIn           *plug_in,
                                                const gchar          *name);
 
 static GimpValueArray * gfig_run              (GimpProcedure        *procedure,
+                                               GimpRunMode           run_mode,
+                                               gint32                image_id,
+                                               gint32                drawable_id,
                                                const GimpValueArray *args,
                                                gpointer              run_data);
 
@@ -151,8 +154,8 @@ gfig_create_procedure (GimpPlugIn  *plug_in,
 
   if (! strcmp (name, PLUG_IN_PROC))
     {
-      procedure = gimp_procedure_new (plug_in, name, GIMP_PLUGIN,
-                                      gfig_run, NULL, NULL);
+      procedure = gimp_image_procedure_new (plug_in, name, GIMP_PLUGIN,
+                                            gfig_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
 
@@ -177,26 +180,6 @@ gfig_create_procedure (GimpPlugIn  *plug_in,
                                       "Andy Thomas",
                                       "Andy Thomas",
                                       "1997");
-
-      gimp_procedure_add_argument (procedure,
-                                   g_param_spec_enum ("run-mode",
-                                                      "Run mode",
-                                                      "The run mode",
-                                                      GIMP_TYPE_RUN_MODE,
-                                                      GIMP_RUN_NONINTERACTIVE,
-                                                      G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_image_id ("image",
-                                                             "Image",
-                                                             "The input image",
-                                                             FALSE,
-                                                             G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_drawable_id ("drawable",
-                                                                "Drawable",
-                                                                "The input drawable",
-                                                                FALSE,
-                                                                G_PARAM_READWRITE));
     }
 
   return procedure;
@@ -204,14 +187,14 @@ gfig_create_procedure (GimpPlugIn  *plug_in,
 
 static GimpValueArray *
 gfig_run (GimpProcedure        *procedure,
+          GimpRunMode           run_mode,
+          gint32                image_id,
+          gint32                drawable_id,
           const GimpValueArray *args,
           gpointer              run_data)
 {
-  GimpRunMode        run_mode;
-  gint32             image_id;
-  gint32             drawable_id;
-  GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
-  gint               pwidth, pheight;
+  GimpPDBStatusType status = GIMP_PDB_SUCCESS;
+  gint              pwidth, pheight;
 
   INIT_I18N ();
 
@@ -220,10 +203,6 @@ gfig_run (GimpProcedure        *procedure,
   gfig_context->show_background = TRUE;
   gfig_context->selected_obj    = NULL;
 
-  run_mode    = g_value_get_enum           (gimp_value_array_index (args, 0));
-  image_id    = gimp_value_get_image_id    (gimp_value_array_index (args, 1));
-  drawable_id = gimp_value_get_drawable_id (gimp_value_array_index (args, 2));
-
   gfig_context->image_id    = image_id;
   gfig_context->drawable_id = drawable_id;
 
diff --git a/plug-ins/goat-exercises/goat-exercise-c.c b/plug-ins/goat-exercises/goat-exercise-c.c
index 732ac0cdc8..2f7a17c221 100644
--- a/plug-ins/goat-exercises/goat-exercise-c.c
+++ b/plug-ins/goat-exercises/goat-exercise-c.c
@@ -107,8 +107,8 @@ goat_create_procedure (GimpPlugIn  *plug_in,
 
       gimp_procedure_set_image_types (procedure, "*");
 
-      gimp_procedure_set_menu_label (procedure,
-                                     N_("Exercise in _C minor"));
+      gimp_procedure_set_menu_label (procedure, N_("Exercise in _C minor"));
+      gimp_procedure_set_icon_name (procedure, GIMP_ICON_GEGL);
       gimp_procedure_add_menu_path (procedure,
                                     "<Image>/Filters/Development/Goat exercises/");
 
@@ -116,13 +116,10 @@ goat_create_procedure (GimpPlugIn  *plug_in,
                                         N_("Exercise a goat in the C language"),
                                         "Takes a goat for a walk",
                                         PLUG_IN_PROC);
-
       gimp_procedure_set_attribution (procedure,
                                       "Øyvind Kolås <pippin gimp org>",
                                       "Øyvind Kolås <pippin gimp org>",
                                       "21 march 2012");
-
-      gimp_procedure_set_icon_name (procedure, GIMP_ICON_GEGL);
     }
 
   return procedure;
diff --git a/plug-ins/pagecurl/pagecurl.c b/plug-ins/pagecurl/pagecurl.c
index 86266af3c8..e42cac54eb 100644
--- a/plug-ins/pagecurl/pagecurl.c
+++ b/plug-ins/pagecurl/pagecurl.c
@@ -127,6 +127,9 @@ static GimpProcedure  * pagecurl_create_procedure (GimpPlugIn           *plug_in
                                                    const gchar          *name);
 
 static GimpValueArray * pagecurl_run              (GimpProcedure        *procedure,
+                                                   GimpRunMode           run_mode,
+                                                   gint32                image_id,
+                                                   gint32                drawable_id,
                                                    const GimpValueArray *args,
                                                    gpointer              run_data);
 
@@ -214,8 +217,8 @@ pagecurl_create_procedure (GimpPlugIn  *plug_in,
 
   if (! strcmp (name, PLUG_IN_PROC))
     {
-      procedure = gimp_procedure_new (plug_in, name, GIMP_PLUGIN,
-                                      pagecurl_run, NULL, NULL);
+      procedure = gimp_image_procedure_new (plug_in, name, GIMP_PLUGIN,
+                                            pagecurl_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
 
@@ -231,25 +234,6 @@ pagecurl_create_procedure (GimpPlugIn  *plug_in,
                                       "Federico Mena Quintero and Simon Budig",
                                       PLUG_IN_VERSION);
 
-      gimp_procedure_add_argument (procedure,
-                                   g_param_spec_enum ("run-mode",
-                                                      "Run mode",
-                                                      "The run mode",
-                                                      GIMP_TYPE_RUN_MODE,
-                                                      GIMP_RUN_NONINTERACTIVE,
-                                                      G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_image_id ("image",
-                                                             "Image",
-                                                             "The input image",
-                                                             FALSE,
-                                                             G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_drawable_id ("drawable",
-                                                                "Drawable",
-                                                                "The input drawable",
-                                                                FALSE,
-                                                                G_PARAM_READWRITE));
       gimp_procedure_add_argument (procedure,
                                    g_param_spec_int ("colors",
                                                      "Colors",
@@ -294,19 +278,18 @@ pagecurl_create_procedure (GimpPlugIn  *plug_in,
 
 static GimpValueArray *
 pagecurl_run (GimpProcedure        *procedure,
+              GimpRunMode           run_mode,
+              gint32                image,
+              gint32                drawable_id,
               const GimpValueArray *args,
               gpointer              run_data)
 {
   GimpValueArray *return_vals = NULL;
-  GimpRunMode     run_mode;
-  gint32          drawable_id;
 
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
-  run_mode    = g_value_get_enum           (gimp_value_array_index (args, 0));
-  image_id    = gimp_value_get_image_id    (gimp_value_array_index (args, 1));
-  drawable_id = gimp_value_get_drawable_id (gimp_value_array_index (args, 2));
+  image_id = image;
 
   curl.colors      = g_value_get_int     (gimp_value_array_index (args, 3));
   curl.edge        = g_value_get_int     (gimp_value_array_index (args, 4));
diff --git a/plug-ins/print/print.c b/plug-ins/print/print.c
index 1c97b8eb61..c6338eaebf 100644
--- a/plug-ins/print/print.c
+++ b/plug-ins/print/print.c
@@ -68,6 +68,9 @@ static GimpProcedure    * print_create_procedure (GimpPlugIn           *plug_in,
                                                   const gchar          *name);
 
 static GimpValueArray   * print_run              (GimpProcedure        *procedure,
+                                                  GimpRunMode           run_mode,
+                                                  gint32                image_id,
+                                                  gint32                drawable_id,
                                                   const GimpValueArray *args,
                                                   gpointer              run_data);
 
@@ -148,15 +151,14 @@ print_create_procedure (GimpPlugIn  *plug_in,
 
   if (! strcmp (name, PRINT_PROC_NAME))
     {
-      procedure = gimp_procedure_new (plug_in, name, GIMP_PLUGIN,
-                                      print_run, NULL, NULL);
+      procedure = gimp_image_procedure_new (plug_in, name, GIMP_PLUGIN,
+                                            print_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "*");
 
       gimp_procedure_set_menu_label (procedure, N_("_Print..."));
-      gimp_procedure_add_menu_path (procedure, "<Image>/File/Send");
-
       gimp_procedure_set_icon_name (procedure, GIMP_ICON_DOCUMENT_PRINT);
+      gimp_procedure_add_menu_path (procedure, "<Image>/File/Send");
 
       gimp_procedure_set_documentation (procedure,
                                         N_("Print the image"),
@@ -172,15 +174,14 @@ print_create_procedure (GimpPlugIn  *plug_in,
 #ifndef EMBED_PAGE_SETUP
   else if (! strcmp (name, PAGE_SETUP_PROC_NAME))
     {
-      procedure = gimp_procedure_new (plug_in, name, GIMP_PLUGIN,
-                                      print_run, NULL, NULL);
+      procedure = gimp_image_procedure_new (plug_in, name, GIMP_PLUGIN,
+                                            print_run, NULL, NULL);
 
       gimp_procedure_set_image_types (procedure, "*");
 
       gimp_procedure_set_menu_label (procedure, N_("Page Set_up"));
-      gimp_procedure_add_menu_path (procedure, "<Image>/File/Send");
-
       gimp_procedure_set_icon_name (procedure, GIMP_ICON_DOCUMENT_PAGE_SETUP);
+      gimp_procedure_add_menu_path (procedure, "<Image>/File/Send");
 
       gimp_procedure_set_documentation (procedure,
                                         N_("Adjust page size and orientation "
@@ -196,46 +197,27 @@ print_create_procedure (GimpPlugIn  *plug_in,
     }
 #endif
 
-  if (procedure)
-    {
-      gimp_procedure_add_argument (procedure,
-                                   g_param_spec_enum ("run-mode",
-                                                      "Run mode",
-                                                      "The run mode",
-                                                      GIMP_TYPE_RUN_MODE,
-                                                      GIMP_RUN_INTERACTIVE,
-                                                      G_PARAM_READWRITE));
-      gimp_procedure_add_argument (procedure,
-                                   gimp_param_spec_image_id ("image",
-                                                             "Image",
-                                                             "The image to save",
-                                                             FALSE,
-                                                             G_PARAM_READWRITE));
-    }
-
   return procedure;
 }
 
 static GimpValueArray *
 print_run (GimpProcedure        *procedure,
+           GimpRunMode           run_mode,
+           gint32                image_id,
+           gint32                drawable_id,
            const GimpValueArray *args,
            gpointer              run_data)
 {
-  GimpRunMode        run_mode;
-  gint32             image_ID;
   GimpPDBStatusType  status;
   GError            *error = NULL;
 
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
-  run_mode    = g_value_get_enum           (gimp_value_array_index (args, 0));
-  image_ID    = gimp_value_get_image_id    (gimp_value_array_index (args, 1));
-
   if (strcmp (gimp_procedure_get_name (procedure),
               PRINT_PROC_NAME) == 0)
     {
-      status = print_image (image_ID, run_mode == GIMP_RUN_INTERACTIVE, &error);
+      status = print_image (image_id, run_mode == GIMP_RUN_INTERACTIVE, &error);
 
       if (error && run_mode == GIMP_RUN_INTERACTIVE)
         {
@@ -248,7 +230,7 @@ print_run (GimpProcedure        *procedure,
     {
       if (run_mode == GIMP_RUN_INTERACTIVE)
         {
-          status = page_setup (image_ID);
+          status = page_setup (image_id);
         }
       else
         {


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