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 <gegl.h>
23 
24 #include <gdk-pixbuf/gdk-pixbuf.h>
25 
26 #include "libgimpbase/gimpbase.h"
27 
28 #include "pdb-types.h"
29 
30 #include "core/gimp.h"
31 #include "core/gimpparamspecs.h"
32 #include "plug-in/gimpplugin.h"
33 #include "plug-in/gimppluginmanager-help-domain.h"
34 #include "plug-in/gimppluginmanager.h"
35 
36 #include "gimppdb.h"
37 #include "gimpprocedure.h"
38 #include "internal-procs.h"
39 
40 
41 static GimpValueArray *
help_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)42 help_invoker (GimpProcedure         *procedure,
43               Gimp                  *gimp,
44               GimpContext           *context,
45               GimpProgress          *progress,
46               const GimpValueArray  *args,
47               GError               **error)
48 {
49   gboolean success = TRUE;
50   const gchar *help_domain;
51   const gchar *help_id;
52 
53   help_domain = g_value_get_string (gimp_value_array_index (args, 0));
54   help_id = g_value_get_string (gimp_value_array_index (args, 1));
55 
56   if (success)
57     {
58       GimpPlugInManager *manager = gimp->plug_in_manager;
59 
60       if (! help_domain && manager->current_plug_in)
61         help_domain = (gchar *)
62           gimp_plug_in_manager_get_help_domain (manager,
63                                                 manager->current_plug_in->file,
64                                                 NULL);
65 
66       gimp_help (gimp, progress, help_domain, help_id);
67     }
68 
69   return gimp_procedure_get_return_values (procedure, success,
70                                            error ? *error : NULL);
71 }
72 
73 void
register_help_procs(GimpPDB * pdb)74 register_help_procs (GimpPDB *pdb)
75 {
76   GimpProcedure *procedure;
77 
78   /*
79    * gimp-help
80    */
81   procedure = gimp_procedure_new (help_invoker);
82   gimp_object_set_static_name (GIMP_OBJECT (procedure),
83                                "gimp-help");
84   gimp_procedure_set_static_strings (procedure,
85                                      "gimp-help",
86                                      "Load a help page.",
87                                      "This procedure loads the specified help page into the helpbrowser or what ever is configured as help viewer. The help page is identified by its domain and ID: if help_domain is NULL, we use the help_domain which was registered using the 'gimp-plugin-help-register' procedure. If help_domain is NULL and no help domain was registered, the help domain of the main GIMP installation is used.",
88                                      "Michael Natterer <mitch@gimp.org>",
89                                      "Michael Natterer",
90                                      "2000",
91                                      NULL);
92   gimp_procedure_add_argument (procedure,
93                                gimp_param_spec_string ("help-domain",
94                                                        "help domain",
95                                                        "The help domain in which help_id is registered",
96                                                        FALSE, TRUE, FALSE,
97                                                        NULL,
98                                                        GIMP_PARAM_READWRITE));
99   gimp_procedure_add_argument (procedure,
100                                gimp_param_spec_string ("help-id",
101                                                        "help id",
102                                                        "The help page's ID",
103                                                        FALSE, FALSE, FALSE,
104                                                        NULL,
105                                                        GIMP_PARAM_READWRITE));
106   gimp_pdb_register_procedure (pdb, procedure);
107   g_object_unref (procedure);
108 }
109