Commit 2424e2ba authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/pdb/Makefile.am new utility functions which look up brushes, patterns

2007-12-11  Michael Natterer  <mitch@gimp.org>

	* app/pdb/Makefile.am
	* app/pdb/gimppdb-utils.[ch]: new utility functions which look up
	brushes, patterns etc. and set appropriate error messages if the
	objects are not found.

	* tools/pdbgen/pdb/brush.pdb
	* tools/pdbgen/pdb/brushes.pdb
	* tools/pdbgen/pdb/buffer.pdb
	* tools/pdbgen/pdb/context.pdb
	* tools/pdbgen/pdb/convert.pdb
	* tools/pdbgen/pdb/gradient.pdb
	* tools/pdbgen/pdb/gradients.pdb
	* tools/pdbgen/pdb/paint_tools.pdb
	* tools/pdbgen/pdb/palette.pdb
	* tools/pdbgen/pdb/palettes.pdb
	* tools/pdbgen/pdb/pattern.pdb
	* tools/pdbgen/pdb/patterns.pdb: use them here. Also set non_empty
	to TRUE for all brush, pattern etc. names.

	* app/pdb/brush_cmds.c
	* app/pdb/brushes_cmds.c
	* app/pdb/buffer_cmds.c
	* app/pdb/context_cmds.c
	* app/pdb/convert_cmds.c
	* app/pdb/gradient_cmds.c
	* app/pdb/gradients_cmds.c
	* app/pdb/paint_tools_cmds.c
	* app/pdb/palette_cmds.c
	* app/pdb/palettes_cmds.c
	* app/pdb/pattern_cmds.c
	* app/pdb/patterns_cmds.c: regenerated.


