help-cmds.c 4.15 KB
Newer Older
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 8 9 10 11 12 13 14
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 17
 */

18
/* NOTE: This file is auto-generated by pdbgen.pl. */
19

20 21
#include "config.h"

22
#include <gegl.h>
23

24
#include "pdb-types.h"
25

26
#include "core/gimp.h"
27
#include "core/gimpparamspecs.h"
28
#include "plug-in/gimpplugin.h"
29 30
#include "plug-in/gimppluginmanager-help-domain.h"
#include "plug-in/gimppluginmanager.h"
31

32 33
#include "gimppdb.h"
#include "gimpprocedure.h"
34
#include "internal-procs.h"
35

36

37
static GValueArray *
38 39 40 41 42 43
help_invoker (GimpProcedure      *procedure,
              Gimp               *gimp,
              GimpContext        *context,
              GimpProgress       *progress,
              const GValueArray  *args,
              GError            **error)
44 45
{
  gboolean success = TRUE;
46 47
  const gchar *help_domain;
  const gchar *help_id;
48

49 50
  help_domain = g_value_get_string (&args->values[0]);
  help_id = g_value_get_string (&args->values[1]);
51 52

  if (success)
53
    {
54 55 56
      GimpPlugInManager *manager = gimp->plug_in_manager;

      if (! help_domain && manager->current_plug_in)
57
        help_domain = (gchar *)
58 59 60
          gimp_plug_in_manager_get_help_domain (manager,
                                                manager->current_plug_in->prog,
                                                NULL);
61

62
      gimp_help (gimp, progress, help_domain, help_id);
63
    }
64

65 66
  return gimp_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
67 68
}

69
void
70
register_help_procs (GimpPDB *pdb)
71
{
72 73 74 75 76
  GimpProcedure *procedure;

  /*
   * gimp-help
   */
77
  procedure = gimp_procedure_new (help_invoker);
78 79
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-help");
80 81 82
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-help",
                                     "Load a help page.",
83
                                     "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.",
84 85 86 87 88 89 90 91
                                     "Michael Natterer <mitch@gimp.org>",
                                     "Michael Natterer",
                                     "2000",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_string ("help-domain",
                                                       "help domain",
                                                       "The help domain in which help_id is registered",
92
                                                       FALSE, TRUE, FALSE,
93 94 95 96 97 98
                                                       NULL,
                                                       GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_string ("help-id",
                                                       "help id",
                                                       "The help page's ID",
99
                                                       FALSE, FALSE, FALSE,
100 101
                                                       NULL,
                                                       GIMP_PARAM_READWRITE));
102
  gimp_pdb_register_procedure (pdb, procedure);
103
  g_object_unref (procedure);
104
}