1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 /* NOTE: This file is auto-generated by pdbgen.pl. */
19 
20 #include "config.h"
21 
22 #include <stdlib.h>
23 #include <string.h>
24 
25 #include <gegl.h>
26 
27 #include <gdk-pixbuf/gdk-pixbuf.h>
28 
29 #include "libgimpbase/gimpbase.h"
30 
31 #include "libgimpbase/gimpbase.h"
32 
33 #include "pdb-types.h"
34 
35 #include "core/gimp.h"
36 #include "core/gimpparamspecs.h"
37 #include "plug-in/gimpplugin.h"
38 #include "plug-in/gimpplugindef.h"
39 #include "plug-in/gimppluginmanager-menu-branch.h"
40 #include "plug-in/gimppluginmanager-query.h"
41 #include "plug-in/gimppluginmanager.h"
42 #include "plug-in/gimppluginprocedure.h"
43 
44 #include "gimppdb.h"
45 #include "gimpprocedure.h"
46 #include "internal-procs.h"
47 
48 
49 static GimpValueArray *
plugins_query_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)50 plugins_query_invoker (GimpProcedure         *procedure,
51                        Gimp                  *gimp,
52                        GimpContext           *context,
53                        GimpProgress          *progress,
54                        const GimpValueArray  *args,
55                        GError               **error)
56 {
57   GimpValueArray *return_vals;
58   const gchar *search_string;
59   gint32 num_plugins = 0;
60   gchar **menu_path = NULL;
61   gchar **plugin_accelerator = NULL;
62   gchar **plugin_location = NULL;
63   gchar **plugin_image_type = NULL;
64   gint32 *plugin_install_time = NULL;
65   gchar **plugin_real_name = NULL;
66 
67   search_string = g_value_get_string (gimp_value_array_index (args, 0));
68 
69   num_plugins = gimp_plug_in_manager_query (gimp->plug_in_manager,
70                                             search_string,
71                                             &menu_path,
72                                             &plugin_accelerator,
73                                             &plugin_location,
74                                             &plugin_image_type,
75                                             &plugin_real_name,
76                                             &plugin_install_time);
77 
78   return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
79 
80   g_value_set_int (gimp_value_array_index (return_vals, 1), num_plugins);
81   gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), menu_path, num_plugins);
82   g_value_set_int (gimp_value_array_index (return_vals, 3), num_plugins);
83   gimp_value_take_stringarray (gimp_value_array_index (return_vals, 4), plugin_accelerator, num_plugins);
84   g_value_set_int (gimp_value_array_index (return_vals, 5), num_plugins);
85   gimp_value_take_stringarray (gimp_value_array_index (return_vals, 6), plugin_location, num_plugins);
86   g_value_set_int (gimp_value_array_index (return_vals, 7), num_plugins);
87   gimp_value_take_stringarray (gimp_value_array_index (return_vals, 8), plugin_image_type, num_plugins);
88   g_value_set_int (gimp_value_array_index (return_vals, 9), num_plugins);
89   gimp_value_take_int32array (gimp_value_array_index (return_vals, 10), plugin_install_time, num_plugins);
90   g_value_set_int (gimp_value_array_index (return_vals, 11), num_plugins);
91   gimp_value_take_stringarray (gimp_value_array_index (return_vals, 12), plugin_real_name, num_plugins);
92 
93   return return_vals;
94 }
95 
96 static GimpValueArray *
plugin_domain_register_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)97 plugin_domain_register_invoker (GimpProcedure         *procedure,
98                                 Gimp                  *gimp,
99                                 GimpContext           *context,
100                                 GimpProgress          *progress,
101                                 const GimpValueArray  *args,
102                                 GError               **error)
103 {
104   gboolean success = TRUE;
105   const gchar *domain_name;
106   const gchar *domain_path;
107 
108   domain_name = g_value_get_string (gimp_value_array_index (args, 0));
109   domain_path = g_value_get_string (gimp_value_array_index (args, 1));
110 
111   if (success)
112     {
113       GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
114 
115       if (plug_in && plug_in->call_mode == GIMP_PLUG_IN_CALL_QUERY)
116         {
117           gimp_plug_in_def_set_locale_domain (plug_in->plug_in_def,
118                                               domain_name, domain_path);
119         }
120       else
121         {
122           success = FALSE;
123         }
124     }
125 
126   return gimp_procedure_get_return_values (procedure, success,
127                                            error ? *error : NULL);
128 }
129 
130 static GimpValueArray *
plugin_help_register_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)131 plugin_help_register_invoker (GimpProcedure         *procedure,
132                               Gimp                  *gimp,
133                               GimpContext           *context,
134                               GimpProgress          *progress,
135                               const GimpValueArray  *args,
136                               GError               **error)
137 {
138   gboolean success = TRUE;
139   const gchar *domain_name;
140   const gchar *domain_uri;
141 
142   domain_name = g_value_get_string (gimp_value_array_index (args, 0));
143   domain_uri = g_value_get_string (gimp_value_array_index (args, 1));
144 
145   if (success)
146     {
147       GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
148 
149       if (plug_in && plug_in->call_mode == GIMP_PLUG_IN_CALL_QUERY)
150         {
151           gimp_plug_in_def_set_help_domain (plug_in->plug_in_def,
152                                             domain_name, domain_uri);
153         }
154       else
155         {
156           success = FALSE;
157         }
158     }
159 
160   return gimp_procedure_get_return_values (procedure, success,
161                                            error ? *error : NULL);
162 }
163 
164 static GimpValueArray *
plugin_menu_register_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)165 plugin_menu_register_invoker (GimpProcedure         *procedure,
166                               Gimp                  *gimp,
167                               GimpContext           *context,
168                               GimpProgress          *progress,
169                               const GimpValueArray  *args,
170                               GError               **error)
171 {
172   gboolean success = TRUE;
173   const gchar *procedure_name;
174   const gchar *menu_path;
175 
176   procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
177   menu_path = g_value_get_string (gimp_value_array_index (args, 1));
178 
179   if (success)
180     {
181       GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
182 
183       if (plug_in)
184         {
185           gchar *canonical = gimp_canonicalize_identifier (procedure_name);
186           success = gimp_plug_in_menu_register (plug_in, canonical, menu_path);
187           g_free (canonical);
188         }
189       else
190         {
191           success = FALSE;
192         }
193     }
194 
195   return gimp_procedure_get_return_values (procedure, success,
196                                            error ? *error : NULL);
197 }
198 
199 static GimpValueArray *
plugin_menu_branch_register_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)200 plugin_menu_branch_register_invoker (GimpProcedure         *procedure,
201                                      Gimp                  *gimp,
202                                      GimpContext           *context,
203                                      GimpProgress          *progress,
204                                      const GimpValueArray  *args,
205                                      GError               **error)
206 {
207   gboolean success = TRUE;
208   const gchar *menu_path;
209   const gchar *menu_name;
210 
211   menu_path = g_value_get_string (gimp_value_array_index (args, 0));
212   menu_name = g_value_get_string (gimp_value_array_index (args, 1));
213 
214   if (success)
215     {
216       GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
217 
218       if (plug_in)
219         {
220           gimp_plug_in_manager_add_menu_branch (gimp->plug_in_manager,
221                                                 plug_in->file, menu_path, menu_name);
222         }
223       else
224         {
225           success = FALSE;
226         }
227     }
228 
229   return gimp_procedure_get_return_values (procedure, success,
230                                            error ? *error : NULL);
231 }
232 
233 static GimpValueArray *
plugin_icon_register_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)234 plugin_icon_register_invoker (GimpProcedure         *procedure,
235                               Gimp                  *gimp,
236                               GimpContext           *context,
237                               GimpProgress          *progress,
238                               const GimpValueArray  *args,
239                               GError               **error)
240 {
241   gboolean success = TRUE;
242   const gchar *procedure_name;
243   gint32 icon_type;
244   gint32 icon_data_length;
245   const guint8 *icon_data;
246 
247   procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
248   icon_type = g_value_get_enum (gimp_value_array_index (args, 1));
249   icon_data_length = g_value_get_int (gimp_value_array_index (args, 2));
250   icon_data = gimp_value_get_int8array (gimp_value_array_index (args, 3));
251 
252   if (success)
253     {
254       GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
255 
256       if (plug_in && plug_in->call_mode == GIMP_PLUG_IN_CALL_QUERY)
257         {
258           GimpPlugInProcedure *proc;
259           gchar               *canonical;
260 
261           canonical = gimp_canonicalize_identifier (procedure_name);
262 
263           proc = gimp_plug_in_procedure_find (plug_in->plug_in_def->procedures,
264                                               canonical);
265 
266           g_free (canonical);
267 
268           if (proc)
269             gimp_plug_in_procedure_set_icon (proc, icon_type,
270                                              icon_data, icon_data_length);
271           else
272             success = FALSE;
273         }
274       else
275         {
276           success = FALSE;
277         }
278     }
279 
280   return gimp_procedure_get_return_values (procedure, success,
281                                            error ? *error : NULL);
282 }
283 
284 static GimpValueArray *
plugin_set_pdb_error_handler_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)285 plugin_set_pdb_error_handler_invoker (GimpProcedure         *procedure,
286                                       Gimp                  *gimp,
287                                       GimpContext           *context,
288                                       GimpProgress          *progress,
289                                       const GimpValueArray  *args,
290                                       GError               **error)
291 {
292   gboolean success = TRUE;
293   gint32 handler;
294 
295   handler = g_value_get_enum (gimp_value_array_index (args, 0));
296 
297   if (success)
298     {
299       GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
300 
301       if (plug_in)
302         {
303           gimp_plug_in_set_error_handler (plug_in, handler);
304         }
305       else
306         {
307           success = FALSE;
308         }
309     }
310 
311   return gimp_procedure_get_return_values (procedure, success,
312                                            error ? *error : NULL);
313 }
314 
315 static GimpValueArray *
plugin_get_pdb_error_handler_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)316 plugin_get_pdb_error_handler_invoker (GimpProcedure         *procedure,
317                                       Gimp                  *gimp,
318                                       GimpContext           *context,
319                                       GimpProgress          *progress,
320                                       const GimpValueArray  *args,
321                                       GError               **error)
322 {
323   gboolean success = TRUE;
324   GimpValueArray *return_vals;
325   gint32 handler = 0;
326 
327   GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
328 
329   if (plug_in)
330     {
331       handler = gimp_plug_in_get_error_handler (plug_in);
332     }
333   else
334     {
335       success = FALSE;
336     }
337 
338   return_vals = gimp_procedure_get_return_values (procedure, success,
339                                                   error ? *error : NULL);
340 
341   if (success)
342     g_value_set_enum (gimp_value_array_index (return_vals, 1), handler);
343 
344   return return_vals;
345 }
346 
347 static GimpValueArray *
plugin_enable_precision_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)348 plugin_enable_precision_invoker (GimpProcedure         *procedure,
349                                  Gimp                  *gimp,
350                                  GimpContext           *context,
351                                  GimpProgress          *progress,
352                                  const GimpValueArray  *args,
353                                  GError               **error)
354 {
355   gboolean success = TRUE;
356   GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
357 
358   if (plug_in)
359     {
360       gimp_plug_in_enable_precision (plug_in);
361     }
362   else
363     {
364       success = FALSE;
365     }
366 
367   return gimp_procedure_get_return_values (procedure, success,
368                                            error ? *error : NULL);
369 }
370 
371 static GimpValueArray *
plugin_precision_enabled_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)372 plugin_precision_enabled_invoker (GimpProcedure         *procedure,
373                                   Gimp                  *gimp,
374                                   GimpContext           *context,
375                                   GimpProgress          *progress,
376                                   const GimpValueArray  *args,
377                                   GError               **error)
378 {
379   gboolean success = TRUE;
380   GimpValueArray *return_vals;
381   gboolean enabled = FALSE;
382 
383   GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
384 
385   if (plug_in)
386     {
387       enabled = gimp_plug_in_precision_enabled (plug_in);
388     }
389   else
390     {
391       success = FALSE;
392     }
393 
394   return_vals = gimp_procedure_get_return_values (procedure, success,
395                                                   error ? *error : NULL);
396 
397   if (success)
398     g_value_set_boolean (gimp_value_array_index (return_vals, 1), enabled);
399 
400   return return_vals;
401 }
402 
403 void
register_plug_in_procs(GimpPDB * pdb)404 register_plug_in_procs (GimpPDB *pdb)
405 {
406   GimpProcedure *procedure;
407 
408   /*
409    * gimp-plugins-query
410    */
411   procedure = gimp_procedure_new (plugins_query_invoker);
412   gimp_object_set_static_name (GIMP_OBJECT (procedure),
413                                "gimp-plugins-query");
414   gimp_procedure_set_static_strings (procedure,
415                                      "gimp-plugins-query",
416                                      "Queries the plug-in database for its contents.",
417                                      "This procedure queries the contents of the plug-in database.",
418                                      "Andy Thomas",
419                                      "Andy Thomas",
420                                      "1998",
421                                      NULL);
422   gimp_procedure_add_argument (procedure,
423                                gimp_param_spec_string ("search-string",
424                                                        "search string",
425                                                        "If not an empty string then use this as a search pattern",
426                                                        FALSE, FALSE, FALSE,
427                                                        NULL,
428                                                        GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
429   gimp_procedure_add_return_value (procedure,
430                                    gimp_param_spec_int32 ("num-plugins",
431                                                           "num plugins",
432                                                           "The number of plug-ins",
433                                                           0, G_MAXINT32, 0,
434                                                           GIMP_PARAM_READWRITE));
435   gimp_procedure_add_return_value (procedure,
436                                    gimp_param_spec_string_array ("menu-path",
437                                                                  "menu path",
438                                                                  "The menu path of the plug-in",
439                                                                  GIMP_PARAM_READWRITE));
440   gimp_procedure_add_return_value (procedure,
441                                    gimp_param_spec_int32 ("num-plugins",
442                                                           "num plugins",
443                                                           "The number of plug-ins",
444                                                           0, G_MAXINT32, 0,
445                                                           GIMP_PARAM_READWRITE));
446   gimp_procedure_add_return_value (procedure,
447                                    gimp_param_spec_string_array ("plugin-accelerator",
448                                                                  "plugin accelerator",
449                                                                  "String representing keyboard accelerator (could be empty string)",
450                                                                  GIMP_PARAM_READWRITE));
451   gimp_procedure_add_return_value (procedure,
452                                    gimp_param_spec_int32 ("num-plugins",
453                                                           "num plugins",
454                                                           "The number of plug-ins",
455                                                           0, G_MAXINT32, 0,
456                                                           GIMP_PARAM_READWRITE));
457   gimp_procedure_add_return_value (procedure,
458                                    gimp_param_spec_string_array ("plugin-location",
459                                                                  "plugin location",
460                                                                  "Location of the plug-in program",
461                                                                  GIMP_PARAM_READWRITE));
462   gimp_procedure_add_return_value (procedure,
463                                    gimp_param_spec_int32 ("num-plugins",
464                                                           "num plugins",
465                                                           "The number of plug-ins",
466                                                           0, G_MAXINT32, 0,
467                                                           GIMP_PARAM_READWRITE));
468   gimp_procedure_add_return_value (procedure,
469                                    gimp_param_spec_string_array ("plugin-image-type",
470                                                                  "plugin image type",
471                                                                  "Type of image that this plug-in will work on",
472                                                                  GIMP_PARAM_READWRITE));
473   gimp_procedure_add_return_value (procedure,
474                                    gimp_param_spec_int32 ("num-plugins",
475                                                           "num plugins",
476                                                           "The number of plug-ins",
477                                                           0, G_MAXINT32, 0,
478                                                           GIMP_PARAM_READWRITE));
479   gimp_procedure_add_return_value (procedure,
480                                    gimp_param_spec_int32_array ("plugin-install-time",
481                                                                 "plugin install time",
482                                                                 "Time that the plug-in was installed",
483                                                                 GIMP_PARAM_READWRITE));
484   gimp_procedure_add_return_value (procedure,
485                                    gimp_param_spec_int32 ("num-plugins",
486                                                           "num plugins",
487                                                           "The number of plug-ins",
488                                                           0, G_MAXINT32, 0,
489                                                           GIMP_PARAM_READWRITE));
490   gimp_procedure_add_return_value (procedure,
491                                    gimp_param_spec_string_array ("plugin-real-name",
492                                                                  "plugin real name",
493                                                                  "The internal name of the plug-in",
494                                                                  GIMP_PARAM_READWRITE));
495   gimp_pdb_register_procedure (pdb, procedure);
496   g_object_unref (procedure);
497 
498   /*
499    * gimp-plugin-domain-register
500    */
501   procedure = gimp_procedure_new (plugin_domain_register_invoker);
502   gimp_object_set_static_name (GIMP_OBJECT (procedure),
503                                "gimp-plugin-domain-register");
504   gimp_procedure_set_static_strings (procedure,
505                                      "gimp-plugin-domain-register",
506                                      "Registers a textdomain for localisation.",
507                                      "This procedure adds a textdomain to the list of domains Gimp searches for strings when translating its menu entries. There is no need to call this function for plug-ins that have their strings included in the 'gimp-std-plugins' domain as that is used by default. If the compiled message catalog is not in the standard location, you may specify an absolute path to another location. This procedure can only be called in the query function of a plug-in and it has to be called before any procedure is installed.",
508                                      "Sven Neumann <sven@gimp.org>",
509                                      "Sven Neumann",
510                                      "2000",
511                                      NULL);
512   gimp_procedure_add_argument (procedure,
513                                gimp_param_spec_string ("domain-name",
514                                                        "domain name",
515                                                        "The name of the textdomain (must be unique)",
516                                                        FALSE, FALSE, FALSE,
517                                                        NULL,
518                                                        GIMP_PARAM_READWRITE));
519   gimp_procedure_add_argument (procedure,
520                                gimp_param_spec_string ("domain-path",
521                                                        "domain path",
522                                                        "The absolute path to the compiled message catalog (may be NULL)",
523                                                        FALSE, FALSE, FALSE,
524                                                        NULL,
525                                                        GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
526   gimp_pdb_register_procedure (pdb, procedure);
527   g_object_unref (procedure);
528 
529   /*
530    * gimp-plugin-help-register
531    */
532   procedure = gimp_procedure_new (plugin_help_register_invoker);
533   gimp_object_set_static_name (GIMP_OBJECT (procedure),
534                                "gimp-plugin-help-register");
535   gimp_procedure_set_static_strings (procedure,
536                                      "gimp-plugin-help-register",
537                                      "Register a help path for a plug-in.",
538                                      "This procedure registers user documentation for the calling plug-in with the GIMP help system. The domain_uri parameter points to the root directory where the plug-in help is installed. For each supported language there should be a file called 'gimp-help.xml' that maps the help IDs to the actual help files.",
539                                      "Michael Natterer <mitch@gimp.org>",
540                                      "Michael Natterer",
541                                      "2000",
542                                      NULL);
543   gimp_procedure_add_argument (procedure,
544                                gimp_param_spec_string ("domain-name",
545                                                        "domain name",
546                                                        "The XML namespace of the plug-in's help pages",
547                                                        FALSE, FALSE, FALSE,
548                                                        NULL,
549                                                        GIMP_PARAM_READWRITE));
550   gimp_procedure_add_argument (procedure,
551                                gimp_param_spec_string ("domain-uri",
552                                                        "domain uri",
553                                                        "The root URI of the plug-in's help pages",
554                                                        FALSE, FALSE, FALSE,
555                                                        NULL,
556                                                        GIMP_PARAM_READWRITE));
557   gimp_pdb_register_procedure (pdb, procedure);
558   g_object_unref (procedure);
559 
560   /*
561    * gimp-plugin-menu-register
562    */
563   procedure = gimp_procedure_new (plugin_menu_register_invoker);
564   gimp_object_set_static_name (GIMP_OBJECT (procedure),
565                                "gimp-plugin-menu-register");
566   gimp_procedure_set_static_strings (procedure,
567                                      "gimp-plugin-menu-register",
568                                      "Register an additional menu path for a plug-in procedure.",
569                                      "This procedure installs an additional menu entry for the given procedure.",
570                                      "Michael Natterer <mitch@gimp.org>",
571                                      "Michael Natterer",
572                                      "2004",
573                                      NULL);
574   gimp_procedure_add_argument (procedure,
575                                gimp_param_spec_string ("procedure-name",
576                                                        "procedure name",
577                                                        "The procedure for which to install the menu path",
578                                                        FALSE, FALSE, TRUE,
579                                                        NULL,
580                                                        GIMP_PARAM_READWRITE));
581   gimp_procedure_add_argument (procedure,
582                                gimp_param_spec_string ("menu-path",
583                                                        "menu path",
584                                                        "The procedure's additional menu path",
585                                                        FALSE, FALSE, FALSE,
586                                                        NULL,
587                                                        GIMP_PARAM_READWRITE));
588   gimp_pdb_register_procedure (pdb, procedure);
589   g_object_unref (procedure);
590 
591   /*
592    * gimp-plugin-menu-branch-register
593    */
594   procedure = gimp_procedure_new (plugin_menu_branch_register_invoker);
595   gimp_object_set_static_name (GIMP_OBJECT (procedure),
596                                "gimp-plugin-menu-branch-register");
597   gimp_procedure_set_static_strings (procedure,
598                                      "gimp-plugin-menu-branch-register",
599                                      "Register a sub-menu.",
600                                      "This procedure installs a sub-menu which does not belong to any procedure. The menu-name should be the untranslated menu label. GIMP will look up the translation in the textdomain registered for the plug-in.",
601                                      "Michael Natterer <mitch@gimp.org>",
602                                      "Michael Natterer",
603                                      "2005",
604                                      NULL);
605   gimp_procedure_add_argument (procedure,
606                                gimp_param_spec_string ("menu-path",
607                                                        "menu path",
608                                                        "The sub-menu's menu path",
609                                                        FALSE, FALSE, FALSE,
610                                                        NULL,
611                                                        GIMP_PARAM_READWRITE));
612   gimp_procedure_add_argument (procedure,
613                                gimp_param_spec_string ("menu-name",
614                                                        "menu name",
615                                                        "The name of the sub-menu",
616                                                        FALSE, FALSE, FALSE,
617                                                        NULL,
618                                                        GIMP_PARAM_READWRITE));
619   gimp_pdb_register_procedure (pdb, procedure);
620   g_object_unref (procedure);
621 
622   /*
623    * gimp-plugin-icon-register
624    */
625   procedure = gimp_procedure_new (plugin_icon_register_invoker);
626   gimp_object_set_static_name (GIMP_OBJECT (procedure),
627                                "gimp-plugin-icon-register");
628   gimp_procedure_set_static_strings (procedure,
629                                      "gimp-plugin-icon-register",
630                                      "Register an icon for a plug-in procedure.",
631                                      "This procedure installs an icon for the given procedure.",
632                                      "Michael Natterer <mitch@gimp.org>",
633                                      "Michael Natterer",
634                                      "2004",
635                                      NULL);
636   gimp_procedure_add_argument (procedure,
637                                gimp_param_spec_string ("procedure-name",
638                                                        "procedure name",
639                                                        "The procedure for which to install the icon",
640                                                        FALSE, FALSE, TRUE,
641                                                        NULL,
642                                                        GIMP_PARAM_READWRITE));
643   gimp_procedure_add_argument (procedure,
644                                g_param_spec_enum ("icon-type",
645                                                   "icon type",
646                                                   "The type of the icon",
647                                                   GIMP_TYPE_ICON_TYPE,
648                                                   GIMP_ICON_TYPE_ICON_NAME,
649                                                   GIMP_PARAM_READWRITE));
650   gimp_procedure_add_argument (procedure,
651                                gimp_param_spec_int32 ("icon-data-length",
652                                                       "icon data length",
653                                                       "The length of 'icon-data'",
654                                                       1, G_MAXINT32, 1,
655                                                       GIMP_PARAM_READWRITE));
656   gimp_procedure_add_argument (procedure,
657                                gimp_param_spec_int8_array ("icon-data",
658                                                            "icon data",
659                                                            "The procedure's icon. The format depends on the 'icon_type' parameter",
660                                                            GIMP_PARAM_READWRITE));
661   gimp_pdb_register_procedure (pdb, procedure);
662   g_object_unref (procedure);
663 
664   /*
665    * gimp-plugin-set-pdb-error-handler
666    */
667   procedure = gimp_procedure_new (plugin_set_pdb_error_handler_invoker);
668   gimp_object_set_static_name (GIMP_OBJECT (procedure),
669                                "gimp-plugin-set-pdb-error-handler");
670   gimp_procedure_set_static_strings (procedure,
671                                      "gimp-plugin-set-pdb-error-handler",
672                                      "Sets an error handler for procedure calls.",
673                                      "This procedure changes the way that errors in procedure calls are handled. By default GIMP will raise an error dialog if a procedure call made by a plug-in fails. Using this procedure the plug-in can change this behavior. If the error handler is set to %GIMP_PDB_ERROR_HANDLER_PLUGIN, then the plug-in is responsible for calling 'gimp-get-pdb-error' and handling the error whenever one if its procedure calls fails. It can do this by displaying the error message or by forwarding it in its own return values.",
674                                      "Sven Neumann <sven@gimp.org>",
675                                      "Sven Neumann",
676                                      "2008",
677                                      NULL);
678   gimp_procedure_add_argument (procedure,
679                                g_param_spec_enum ("handler",
680                                                   "handler",
681                                                   "Who is responsible for handling procedure call errors",
682                                                   GIMP_TYPE_PDB_ERROR_HANDLER,
683                                                   GIMP_PDB_ERROR_HANDLER_INTERNAL,
684                                                   GIMP_PARAM_READWRITE));
685   gimp_pdb_register_procedure (pdb, procedure);
686   g_object_unref (procedure);
687 
688   /*
689    * gimp-plugin-get-pdb-error-handler
690    */
691   procedure = gimp_procedure_new (plugin_get_pdb_error_handler_invoker);
692   gimp_object_set_static_name (GIMP_OBJECT (procedure),
693                                "gimp-plugin-get-pdb-error-handler");
694   gimp_procedure_set_static_strings (procedure,
695                                      "gimp-plugin-get-pdb-error-handler",
696                                      "Retrieves the active error handler for procedure calls.",
697                                      "This procedure retrieves the currently active error handler for procedure calls made by the calling plug-in. See 'gimp-plugin-set-pdb-error-handler' for details.",
698                                      "Sven Neumann <sven@gimp.org>",
699                                      "Sven Neumann",
700                                      "2008",
701                                      NULL);
702   gimp_procedure_add_return_value (procedure,
703                                    g_param_spec_enum ("handler",
704                                                       "handler",
705                                                       "Who is responsible for handling procedure call errors",
706                                                       GIMP_TYPE_PDB_ERROR_HANDLER,
707                                                       GIMP_PDB_ERROR_HANDLER_INTERNAL,
708                                                       GIMP_PARAM_READWRITE));
709   gimp_pdb_register_procedure (pdb, procedure);
710   g_object_unref (procedure);
711 
712   /*
713    * gimp-plugin-enable-precision
714    */
715   procedure = gimp_procedure_new (plugin_enable_precision_invoker);
716   gimp_object_set_static_name (GIMP_OBJECT (procedure),
717                                "gimp-plugin-enable-precision");
718   gimp_procedure_set_static_strings (procedure,
719                                      "gimp-plugin-enable-precision",
720                                      "Switches this plug-in to using the real bit depth of drawables.",
721                                      "Switches this plug-in to using the real bit depth of drawables. This setting can only be enabled, and not disabled again during the lifetime of the plug-in. Using 'gimp-drawable-get-buffer', 'gimp-drawable-get-shadow-buffer' or 'gimp-drawable-get-format' will automatically call this function.",
722                                      "Michael Natterer <mitch@gimp.org>",
723                                      "Michael Natterer",
724                                      "2012",
725                                      NULL);
726   gimp_pdb_register_procedure (pdb, procedure);
727   g_object_unref (procedure);
728 
729   /*
730    * gimp-plugin-precision-enabled
731    */
732   procedure = gimp_procedure_new (plugin_precision_enabled_invoker);
733   gimp_object_set_static_name (GIMP_OBJECT (procedure),
734                                "gimp-plugin-precision-enabled");
735   gimp_procedure_set_static_strings (procedure,
736                                      "gimp-plugin-precision-enabled",
737                                      "Whether this plug-in is using the real bit depth of drawables.",
738                                      "Returns whether this plug-in is using the real bit depth of drawables, which can be more than 8 bits per channel.",
739                                      "Michael Natterer <mitch@gimp.org>",
740                                      "Michael Natterer",
741                                      "2012",
742                                      NULL);
743   gimp_procedure_add_return_value (procedure,
744                                    g_param_spec_boolean ("enabled",
745                                                          "enabled",
746                                                          "Whether precision is enabled",
747                                                          FALSE,
748                                                          GIMP_PARAM_READWRITE));
749   gimp_pdb_register_procedure (pdb, procedure);
750   g_object_unref (procedure);
751 }
752