mirror of https://github.com/GNOME/gimp.git
libgimp: change the return values of GimpPlugIn::init_procedures()
and ::query_procedures() to a GList* of strings.
This commit is contained in:
parent
e3374e7d4e
commit
a50069e176
|
@ -34,7 +34,7 @@
|
||||||
/* local function prototpes */
|
/* local function prototpes */
|
||||||
|
|
||||||
static void gimp_plug_in_register (GimpPlugIn *plug_in,
|
static void gimp_plug_in_register (GimpPlugIn *plug_in,
|
||||||
gboolean init);
|
GList *procedures);
|
||||||
static void gimp_plug_in_loop (GimpPlugIn *plug_in);
|
static void gimp_plug_in_loop (GimpPlugIn *plug_in);
|
||||||
static void gimp_plug_in_proc_run (GimpPlugIn *plug_in,
|
static void gimp_plug_in_proc_run (GimpPlugIn *plug_in,
|
||||||
GPProcRun *proc_run);
|
GPProcRun *proc_run);
|
||||||
|
@ -52,10 +52,13 @@ _gimp_plug_in_query (GimpPlugIn *plug_in)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GIMP_IS_PLUG_IN (plug_in));
|
g_return_if_fail (GIMP_IS_PLUG_IN (plug_in));
|
||||||
|
|
||||||
if (! GIMP_PLUG_IN_GET_CLASS (plug_in)->query_procedures)
|
if (GIMP_PLUG_IN_GET_CLASS (plug_in)->query_procedures)
|
||||||
return;
|
{
|
||||||
|
GList *procedures =
|
||||||
|
GIMP_PLUG_IN_GET_CLASS (plug_in)->query_procedures (plug_in);
|
||||||
|
|
||||||
gimp_plug_in_register (plug_in, FALSE);
|
gimp_plug_in_register (plug_in, procedures);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -63,10 +66,13 @@ _gimp_plug_in_init (GimpPlugIn *plug_in)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GIMP_IS_PLUG_IN (plug_in));
|
g_return_if_fail (GIMP_IS_PLUG_IN (plug_in));
|
||||||
|
|
||||||
if (! GIMP_PLUG_IN_GET_CLASS (plug_in)->init_procedures)
|
if (GIMP_PLUG_IN_GET_CLASS (plug_in)->init_procedures)
|
||||||
return;
|
{
|
||||||
|
GList *procedures =
|
||||||
|
GIMP_PLUG_IN_GET_CLASS (plug_in)->init_procedures (plug_in);
|
||||||
|
|
||||||
gimp_plug_in_register (plug_in, TRUE);
|
gimp_plug_in_register (plug_in, procedures);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -103,22 +109,16 @@ _gimp_plug_in_extension_read (GIOChannel *channel,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_plug_in_register (GimpPlugIn *plug_in,
|
gimp_plug_in_register (GimpPlugIn *plug_in,
|
||||||
gboolean init)
|
GList *procedures)
|
||||||
{
|
{
|
||||||
gchar **procedures;
|
|
||||||
gchar **name;
|
|
||||||
GList *list;
|
GList *list;
|
||||||
|
|
||||||
if (init)
|
for (list = procedures; list; list = g_list_next (list))
|
||||||
procedures = GIMP_PLUG_IN_GET_CLASS (plug_in)->init_procedures (plug_in);
|
|
||||||
else
|
|
||||||
procedures = GIMP_PLUG_IN_GET_CLASS (plug_in)->query_procedures (plug_in);
|
|
||||||
|
|
||||||
for (name = procedures; *name; name++)
|
|
||||||
{
|
{
|
||||||
|
const gchar *name = list->data;
|
||||||
GimpProcedure *procedure;
|
GimpProcedure *procedure;
|
||||||
|
|
||||||
procedure = gimp_plug_in_create_procedure (plug_in, *name);
|
procedure = gimp_plug_in_create_procedure (plug_in, name);
|
||||||
if (procedure)
|
if (procedure)
|
||||||
{
|
{
|
||||||
_gimp_procedure_register (procedure);
|
_gimp_procedure_register (procedure);
|
||||||
|
@ -126,11 +126,11 @@ gimp_plug_in_register (GimpPlugIn *plug_in,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_warning ("Plug-in failed to create procedure '%s'\n",
|
g_warning ("Plug-in failed to create procedure '%s'\n", name);
|
||||||
*name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_clear_pointer (&procedures, g_strfreev);
|
|
||||||
|
g_list_free_full (procedures, g_free);
|
||||||
|
|
||||||
if (plug_in->priv->translation_domain_name)
|
if (plug_in->priv->translation_domain_name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -225,8 +225,8 @@ gimp_plug_in_add_menu_branch (GimpPlugIn *plug_in,
|
||||||
* %GIMP_EXTENSION procedures it implements is invoked.
|
* %GIMP_EXTENSION procedures it implements is invoked.
|
||||||
*
|
*
|
||||||
* This function will only ever be called with names returned by
|
* This function will only ever be called with names returned by
|
||||||
* implementations of GimpPlugIn::init_procedures() or
|
* implementations of GimpPlugInClass::init_procedures() or
|
||||||
* GimpPlugIn::query_procedures().
|
* GimpPlugInClass::query_procedures().
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): The newly created #GimpProcedure.
|
* Returns: (transfer full): The newly created #GimpProcedure.
|
||||||
**/
|
**/
|
||||||
|
|
|
@ -58,41 +58,40 @@ struct _GimpPlugInClass
|
||||||
* @plug_in: a #GimpPlugIn.
|
* @plug_in: a #GimpPlugIn.
|
||||||
*
|
*
|
||||||
* This method can be overridden by all plug-ins to return a newly
|
* This method can be overridden by all plug-ins to return a newly
|
||||||
* allocated array of allocated strings naming the procedures
|
* allocated GList of allocated strings naming the procedures
|
||||||
* registered by this plug-in.
|
* registered by this plug-in.
|
||||||
* This array of strings must be NULL-terminated (i.e. freeable by
|
|
||||||
* g_strfreev()).
|
|
||||||
*
|
*
|
||||||
* See documentation of init_procedures() for differences.
|
* See documentation of GimpPlugInClass::init_procedures() for
|
||||||
|
* differences.
|
||||||
*
|
*
|
||||||
* Returns: (array zero-terminated=1) (transfer full):
|
* Returns: (element-type gchar*) (transfer full):
|
||||||
* the names of the procedures registered by @plug_in.
|
* the names of the procedures registered by @plug_in.
|
||||||
*/
|
*/
|
||||||
gchar ** (* query_procedures) (GimpPlugIn *plug_in);
|
GList * (* query_procedures) (GimpPlugIn *plug_in);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GimpPlugInClass::init_procedures:
|
* GimpPlugInClass::init_procedures:
|
||||||
* @plug_in: a #GimpPlugIn.
|
* @plug_in: a #GimpPlugIn.
|
||||||
*
|
*
|
||||||
* This method can be overridden by all plug-ins to return a newly
|
* This method can be overridden by all plug-ins to return a newly
|
||||||
* allocated array of allocated strings naming procedures registered
|
* allocated #GList of allocated strings naming procedures registered
|
||||||
* by this plug-in.
|
* by this plug-in.
|
||||||
* This array of strings must be NULL-terminated (i.e. freeable by
|
|
||||||
* g_strfreev()).
|
|
||||||
*
|
*
|
||||||
* It is different from query_procedures() in that init happens at every
|
* It is different from GimpPlugInClass::query_procedures() in that
|
||||||
* startup, whereas query happens only once in the life of a plug-in
|
* init happens at every startup, whereas query happens only once in
|
||||||
* (right after installation or update). Hence init_procedures()
|
* the life of a plug-in (right after installation or update). Hence
|
||||||
* typically returns procedures dependent to runtime conditions (such
|
* GimpPlugInClass::init_procedures() typically returns procedures
|
||||||
* as the presence of a third-party tool), whereas query_procedures()
|
* dependent to runtime conditions (such as the presence of a
|
||||||
* would usually return unconditional and always available procedures.
|
* third-party tool), whereas GimpPlugInClass::query_procedures()
|
||||||
* Most of the time, you only want to override query_procedures() and
|
* would usually return unconditional and always available
|
||||||
* leave init_procedures() untouched.
|
* procedures. Most of the time, you only want to override
|
||||||
|
* GimpPlugInClass::query_procedures() and leave
|
||||||
|
* GimpPlugInClass::init_procedures() untouched.
|
||||||
*
|
*
|
||||||
* Returns: (array zero-terminated=1) (transfer full):
|
* Returns: (element-type gchar*) (transfer full):
|
||||||
* the names of the procedures registered by @plug_in.
|
* the names of the procedures registered by @plug_in.
|
||||||
*/
|
*/
|
||||||
gchar ** (* init_procedures) (GimpPlugIn *plug_in);
|
GList * (* init_procedures) (GimpPlugIn *plug_in);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GimpPlugInClass::create_procedure:
|
* GimpPlugInClass::create_procedure:
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct _GoatClass
|
||||||
|
|
||||||
GType goat_get_type (void) G_GNUC_CONST;
|
GType goat_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
static gchar ** goat_query_procedures (GimpPlugIn *plug_in);
|
static GList * goat_query_procedures (GimpPlugIn *plug_in);
|
||||||
static GimpProcedure * goat_create_procedure (GimpPlugIn *plug_in,
|
static GimpProcedure * goat_create_procedure (GimpPlugIn *plug_in,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
|
|
||||||
|
@ -80,14 +80,10 @@ goat_init (Goat *goat)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar **
|
static GList *
|
||||||
goat_query_procedures (GimpPlugIn *plug_in)
|
goat_query_procedures (GimpPlugIn *plug_in)
|
||||||
{
|
{
|
||||||
gchar **procedures = g_new0 (gchar *, 2);
|
return g_list_append (NULL, g_strdup (PLUG_IN_PROC));
|
||||||
|
|
||||||
procedures[0] = g_strdup (PLUG_IN_PROC);
|
|
||||||
|
|
||||||
return procedures;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GimpProcedure *
|
static GimpProcedure *
|
||||||
|
|
|
@ -70,7 +70,7 @@ typedef struct
|
||||||
|
|
||||||
GType help_get_type (void) G_GNUC_CONST;
|
GType help_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
static gchar ** help_query_procedures (GimpPlugIn *plug_in);
|
static GList * help_query_procedures (GimpPlugIn *plug_in);
|
||||||
static GimpProcedure * help_create_procedure (GimpPlugIn *plug_in,
|
static GimpProcedure * help_create_procedure (GimpPlugIn *plug_in,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
|
|
||||||
|
@ -112,14 +112,10 @@ help_init (Help *help)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar **
|
static GList *
|
||||||
help_query_procedures (GimpPlugIn *plug_in)
|
help_query_procedures (GimpPlugIn *plug_in)
|
||||||
{
|
{
|
||||||
gchar **procedures = g_new0 (gchar *, 2);
|
return g_list_append (NULL, g_strdup (GIMP_HELP_EXT_PROC));
|
||||||
|
|
||||||
procedures[0] = g_strdup (GIMP_HELP_EXT_PROC);
|
|
||||||
|
|
||||||
return procedures;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GimpProcedure *
|
static GimpProcedure *
|
||||||
|
|
Loading…
Reference in New Issue