changed "prog_name" parameter of gimp_help() to "help_domain". It's

2004-01-20  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/help.pdb: changed "prog_name" parameter of
	gimp_help() to "help_domain". It's useless to pass the plug-in's
	executable name to the core because the core already knows it.
	Instead, enabled accessing arbitrary help domains via the
	PDB. Passing NULL as help_domain will use the domain the plug-in
	registered, or the GIMP main help domain if it didn't register a
	domain.

	* app/pdb/help_cmds.c
	* libgimp/gimphelp_pdb.[ch]: regenerated.

	* libgimp/gimpui.c (gimp_ui_help_func): pass NULL as help_domain.
This commit is contained in:
Michael Natterer
2004-01-20 12:38:31 +00:00
committed by Michael Natterer
parent b5bf60ac6a
commit ebcb621c51
6 changed files with 61 additions and 38 deletions

View File

@ -1,3 +1,18 @@
2004-01-20 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/help.pdb: changed "prog_name" parameter of
gimp_help() to "help_domain". It's useless to pass the plug-in's
executable name to the core because the core already knows it.
Instead, enabled accessing arbitrary help domains via the
PDB. Passing NULL as help_domain will use the domain the plug-in
registered, or the GIMP main help domain if it didn't register a
domain.
* app/pdb/help_cmds.c
* libgimp/gimphelp_pdb.[ch]: regenerated.
* libgimp/gimpui.c (gimp_ui_help_func): pass NULL as help_domain.
2004-01-20 Sven Neumann <sven@gimp.org> 2004-01-20 Sven Neumann <sven@gimp.org>
* tools/gimp-remote.c: made --new the default behaviour and allow * tools/gimp-remote.c: made --new the default behaviour and allow

View File

