2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2004-03-09 09:37:56 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* The GIMP Help plug-in
|
2008-05-17 00:56:33 +08:00
|
|
|
* Copyright (C) 1999-2008 Sven Neumann <sven@gimp.org>
|
2004-03-09 09:37:56 +08:00
|
|
|
* Michael Natterer <mitch@gimp.org>
|
|
|
|
* Henrik Brix Andersen <brix@gimp.org>
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2004-03-09 09:37:56 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2004-03-09 09:37:56 +08:00
|
|
|
* (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
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2004-03-09 09:37:56 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <string.h> /* strlen */
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include "libgimp/gimp.h"
|
|
|
|
|
2006-11-21 05:46:21 +08:00
|
|
|
#include "gimphelp.h"
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2004-03-09 09:45:21 +08:00
|
|
|
#include "libgimp/stdplugins-intl.h"
|
|
|
|
|
2004-03-09 09:37:56 +08:00
|
|
|
|
|
|
|
/* defines */
|
|
|
|
|
2005-08-12 23:46:46 +08:00
|
|
|
#define GIMP_HELP_EXT_PROC "extension-gimp-help"
|
|
|
|
#define GIMP_HELP_TEMP_EXT_PROC "extension-gimp-help-temp"
|
2004-03-09 09:37:56 +08:00
|
|
|
|
|
|
|
|
2019-07-31 03:04:11 +08:00
|
|
|
typedef struct _Help Help;
|
|
|
|
typedef struct _HelpClass HelpClass;
|
|
|
|
|
|
|
|
struct _Help
|
|
|
|
{
|
|
|
|
GimpPlugIn parent_instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _HelpClass
|
|
|
|
{
|
|
|
|
GimpPlugInClass parent_class;
|
|
|
|
};
|
|
|
|
|
2004-03-09 09:37:56 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gchar *procedure;
|
|
|
|
gchar *help_domain;
|
2004-03-18 08:11:03 +08:00
|
|
|
gchar *help_locales;
|
2004-03-09 09:37:56 +08:00
|
|
|
gchar *help_id;
|
|
|
|
} IdleHelp;
|
|
|
|
|
|
|
|
|
|
|
|
/* forward declarations */
|
|
|
|
|
2019-07-31 03:04:11 +08:00
|
|
|
#define HELP_TYPE (help_get_type ())
|
2023-10-19 00:29:37 +08:00
|
|
|
#define HELP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), HELP_TYPE, Help))
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2019-07-31 03:04:11 +08:00
|
|
|
GType help_get_type (void) G_GNUC_CONST;
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2019-08-03 01:10:13 +08:00
|
|
|
static GList * help_query_procedures (GimpPlugIn *plug_in);
|
2019-07-31 03:04:11 +08:00
|
|
|
static GimpProcedure * help_create_procedure (GimpPlugIn *plug_in,
|
|
|
|
const gchar *name);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2019-07-31 03:04:11 +08:00
|
|
|
static GimpValueArray * help_run (GimpProcedure *procedure,
|
2023-06-15 22:53:54 +08:00
|
|
|
GimpProcedureConfig *config,
|
2019-08-02 04:45:49 +08:00
|
|
|
gpointer run_data);
|
2019-07-31 03:04:11 +08:00
|
|
|
static GimpValueArray * help_temp_run (GimpProcedure *procedure,
|
2023-06-15 22:53:54 +08:00
|
|
|
GimpProcedureConfig *config,
|
2019-08-02 04:45:49 +08:00
|
|
|
gpointer run_data);
|
2008-06-10 18:25:56 +08:00
|
|
|
|
2019-07-31 03:04:11 +08:00
|
|
|
static void help_temp_proc_install (GimpPlugIn *plug_in);
|
|
|
|
static void help_load (const gchar *procedure,
|
|
|
|
const gchar *help_domain,
|
|
|
|
const gchar *help_locales,
|
|
|
|
const gchar *help_id);
|
|
|
|
static gboolean help_load_idle (gpointer data);
|
|
|
|
|
|
|
|
static GimpHelpProgress * help_load_progress_new (void);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
|
|
|
|
2004-12-06 03:50:37 +08:00
|
|
|
static GMainLoop *main_loop = NULL;
|
|
|
|
|
2019-07-31 03:04:11 +08:00
|
|
|
G_DEFINE_TYPE (Help, help, GIMP_TYPE_PLUG_IN)
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2019-07-31 03:04:11 +08:00
|
|
|
GIMP_MAIN (HELP_TYPE)
|
2022-05-26 06:59:36 +08:00
|
|
|
DEFINE_STD_SET_I18N
|
2004-03-09 09:37:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
2019-07-31 03:04:11 +08:00
|
|
|
help_class_init (HelpClass *klass)
|
2004-03-09 09:37:56 +08:00
|
|
|
{
|
2019-07-31 03:04:11 +08:00
|
|
|
GimpPlugInClass *plug_in_class = GIMP_PLUG_IN_CLASS (klass);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2019-07-31 03:04:11 +08:00
|
|
|
plug_in_class->query_procedures = help_query_procedures;
|
|
|
|
plug_in_class->create_procedure = help_create_procedure;
|
2022-05-26 06:59:36 +08:00
|
|
|
plug_in_class->set_i18n = STD_SET_I18N;
|
2004-03-09 09:37:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-07-31 03:04:11 +08:00
|
|
|
help_init (Help *help)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-08-03 01:10:13 +08:00
|
|
|
static GList *
|
libgimp, plug-ins: remove n_procedures from (init|query)_procedures().
The way currently implemented plug-ins are, they are already
NULL-terminating the returned arrays. Since a procedure name cannot be
NULL itself by definition, defining the array length by a terminal NULL
is enough. There is no need to also add a n_procedures parameters which
is just one more possible bug source, even more as we were already
expecting the NULL termination by using g_strfreev() to free the memory.
Anyway a length parameter does not bring any advantage since a plug-in
can still "lie" about its array size (just as it can forget to
NULL-terminate it) and when this happens, the plug-in will segfault.
That's it, it's just a plug-in programming error.
Last but not least, some binding seem to have issues with returned array
setting an (out) parameter as the length. In pygobject at least, the
length parameter doesn't disappear and we end up with this ugly
signature:
> In [3]: Gimp.PlugIn.do_query_procedures.__doc__
> Out[3]: 'query_procedures(self) -> list, n_procedures:int'
See bug report pygobject#352.
To avoid this, we should either set both the array and the length as
(out) parameters or just set the returned array as NULL-terminated
(which is the solution I chose).
2019-08-02 19:36:11 +08:00
|
|
|
help_query_procedures (GimpPlugIn *plug_in)
|
2019-07-31 03:04:11 +08:00
|
|
|
{
|
2019-08-03 01:10:13 +08:00
|
|
|
return g_list_append (NULL, g_strdup (GIMP_HELP_EXT_PROC));
|
2019-07-31 03:04:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static GimpProcedure *
|
|
|
|
help_create_procedure (GimpPlugIn *plug_in,
|
|
|
|
const gchar *name)
|
|
|
|
{
|
|
|
|
GimpProcedure *procedure = NULL;
|
|
|
|
|
|
|
|
if (! strcmp (name, GIMP_HELP_EXT_PROC))
|
|
|
|
{
|
2023-06-17 00:34:53 +08:00
|
|
|
procedure = gimp_procedure_new (plug_in, name,
|
|
|
|
GIMP_PDB_PROC_TYPE_EXTENSION,
|
|
|
|
help_run, NULL, NULL);
|
2019-07-31 03:04:11 +08:00
|
|
|
|
2019-08-02 06:35:17 +08:00
|
|
|
gimp_procedure_set_attribution (procedure,
|
|
|
|
"Sven Neumann <sven@gimp.org>, "
|
|
|
|
"Michael Natterer <mitch@gimp.org>, "
|
|
|
|
"Henrik Brix Andersen <brix@gimp.org>",
|
|
|
|
"Sven Neumann, Michael Natterer & Henrik Brix Andersen",
|
|
|
|
"1999-2008");
|
2019-07-31 03:04:11 +08:00
|
|
|
|
2020-12-24 04:15:43 +08:00
|
|
|
GIMP_PROC_ARG_STRV (procedure, "domain-names",
|
|
|
|
"Domain Names",
|
|
|
|
"Domain names",
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_STRV (procedure, "domain-uris",
|
|
|
|
"Domain URIs",
|
|
|
|
"Domain URIs",
|
|
|
|
G_PARAM_READWRITE);
|
2019-07-31 03:04:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return procedure;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GimpValueArray *
|
|
|
|
help_run (GimpProcedure *procedure,
|
2023-06-15 22:53:54 +08:00
|
|
|
GimpProcedureConfig *config,
|
2019-08-02 04:45:49 +08:00
|
|
|
gpointer run_data)
|
2004-03-09 09:37:56 +08:00
|
|
|
{
|
2023-06-15 22:53:54 +08:00
|
|
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
|
|
|
gchar **domain_names = NULL;
|
|
|
|
gchar **domain_uris = NULL;
|
|
|
|
|
|
|
|
g_object_get (config,
|
|
|
|
"domain-names", &domain_names,
|
|
|
|
"domain-uris", &domain_uris,
|
|
|
|
NULL);
|
|
|
|
if (! gimp_help_init ((const gchar **) domain_names,
|
|
|
|
(const gchar **) domain_uris))
|
|
|
|
status = GIMP_PDB_CALLING_ERROR;
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2023-06-15 22:53:54 +08:00
|
|
|
g_strfreev (domain_names);
|
|
|
|
g_strfreev (domain_uris);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
|
|
|
if (status == GIMP_PDB_SUCCESS)
|
|
|
|
{
|
2019-07-31 03:21:36 +08:00
|
|
|
GimpPlugIn *plug_in = gimp_procedure_get_plug_in (procedure);
|
|
|
|
|
2004-12-06 03:50:37 +08:00
|
|
|
main_loop = g_main_loop_new (NULL, FALSE);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2019-07-31 03:21:36 +08:00
|
|
|
help_temp_proc_install (plug_in);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2019-08-02 05:45:53 +08:00
|
|
|
gimp_procedure_extension_ready (procedure);
|
2019-08-02 17:06:48 +08:00
|
|
|
gimp_plug_in_extension_enable (plug_in);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2004-12-06 03:50:37 +08:00
|
|
|
g_main_loop_run (main_loop);
|
|
|
|
|
|
|
|
g_main_loop_unref (main_loop);
|
|
|
|
main_loop = NULL;
|
2004-03-18 20:18:12 +08:00
|
|
|
|
2019-07-31 03:21:36 +08:00
|
|
|
gimp_plug_in_remove_temp_procedure (plug_in, GIMP_HELP_TEMP_EXT_PROC);
|
2004-03-09 09:37:56 +08:00
|
|
|
}
|
|
|
|
|
2019-07-31 03:04:11 +08:00
|
|
|
return gimp_procedure_new_return_values (procedure, status, NULL);
|
2004-03-09 09:37:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-07-31 03:04:11 +08:00
|
|
|
help_temp_proc_install (GimpPlugIn *plug_in)
|
2004-03-09 09:37:56 +08:00
|
|
|
{
|
2019-07-31 03:04:11 +08:00
|
|
|
GimpProcedure *procedure;
|
|
|
|
|
2023-06-17 00:34:53 +08:00
|
|
|
procedure = gimp_procedure_new (plug_in, GIMP_HELP_TEMP_EXT_PROC,
|
|
|
|
GIMP_PDB_PROC_TYPE_TEMPORARY,
|
|
|
|
help_temp_run, NULL, NULL);
|
2019-07-31 03:04:11 +08:00
|
|
|
|
2019-08-02 06:35:17 +08:00
|
|
|
gimp_procedure_set_attribution (procedure,
|
|
|
|
"Sven Neumann <sven@gimp.org>, "
|
|
|
|
"Michael Natterer <mitch@gimp.org>"
|
|
|
|
"Henrik Brix Andersen <brix@gimp.org",
|
2019-08-19 16:02:07 +08:00
|
|
|
"Sven Neumann, Michael Natterer & "
|
|
|
|
"Henrik Brix Andersen",
|
2019-08-02 06:35:17 +08:00
|
|
|
"1999-2008");
|
2019-07-31 03:04:11 +08:00
|
|
|
|
2019-08-19 16:02:07 +08:00
|
|
|
GIMP_PROC_ARG_STRING (procedure, "help-proc",
|
|
|
|
"The procedure of the browser to use",
|
|
|
|
"The procedure of the browser to use",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_STRING (procedure, "help-domain",
|
|
|
|
"Help domain to use",
|
|
|
|
"Help domain to use",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_STRING (procedure, "help-locales",
|
|
|
|
"Language to use",
|
|
|
|
"Language to use",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_STRING (procedure, "help-id",
|
|
|
|
"Help ID to open",
|
|
|
|
"Help ID to open",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE);
|
2019-07-31 03:04:11 +08:00
|
|
|
|
|
|
|
gimp_plug_in_add_temp_procedure (plug_in, procedure);
|
|
|
|
g_object_unref (procedure);
|
2004-03-09 09:37:56 +08:00
|
|
|
}
|
|
|
|
|
2019-07-31 03:04:11 +08:00
|
|
|
static GimpValueArray *
|
|
|
|
help_temp_run (GimpProcedure *procedure,
|
2023-06-15 22:53:54 +08:00
|
|
|
GimpProcedureConfig *config,
|
2019-08-02 04:45:49 +08:00
|
|
|
gpointer run_data)
|
2004-03-09 09:37:56 +08:00
|
|
|
{
|
2004-03-18 08:11:03 +08:00
|
|
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
2023-06-15 22:53:54 +08:00
|
|
|
gchar *help_proc = NULL;
|
|
|
|
gchar *help_domain = NULL;
|
|
|
|
gchar *help_locales = NULL;
|
|
|
|
gchar *help_id = NULL;
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2023-06-15 22:53:54 +08:00
|
|
|
g_object_get (config,
|
|
|
|
"help-proc", &help_proc,
|
|
|
|
"help-domain", &help_domain,
|
|
|
|
"help-locales", &help_locales,
|
|
|
|
"help-id", &help_id,
|
|
|
|
NULL);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2023-06-15 22:53:54 +08:00
|
|
|
if (help_domain == NULL)
|
|
|
|
help_domain = g_strdup (GIMP_HELP_DEFAULT_DOMAIN);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2023-06-15 22:53:54 +08:00
|
|
|
if (help_id == NULL)
|
|
|
|
help_id = g_strdup (GIMP_HELP_DEFAULT_ID);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2019-07-31 03:04:11 +08:00
|
|
|
if (! help_proc)
|
2004-03-18 08:11:03 +08:00
|
|
|
status = GIMP_PDB_CALLING_ERROR;
|
|
|
|
|
|
|
|
if (status == GIMP_PDB_SUCCESS)
|
2019-07-31 03:04:11 +08:00
|
|
|
help_load (help_proc, help_domain, help_locales, help_id);
|
|
|
|
|
2023-06-15 22:53:54 +08:00
|
|
|
g_free (help_proc);
|
|
|
|
g_free (help_domain);
|
|
|
|
g_free (help_locales);
|
|
|
|
g_free (help_id);
|
|
|
|
|
2019-07-31 03:04:11 +08:00
|
|
|
return gimp_procedure_new_return_values (procedure, status, NULL);
|
2004-03-09 09:37:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-07-31 03:04:11 +08:00
|
|
|
help_load (const gchar *procedure,
|
2004-03-09 09:37:56 +08:00
|
|
|
const gchar *help_domain,
|
2004-03-18 08:11:03 +08:00
|
|
|
const gchar *help_locales,
|
2004-03-09 09:37:56 +08:00
|
|
|
const gchar *help_id)
|
|
|
|
{
|
2007-05-23 21:59:51 +08:00
|
|
|
IdleHelp *idle_help = g_slice_new (IdleHelp);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2004-03-18 08:11:03 +08:00
|
|
|
idle_help->procedure = g_strdup (procedure);
|
|
|
|
idle_help->help_domain = g_strdup (help_domain);
|
|
|
|
idle_help->help_locales = g_strdup (help_locales);
|
|
|
|
idle_help->help_id = g_strdup (help_id);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2019-07-31 03:04:11 +08:00
|
|
|
g_idle_add (help_load_idle, idle_help);
|
2004-03-09 09:37:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2019-07-31 03:04:11 +08:00
|
|
|
help_load_idle (gpointer data)
|
2004-03-09 09:37:56 +08:00
|
|
|
{
|
2006-11-21 05:46:21 +08:00
|
|
|
IdleHelp *idle_help = data;
|
|
|
|
GimpHelpDomain *domain;
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2006-11-21 05:46:21 +08:00
|
|
|
domain = gimp_help_lookup_domain (idle_help->help_domain);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
|
|
|
if (domain)
|
|
|
|
{
|
2008-06-12 01:43:57 +08:00
|
|
|
GimpHelpProgress *progress = NULL;
|
2008-06-10 18:25:56 +08:00
|
|
|
GList *locales;
|
2008-06-12 01:43:57 +08:00
|
|
|
gchar *uri;
|
2008-06-10 18:25:56 +08:00
|
|
|
gboolean fatal_error;
|
2004-03-18 08:11:03 +08:00
|
|
|
|
2008-06-12 01:43:57 +08:00
|
|
|
locales = gimp_help_parse_locales (idle_help->help_locales);
|
|
|
|
|
|
|
|
if (! g_str_has_prefix (domain->help_uri, "file:"))
|
2019-07-31 03:04:11 +08:00
|
|
|
progress = help_load_progress_new ();
|
2008-06-12 01:43:57 +08:00
|
|
|
|
|
|
|
uri = gimp_help_domain_map (domain, locales, idle_help->help_id,
|
|
|
|
progress, NULL, &fatal_error);
|
|
|
|
|
|
|
|
if (progress)
|
|
|
|
gimp_help_progress_free (progress);
|
2004-03-18 08:11:03 +08:00
|
|
|
|
2011-03-08 00:10:18 +08:00
|
|
|
g_list_free_full (locales, (GDestroyNotify) g_free);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2008-06-12 01:43:57 +08:00
|
|
|
if (uri)
|
2004-03-09 09:37:56 +08:00
|
|
|
{
|
libgimp, plug-ins: move gimp_pdb_run_procedure*() to gimp_procedure_run*().
The gimp_procedure_run() already existed, though it was with an ordered
GimpValueArray array of arguments. Its usage feels redundant to the series of
gimp_pdb_run_procedure*() functions (which is confusing), but
gimp_procedure_run() was actually a bit more generic, because it does not
necessarily calls GimpProcedure-s through the PDB! For instance, it can runs a
local GimpProcedure, such as the case of one procedure which would want to call
another procedure in the same plug-in, but without having to go through PDB. Of
course, for local code, you may as well run relevant functions directly, yet it
makes sense that if one of the redundant-looking function is removed, it should
be the more specific one. Also gimp_procedure_run() feels a lot simpler and
logical, API wise.
A main difference in usage is that now, plug-in developers have to first
explicitly look up the GimpPdbProcedure with gimp_pdb_lookup_procedure() when
they wish to call PDB procedures on the wire. This was done anyway in the
gimp_pdb_run_procedure*() code, now it's explicit (rather than calling by name
directly).
Concretely:
* gimp_pdb_run_procedure(), gimp_pdb_run_procedure_config() and
gimp_pdb_run_procedure_valist() are removed.
* gimp_procedure_run() API is modified to use a variable args list instead of a
GimpValueArray.
* gimp_procedure_run_config() and gimp_procedure_run_valist() are added.
* gimp_procedure_run_config() in particular will be the one used in bindings
which don't have variable args support through a (rename-to
gimp_procedure_run) annotation.
2023-10-18 23:11:20 +08:00
|
|
|
GimpProcedure *procedure;
|
2019-07-31 03:16:07 +08:00
|
|
|
GimpValueArray *return_vals;
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2004-03-18 08:11:03 +08:00
|
|
|
#ifdef GIMP_HELP_DEBUG
|
2004-03-09 09:37:56 +08:00
|
|
|
g_printerr ("help: calling '%s' for '%s'\n",
|
2008-06-12 01:43:57 +08:00
|
|
|
idle_help->procedure, uri);
|
2004-03-18 08:11:03 +08:00
|
|
|
#endif
|
2004-03-09 09:37:56 +08:00
|
|
|
|
libgimp, plug-ins: move gimp_pdb_run_procedure*() to gimp_procedure_run*().
The gimp_procedure_run() already existed, though it was with an ordered
GimpValueArray array of arguments. Its usage feels redundant to the series of
gimp_pdb_run_procedure*() functions (which is confusing), but
gimp_procedure_run() was actually a bit more generic, because it does not
necessarily calls GimpProcedure-s through the PDB! For instance, it can runs a
local GimpProcedure, such as the case of one procedure which would want to call
another procedure in the same plug-in, but without having to go through PDB. Of
course, for local code, you may as well run relevant functions directly, yet it
makes sense that if one of the redundant-looking function is removed, it should
be the more specific one. Also gimp_procedure_run() feels a lot simpler and
logical, API wise.
A main difference in usage is that now, plug-in developers have to first
explicitly look up the GimpPdbProcedure with gimp_pdb_lookup_procedure() when
they wish to call PDB procedures on the wire. This was done anyway in the
gimp_pdb_run_procedure*() code, now it's explicit (rather than calling by name
directly).
Concretely:
* gimp_pdb_run_procedure(), gimp_pdb_run_procedure_config() and
gimp_pdb_run_procedure_valist() are removed.
* gimp_procedure_run() API is modified to use a variable args list instead of a
GimpValueArray.
* gimp_procedure_run_config() and gimp_procedure_run_valist() are added.
* gimp_procedure_run_config() in particular will be the one used in bindings
which don't have variable args support through a (rename-to
gimp_procedure_run) annotation.
2023-10-18 23:11:20 +08:00
|
|
|
procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (),
|
|
|
|
idle_help->procedure);
|
2023-12-03 23:12:55 +08:00
|
|
|
return_vals = gimp_procedure_run (procedure, "url", uri, NULL);
|
2019-07-31 03:16:07 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2008-06-12 01:43:57 +08:00
|
|
|
g_free (uri);
|
2004-03-09 09:37:56 +08:00
|
|
|
}
|
2006-11-21 05:46:21 +08:00
|
|
|
else if (fatal_error)
|
|
|
|
{
|
|
|
|
g_main_loop_quit (main_loop);
|
|
|
|
}
|
2004-03-09 09:37:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
g_free (idle_help->procedure);
|
|
|
|
g_free (idle_help->help_domain);
|
2004-03-18 08:11:03 +08:00
|
|
|
g_free (idle_help->help_locales);
|
2004-03-09 09:37:56 +08:00
|
|
|
g_free (idle_help->help_id);
|
2007-05-23 21:59:51 +08:00
|
|
|
|
|
|
|
g_slice_free (IdleHelp, idle_help);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-06-10 18:25:56 +08:00
|
|
|
|
|
|
|
static void
|
2019-07-31 03:04:11 +08:00
|
|
|
help_load_progress_start (const gchar *message,
|
2008-06-10 18:25:56 +08:00
|
|
|
gboolean cancelable,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
gimp_progress_init (message);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-07-31 03:04:11 +08:00
|
|
|
help_load_progress_update (gdouble value,
|
2008-06-10 18:25:56 +08:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
gimp_progress_update (value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-07-31 03:04:11 +08:00
|
|
|
help_load_progress_end (gpointer user_data)
|
2008-06-10 18:25:56 +08:00
|
|
|
{
|
|
|
|
gimp_progress_end ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static GimpHelpProgress *
|
2019-07-31 03:04:11 +08:00
|
|
|
help_load_progress_new (void)
|
2008-06-10 18:25:56 +08:00
|
|
|
{
|
|
|
|
static const GimpHelpProgressVTable vtable =
|
|
|
|
{
|
2019-07-31 03:04:11 +08:00
|
|
|
help_load_progress_start,
|
|
|
|
help_load_progress_end,
|
|
|
|
help_load_progress_update
|
2008-06-10 18:25:56 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
return gimp_help_progress_new (&vtable, NULL);
|
|
|
|
}
|