svn path=/trunk/; revision=24318
parent cc44a689
2007-12-11 Michael Natterer <mitch@gimp.org>
* app/pdb/Makefile.am
* app/pdb/gimppdb-utils.[ch]: new utility functions which look up
brushes, patterns etc. and set appropriate error messages if the
objects are not found.
* tools/pdbgen/pdb/brush.pdb
* tools/pdbgen/pdb/brushes.pdb
* tools/pdbgen/pdb/buffer.pdb
* tools/pdbgen/pdb/context.pdb
* tools/pdbgen/pdb/convert.pdb
* tools/pdbgen/pdb/gradient.pdb
* tools/pdbgen/pdb/gradients.pdb
* tools/pdbgen/pdb/paint_tools.pdb
* tools/pdbgen/pdb/palette.pdb
* tools/pdbgen/pdb/palettes.pdb
* tools/pdbgen/pdb/pattern.pdb
* tools/pdbgen/pdb/patterns.pdb: use them here. Also set non_empty
to TRUE for all brush, pattern etc. names.
* app/pdb/brush_cmds.c
* app/pdb/brushes_cmds.c
* app/pdb/buffer_cmds.c
* app/pdb/context_cmds.c
* app/pdb/convert_cmds.c
* app/pdb/gradient_cmds.c
* app/pdb/gradients_cmds.c
* app/pdb/paint_tools_cmds.c
* app/pdb/palette_cmds.c
* app/pdb/palettes_cmds.c
* app/pdb/pattern_cmds.c
* app/pdb/patterns_cmds.c: regenerated.
2007-12-11 Sven Neumann <sven@gimp.org>
* app/plug-in/gimpplugin-message.c: added sanity checks to message
......
......@@ -11,6 +11,8 @@ libapppdb_a_SOURCES = \
gimppdb.h \
gimppdb-query.c \
gimppdb-query.h \
gimppdb-utils.c \
gimppdb-utils.h \
gimppdberror.c \
gimppdberror.h \
gimpprocedure.c \
......
This diff is collapsed.
......@@ -35,7 +35,7 @@
#include "core/gimpcontainer-filter.h"
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
#include "core/gimplist.h"
#include "gimppdb-utils.h"
#include "internal_procs.h"
......@@ -200,14 +200,9 @@ brushes_get_brush_data_invoker (GimpProcedure *procedure,
GimpBrush *brush;
if (name && strlen (name))
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
}
brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
else
{
brush = gimp_context_get_brush (context);
}
brush = gimp_context_get_brush (context);
if (brush)
{
......
......@@ -33,7 +33,7 @@
#include "core/gimpbuffer.h"
#include "core/gimpcontainer-filter.h"
#include "core/gimpcontainer.h"
#include "gimp-intl.h"
#include "gimppdb-utils.h"
#include "internal_procs.h"
......@@ -90,8 +90,7 @@ buffer_rename_invoker (GimpProcedure *procedure,
if (success)
{
GimpBuffer *buffer = (GimpBuffer *)
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
if (buffer)
{
......@@ -125,8 +124,7 @@ buffer_delete_invoker (GimpProcedure *procedure,
if (success)
{
GimpBuffer *buffer = (GimpBuffer *)
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
if (buffer)
success = gimp_container_remove (gimp->named_buffers, GIMP_OBJECT (buffer));
......@@ -154,8 +152,7 @@ buffer_get_width_invoker (GimpProcedure *procedure,
if (success)
{
GimpBuffer *buffer = (GimpBuffer *)
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
if (buffer)
width = gimp_buffer_get_width (buffer);
......@@ -188,8 +185,7 @@ buffer_get_height_invoker (GimpProcedure *procedure,
if (success)
{
GimpBuffer *buffer = (GimpBuffer *)
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
if (buffer)
height = gimp_buffer_get_height (buffer);
......@@ -222,8 +218,7 @@ buffer_get_bytes_invoker (GimpProcedure *procedure,
if (success)
{
GimpBuffer *buffer = (GimpBuffer *)
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
if (buffer)
bytes = gimp_buffer_get_bytes (buffer);
......@@ -256,8 +251,7 @@ buffer_get_image_type_invoker (GimpProcedure *procedure,
if (success)
{
GimpBuffer *buffer = (GimpBuffer *)
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
if (buffer)
image_type = gimp_buffer_get_image_type (buffer);
......@@ -329,7 +323,7 @@ register_buffer_procs (GimpPDB *pdb)
gimp_param_spec_string ("buffer-name",
"buffer name",
"The buffer name",
FALSE, FALSE, FALSE,
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
......@@ -366,7 +360,7 @@ register_buffer_procs (GimpPDB *pdb)
gimp_param_spec_string ("buffer-name",
"buffer name",
"The buffer name",
FALSE, FALSE, FALSE,
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
......@@ -389,7 +383,7 @@ register_buffer_procs (GimpPDB *pdb)
gimp_param_spec_string ("buffer-name",
"buffer name",
"The buffer name",
FALSE, FALSE, FALSE,
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
......@@ -418,7 +412,7 @@ register_buffer_procs (GimpPDB *pdb)
gimp_param_spec_string ("buffer-name",
"buffer name",
"The buffer name",
FALSE, FALSE, FALSE,
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
......@@ -447,7 +441,7 @@ register_buffer_procs (GimpPDB *pdb)
gimp_param_spec_string ("buffer-name",
"buffer name",
"The buffer name",
FALSE, FALSE, FALSE,
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
......@@ -476,7 +470,7 @@ register_buffer_procs (GimpPDB *pdb)
gimp_param_spec_string ("buffer-name",
"buffer name",
"The buffer name",
FALSE, FALSE, FALSE,
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
......
......@@ -34,6 +34,7 @@
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
#include "gimppdb-utils.h"
#include "plug-in/gimpplugin-context.h"
#include "plug-in/gimpplugin.h"
#include "plug-in/gimppluginmanager.h"
......@@ -121,8 +122,7 @@ context_set_paint_method_invoker (GimpProcedure *procedure,
if (success)
{
GimpPaintInfo *paint_info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, name);
GimpPaintInfo *paint_info = gimp_pdb_get_paint_info (gimp, name, error);
if (paint_info)
gimp_context_set_paint_info (context, paint_info);
......@@ -386,8 +386,7 @@ context_set_brush_invoker (GimpProcedure *procedure,
if (success)
{
GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
if (brush)
gimp_context_set_brush (context, brush);
......@@ -440,8 +439,7 @@ context_set_pattern_invoker (GimpProcedure *procedure,
if (success)
{
GimpPattern *pattern = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container, name);
GimpPattern *pattern = gimp_pdb_get_pattern (gimp, name, error);
if (pattern)
gimp_context_set_pattern (context, pattern);
......@@ -494,8 +492,7 @@ context_set_gradient_invoker (GimpProcedure *procedure,
if (success)
{
GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
if (gradient)
gimp_context_set_gradient (context, gradient);
......@@ -548,8 +545,7 @@ context_set_palette_invoker (GimpProcedure *procedure,
if (success)
{
GimpPalette *palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
if (palette)
gimp_context_set_palette (context, palette);
......@@ -602,8 +598,7 @@ context_set_font_invoker (GimpProcedure *procedure,
if (success)
{
GimpFont *font = (GimpFont *)
gimp_container_get_child_by_name (gimp->fonts, name);
GimpFont *font = gimp_pdb_get_font (gimp, name, error);
if (font)
gimp_context_set_font (context, font);
......@@ -691,7 +686,7 @@ register_context_procs (GimpPDB *pdb)
gimp_param_spec_string ("name",
"name",
"The name of the paint method",
FALSE, FALSE, FALSE,
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
......@@ -978,7 +973,7 @@ register_context_procs (GimpPDB *pdb)
gimp_param_spec_string ("name",
"name",
"The name of the brush",
FALSE, FALSE, FALSE,
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
......@@ -1024,7 +1019,7 @@ register_context_procs (GimpPDB *pdb)
gimp_param_spec_string ("name",
"name",
"The name of the pattern",
FALSE, FALSE, FALSE,
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
......@@ -1070,7 +1065,7 @@ register_context_procs (GimpPDB *pdb)
gimp_param_spec_string ("name",
"name",
"The name of the gradient",
FALSE, FALSE, FALSE,
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
......@@ -1116,7 +1111,7 @@ register_context_procs (GimpPDB *pdb)
gimp_param_spec_string ("name",
"name",
"The name of the palette",
FALSE, FALSE, FALSE,
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
......@@ -1162,7 +1157,7 @@ register_context_procs (GimpPDB *pdb)
gimp_param_spec_string ("name",
"name",
"The name of the font",
FALSE, FALSE, FALSE,
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
......
......@@ -29,11 +29,9 @@
#include "core/gimpparamspecs.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpdatafactory.h"
#include "core/gimpimage-convert.h"
#include "core/gimpimage.h"
#include "core/gimppalette.h"
#include "gimppdb-utils.h"
#include "internal_procs.h"
......@@ -127,10 +125,8 @@ image_convert_indexed_invoker (GimpProcedure *procedure,
break;
case GIMP_CUSTOM_PALETTE:
pal = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container,
palette);
if (pal == NULL)
pal = gimp_pdb_get_palette (gimp, palette, FALSE, error);
if (! pal)
success = FALSE;
break;
......
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
#include <glib-object.h>
#include "pdb-types.h"
#include "core/gimp.h"
#include "core/gimpbrushgenerated.h"
#include "core/gimpcontainer.h"
#include "core/gimpdatafactory.h"
#include "gimppdb-utils.h"
#include "gimppdberror.h"
#include "gimp-intl.h"
GimpBrush *
gimp_pdb_get_brush (Gimp *gimp,
const gchar *name,
gboolean writable,
GError **error)
{
GimpBrush *brush;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (! name || ! strlen (name))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Invalid empty brush name"));
return NULL;
}
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (! brush)
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Brush '%s' not found"), name);
}
else if (writable && ! GIMP_DATA (brush)->writable)
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Brush '%s' is not editable"), name);
return NULL;
}
return brush;
}
GimpBrush *
gimp_pdb_get_generated_brush (Gimp *gimp,
const gchar *name,
gboolean writable,
GError **error)
{
GimpBrush *brush;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
brush = gimp_pdb_get_brush (gimp, name, writable, error);
if (! brush)
return NULL;
if (! GIMP_IS_BRUSH_GENERATED (brush))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Brush '%s' is not a generated brush"), name);
return NULL;
}
return brush;
}
GimpPattern *
gimp_pdb_get_pattern (Gimp *gimp,
const gchar *name,
GError **error)
{
GimpPattern *pattern;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (! name || ! strlen (name))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Invalid empty pattern name"));
return NULL;
}
pattern = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container, name);
if (! pattern)
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Pattern '%s' not found"), name);
}
return pattern;
}
GimpGradient *
gimp_pdb_get_gradient (Gimp *gimp,
const gchar *name,
gboolean writable,
GError **error)
{
GimpGradient *gradient;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (! name || ! strlen (name))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Invalid empty gradient name"));
return NULL;
}
gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (! gradient)
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Gradient '%s' not found"), name);
}
else if (writable && ! GIMP_DATA (gradient)->writable)
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Gradient '%s' is not editable"), name);
return NULL;
}
return gradient;
}
GimpPalette *
gimp_pdb_get_palette (Gimp *gimp,
const gchar *name,
gboolean writable,
GError **error)
{
GimpPalette *palette;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (! name || ! strlen (name))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Invalid empty palette name"));
return NULL;
}
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (! palette)
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Palette '%s' not found"), name);
}
else if (writable && ! GIMP_DATA (palette)->writable)
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Palette '%s' is not editable"), name);
return NULL;
}
return palette;
}
GimpFont *
gimp_pdb_get_font (Gimp *gimp,
const gchar *name,
GError **error)
{
GimpFont *font;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (! name || ! strlen (name))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Invalid empty font name"));
return NULL;
}
font = (GimpFont *)
gimp_container_get_child_by_name (gimp->fonts, name);
if (! font)
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Font '%s' not found"), name);
}
return font;
}
GimpBuffer *
gimp_pdb_get_buffer (Gimp *gimp,
const gchar *name,
GError **error)
{
GimpBuffer *buffer;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (! name || ! strlen (name))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Invalid empty buffer name"));
return NULL;
}
buffer = (GimpBuffer *)
gimp_container_get_child_by_name (gimp->named_buffers, name);
if (! buffer)
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Named buffer '%s' not found"), name);
}
return buffer;
}
GimpPaintInfo *
gimp_pdb_get_paint_info (Gimp *gimp,
const gchar *name,
GError **error)
{
GimpPaintInfo *paint_info;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (! name || ! strlen (name))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Invalid empty paint method name"));
return NULL;
}
paint_info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, name);
if (! paint_info)
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Paint method '%s' does not exist"), name);
}
return paint_info;
}
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_PDB_UTILS_H__
#define __GIMP_PDB_UTILS_H__
GimpBrush * gimp_pdb_get_brush (Gimp *gimp,
const gchar *name,
gboolean writable,
GError **error);
GimpBrush * gimp_pdb_get_generated_brush (Gimp *gimp,
const gchar *name,
gboolean writable,
GError **error);
GimpPattern * gimp_pdb_get_pattern (Gimp *gimp,
const gchar *name,
GError **error);
GimpGradient * gimp_pdb_get_gradient (Gimp *gimp,
const gchar *name,
gboolean writable,
GError **error);
GimpPalette * gimp_pdb_get_palette (Gimp *gimp,
const gchar *name,
gboolean writable,
GError **error);
GimpFont * gimp_pdb_get_font (Gimp *gimp,
const gchar *name,
GError **error);
GimpBuffer * gimp_pdb_get_buffer (Gimp *gimp,
const gchar *name,
GError **error);
GimpPaintInfo * gimp_pdb_get_paint_info (Gimp *gimp,
const gchar *name,
GError **error);
#endif /* __GIMP_PDB_UTILS_H__ */
This diff is collapsed.
......@@ -34,7 +34,7 @@
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
#include "core/gimpgradient.h"
#include "core/gimplist.h"
#include "gimppdb-utils.h"
#include "internal_procs.h"
......@@ -231,15 +231,9 @@ gradients_get_gradient_data_invoker (GimpProcedure *procedure,
sample_size = GIMP_GRADIENT_DEFAULT_SAMPLE_SIZE;
if (name && strlen (name))
{
gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container,
name);
}
gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
else
{
gradient = gimp_context_get_gradient (context);
}
gradient = gimp_context_get_gradient (context);
if (gradient)
{
......
......@@ -31,9 +31,9 @@
#include "core/gimpparamspecs.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpdrawable.h"
#include "core/gimppaintinfo.h"
#include "gimppdb-utils.h"
#include "paint/gimppaintcore-stroke.h"
#include "paint/gimppaintcore.h"
#include "paint/gimppaintoptions.h"
......@@ -117,12 +117,9 @@ airbrush_invoker (GimpProcedure *procedure,
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-airbrush");
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-airbrush", error);
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
{