@ -20,7 +20,6 @@
#include "config.h" #include "config.h"
#include <sys/types.h>
#include <glib-object.h> #include <glib-object.h>
@ -29,6 +28,8 @@
#include "pdb-types.h" #include "pdb-types.h"
#include "procedural_db.h" #include "procedural_db.h"
#include "core/gimp.h"
#include "plug-in/plug-in.h"
#include "plug-in/plug-ins.h" #include "plug-in/plug-ins.h"
#include "widgets/gimphelp.h" #include "widgets/gimphelp.h"
@ -45,11 +46,11 @@ help_invoker (Gimp *gimp,
Argument *args) Argument *args)
{ {
gboolean success = TRUE; gboolean success = TRUE;
gchar *prog_name; gchar *help_domain;
gchar *help_id; gchar *help_id;
prog_name = (gchar *) args[0].value.pdb_pointer; help_domain = (gchar *) args[0].value.pdb_pointer;
if (prog_name == NULL) if (help_domain && !g_utf8_validate (help_domain, -1, NULL))
success = FALSE; success = FALSE;
help_id = (gchar *) args[1].value.pdb_pointer; help_id = (gchar *) args[1].value.pdb_pointer;
@ -57,7 +58,13 @@ help_invoker (Gimp *gimp,
success = FALSE; success = FALSE;
if (success) if (success)
gimp_help (gimp, plug_ins_help_domain (gimp, prog_name, NULL), help_id); {
if (! help_domain && gimp->current_plug_in)
help_domain = (gchar *)
plug_ins_help_domain (gimp, gimp->current_plug_in->prog, NULL);
gimp_help (gimp, help_domain, help_id);
}
return procedural_db_return_args (&help_proc, success); return procedural_db_return_args (&help_proc, success);
} }
@ -66,8 +73,8 @@ static ProcArg help_inargs[] =
{ {
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
"prog_name", "help_domain",
"The plug-in's executable name or an empty string" "The help domain in which help_id is registered"
}, },
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
@ -80,7 +87,7 @@ static ProcRecord help_proc =
{ {
"gimp_help", "gimp_help",
"Load a help page.", "Load a help page.",
"This procedure loads the specified help page into the helpbrowser or what ever is configured as help viewer. The location of the help page is given relative to the help rootdir. The help rootdir is determined from the prog_name: if prog_name is NULL, we use the help rootdir of the main GIMP installation, if the plug-in's full executable name is passed as prog_name, the GIMP will use this information to look up the help path the plug-in has registered before with gimp-plugin-help-register.", "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.",
"Michael Natterer <mitch@gimp.org>", "Michael Natterer <mitch@gimp.org>",
"Michael Natterer <mitch@gimp.org>", "Michael Natterer <mitch@gimp.org>",
"2000", "2000",

View File

@ -27,24 +27,22 @@
/** /**
* gimp_help: * gimp_help:
* @prog_name: The plug-in's executable name or an empty string. * @help_domain: The help domain in which help_id is registered.
* @help_id: The help page's ID. * @help_id: The help page's ID.
* *
* Load a help page. * Load a help page.
* *
* This procedure loads the specified help page into the helpbrowser or * This procedure loads the specified help page into the helpbrowser or
* what ever is configured as help viewer. The location of the help * what ever is configured as help viewer. The help page is identified
* page is given relative to the help rootdir. The help rootdir is * by its domain and ID: if help_domain is NULL, we use the help_domain
* determined from the prog_name: if prog_name is NULL, we use the help * which was registered using the gimp-plugin-help-register procedure.
* rootdir of the main GIMP installation, if the plug-in's full * If help_domain is NULL and no help domain was registered, the help
* executable name is passed as prog_name, the GIMP will use this * domain of the main GIMP installation is used.
* information to look up the help path the plug-in has registered
* before with gimp-plugin-help-register.
* *
* Returns: TRUE on success. * Returns: TRUE on success.
*/ */
gboolean gboolean
gimp_help (const gchar *prog_name, gimp_help (const gchar *help_domain,
const gchar *help_id) const gchar *help_id)
{ {
GimpParam *return_vals; GimpParam *return_vals;
@ -53,7 +51,7 @@ gimp_help (const gchar *prog_name,
return_vals = gimp_run_procedure ("gimp_help", return_vals = gimp_run_procedure ("gimp_help",
&nreturn_vals, &nreturn_vals,
GIMP_PDB_STRING, prog_name, GIMP_PDB_STRING, help_domain,
GIMP_PDB_STRING, help_id, GIMP_PDB_STRING, help_id,
GIMP_PDB_END); GIMP_PDB_END);

View File

@ -29,7 +29,7 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gboolean gimp_help (const gchar *prog_name, gboolean gimp_help (const gchar *help_domain,
const gchar *help_id); const gchar *help_id);

View File

@ -125,7 +125,7 @@ static void
gimp_ui_help_func (const gchar *help_id, gimp_ui_help_func (const gchar *help_id,
gpointer help_data) gpointer help_data)
{ {
gimp_help (gimp_get_progname (), help_id); gimp_help (NULL, help_id);
} }
static void static void

View File

@ -17,40 +17,43 @@
# "Perlized" from C source by Sven Neumann <sven@gimp.org> # "Perlized" from C source by Sven Neumann <sven@gimp.org>
sub pdb_misc {
$author = $copyright = 'Michael Natterer <mitch@gimp.org>';
$date = '2000';
}
sub help { sub help {
$blurb = "Load a help page."; $blurb = "Load a help page.";
$help = <<HELP; $help = <<HELP;
This procedure loads the specified help page into the helpbrowser or what ever This procedure loads the specified help page into the helpbrowser or
is configured as help viewer. The location of the help page is given relative what ever is configured as help viewer. The help page is identified by
to the help rootdir. The help rootdir is determined from the prog_name: if its domain and ID: if help_domain is NULL, we use the help_domain
prog_name is NULL, we use the help rootdir of the main GIMP installation, which was registered using the gimp-plugin-help-register procedure. If
if the plug-in's full executable name is passed as prog_name, the GIMP help_domain is NULL and no help domain was registered, the help domain
will use this information to look up the help path the plug-in has registered of the main GIMP installation is used.
before with gimp-plugin-help-register.
HELP HELP
&pdb_misc; $author = $copyright = 'Michael Natterer <mitch@gimp.org>';
$date = '2000';
@inargs = ( @inargs = (
{ name => 'prog_name', type => 'string', no_validate => 1, { name => 'help_domain', type => 'string', null_ok => 1,
desc => "The plug-in's executable name or an empty string" }, desc => "The help domain in which help_id is registered" },
{ name => 'help_id', type => 'string', { name => 'help_id', type => 'string',
desc => 'The help page\'s ID' } desc => 'The help page\'s ID' }
); );
%invoke = ( %invoke = (
success => 'TRUE', code => <<CODE
code => 'gimp_help (gimp, plug_ins_help_domain (gimp, prog_name, NULL), help_id);' {
if (! help_domain && gimp->current_plug_in)
help_domain = (gchar *)
plug_ins_help_domain (gimp, gimp->current_plug_in->prog, NULL);
gimp_help (gimp, help_domain, help_id);
}
CODE
); );
} }
@headers = qw(<sys/types.h> "plug-in/plug-ins.h" "widgets/gimphelp.h"); @headers = qw("core/gimp.h" "plug-in/plug-in.h" "plug-in/plug-ins.h"
"widgets/gimphelp.h");
@procs = qw(help); @procs = qw(help);
%exports = (app => [@procs], lib => [@procs]); %exports = (app => [@procs], lib => [@procs]);