Commit caf47869 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

tools/pdbgen/pdb/brushes.pdb (brushes_get_brush_data)

2004-10-06  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/brushes.pdb (brushes_get_brush_data)
	* tools/pdbgen/pdb/gradients.pdb (gradients_sample_uniform)
	(gradients_sample_custom) (gradients_get_gradient_data)
	* tools/pdbgen/pdb/patterns.pdb (patterns_get_pattern_data):
	deprecated.

	* tools/pdbgen/pdb/brush.pdb
	* tools/pdbgen/pdb/gradient.pdb
	* tools/pdbgen/pdb/palette.pdb
	* tools/pdbgen/pdb/pattern.pdb: added replacements for the
	deprecated functions. Removed the silly feature that passing NULL
	as name operates on the current brush, pattern etc.

	* app/pdb/brush_cmds.c
	* app/pdb/brushes_cmds.c
	* app/pdb/gradient_cmds.c
	* app/pdb/gradients_cmds.c
	* app/pdb/internal_procs.c
	* app/pdb/palette_cmds.c
	* app/pdb/pattern_cmds.c
	* app/pdb/patterns_cmds.c
	* libgimp/gimpbrush_pdb.[ch]
	* libgimp/gimpbrushes_pdb.[ch]
	* libgimp/gimpgradient_pdb.[ch]
	* libgimp/gimpgradients_pdb.[ch]
	* libgimp/gimppalette_pdb.c
	* libgimp/gimppattern_pdb.[ch]
	* libgimp/gimppatterns_pdb.[ch]: regenerated.

	* libgimp/gimpbrushmenu.c
	* libgimp/gimpgradientmenu.c
	* libgimp/gimppatternmenu.c
	* plug-ins/FractalExplorer/Dialogs.c
	* plug-ins/common/gradmap.c
	* plug-ins/common/sample_colorize.c
	* plug-ins/flame/flame.c
	* plug-ins/gfig/gfig-style.c
	* plug-ins/gflare/gflare.c
	* plug-ins/pagecurl/pagecurl.c
	* plug-ins/script-fu/scripts/spyrogimp.scm: changed accordingly.
parent c7e1f32a
2004-10-06 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/brushes.pdb (brushes_get_brush_data)
* tools/pdbgen/pdb/gradients.pdb (gradients_sample_uniform)
(gradients_sample_custom) (gradients_get_gradient_data)
* tools/pdbgen/pdb/patterns.pdb (patterns_get_pattern_data):
deprecated.
* tools/pdbgen/pdb/brush.pdb
* tools/pdbgen/pdb/gradient.pdb
* tools/pdbgen/pdb/palette.pdb
* tools/pdbgen/pdb/pattern.pdb: added replacements for the
deprecated functions. Removed the silly feature that passing NULL
as name operates on the current brush, pattern etc.
* app/pdb/brush_cmds.c
* app/pdb/brushes_cmds.c
* app/pdb/gradient_cmds.c
* app/pdb/gradients_cmds.c
* app/pdb/internal_procs.c
* app/pdb/palette_cmds.c
* app/pdb/pattern_cmds.c
* app/pdb/patterns_cmds.c
* libgimp/gimpbrush_pdb.[ch]
* libgimp/gimpbrushes_pdb.[ch]
* libgimp/gimpgradient_pdb.[ch]
* libgimp/gimpgradients_pdb.[ch]
* libgimp/gimppalette_pdb.c
* libgimp/gimppattern_pdb.[ch]
* libgimp/gimppatterns_pdb.[ch]: regenerated.
* libgimp/gimpbrushmenu.c
* libgimp/gimpgradientmenu.c
* libgimp/gimppatternmenu.c
* plug-ins/FractalExplorer/Dialogs.c
* plug-ins/common/gradmap.c
* plug-ins/common/sample_colorize.c
* plug-ins/flame/flame.c
* plug-ins/gfig/gfig-style.c
* plug-ins/gflare/gflare.c
* plug-ins/pagecurl/pagecurl.c
* plug-ins/script-fu/scripts/spyrogimp.scm: changed accordingly.
2004-10-06 Sven Neumann <sven@gimp.org>
* plug-ins/common/spheredesigner.c: improved the dialog a bit,
......
......@@ -39,6 +39,7 @@ static ProcRecord brush_duplicate_proc;
static ProcRecord brush_rename_proc;
static ProcRecord brush_delete_proc;
static ProcRecord brush_get_info_proc;
static ProcRecord brush_get_pixels_proc;
static ProcRecord brush_get_spacing_proc;
static ProcRecord brush_set_spacing_proc;
......@@ -50,6 +51,7 @@ register_brush_procs (Gimp *gimp)
procedural_db_register (gimp, &brush_rename_proc);
procedural_db_register (gimp, &brush_delete_proc);
procedural_db_register (gimp, &brush_get_info_proc);
procedural_db_register (gimp, &brush_get_pixels_proc);
procedural_db_register (gimp, &brush_get_spacing_proc);
procedural_db_register (gimp, &brush_set_spacing_proc);
}
......@@ -132,21 +134,13 @@ brush_duplicate_invoker (Gimp *gimp,
GimpBrush *brush_copy = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name && !g_utf8_validate (name, -1, NULL))
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
if (name && strlen (name))
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container,
name);
}
else
{
brush = gimp_context_get_brush (context);
}
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush)
{
......@@ -173,7 +167,7 @@ static ProcArg brush_duplicate_inargs[] =
{
GIMP_PDB_STRING,
"name",
"The brush name (\"\" means currently active brush)"
"The brush name"
}
};
......@@ -215,7 +209,7 @@ brush_rename_invoker (Gimp *gimp,
GimpBrush *brush = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name && !g_utf8_validate (name, -1, NULL))
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
new_name = (gchar *) args[1].value.pdb_pointer;
......@@ -224,16 +218,8 @@ brush_rename_invoker (Gimp *gimp,
if (success)
{
if (name && strlen (name))
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container,
name);
}
else
{
brush = gimp_context_get_brush (context);
}
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable)
gimp_object_set_name (GIMP_OBJECT (brush), new_name);
......@@ -254,7 +240,7 @@ static ProcArg brush_rename_inargs[] =
{
GIMP_PDB_STRING,
"name",
"The brush name (\"\" means currently active brush)"
"The brush name"
},
{
GIMP_PDB_STRING,
......@@ -299,21 +285,13 @@ brush_delete_invoker (Gimp *gimp,
GimpBrush *brush = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name && !g_utf8_validate (name, -1, NULL))
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
if (name && strlen (name))
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container,
name);
}
else
{
brush = gimp_context_get_brush (context);
}
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->deletable)
{
......@@ -341,7 +319,7 @@ static ProcArg brush_delete_inargs[] =
{
GIMP_PDB_STRING,
"name",
"The brush name (\"\" means currently active brush)"
"The brush name"
}
};
......@@ -373,21 +351,13 @@ brush_get_info_invoker (Gimp *gimp,
GimpBrush *brush = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name && !g_utf8_validate (name, -1, NULL))
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
if (name && strlen (name))
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container,
name);
}
else
{
brush = gimp_context_get_brush (context);
}
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL);
}
......@@ -408,7 +378,7 @@ static ProcArg brush_get_info_inargs[] =
{
GIMP_PDB_STRING,
"name",
"The brush name (\"\" means currently active brush)"
"The brush name"
}
};
......@@ -442,6 +412,99 @@ static ProcRecord brush_get_info_proc =
{ { brush_get_info_invoker } }
};
static Argument *
brush_get_pixels_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar *name;
gint32 num_mask_bytes = 0;
guint8 *mask_bytes = NULL;
GimpBrush *brush = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush)
{
num_mask_bytes = brush->mask->height * brush->mask->width;
mask_bytes = g_memdup (temp_buf_data (brush->mask), num_mask_bytes);
}
else
success = FALSE;
}
return_args = procedural_db_return_args (&brush_get_pixels_proc, success);
if (success)
{
return_args[1].value.pdb_int = brush->mask->width;
return_args[2].value.pdb_int = brush->mask->height;
return_args[3].value.pdb_int = num_mask_bytes;
return_args[4].value.pdb_pointer = mask_bytes;
}
return return_args;
}
static ProcArg brush_get_pixels_inargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The brush name"
}
};
static ProcArg brush_get_pixels_outargs[] =
{
{
GIMP_PDB_INT32,
"width",
"The brush width"
},
{
GIMP_PDB_INT32,
"height",
"The brush height"
},
{
GIMP_PDB_INT32,
"num_mask_bytes",
"Length of brush mask data"
},
{
GIMP_PDB_INT8ARRAY,
"mask_bytes",
"The brush mask data"
}
};
static ProcRecord brush_get_pixels_proc =
{
"gimp_brush_get_pixels",
"Retrieve information about the specified brush.",
"This procedure retrieves information about the specified brush. This includes the brush extents (width and height) and its pixels data.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004",
GIMP_INTERNAL,
1,
brush_get_pixels_inargs,
4,
brush_get_pixels_outargs,
{ { brush_get_pixels_invoker } }
};
static Argument *
brush_get_spacing_invoker (Gimp *gimp,
GimpContext *context,
......@@ -454,21 +517,13 @@ brush_get_spacing_invoker (Gimp *gimp,
GimpBrush *brush = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name && !g_utf8_validate (name, -1, NULL))
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
if (name && strlen (name))
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container,
name);
}
else
{
brush = gimp_context_get_brush (context);
}
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL);
}
......@@ -476,7 +531,7 @@ brush_get_spacing_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&brush_get_spacing_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_brush_get_spacing (gimp_context_get_brush (context));
return_args[1].value.pdb_int = gimp_brush_get_spacing (brush);
return return_args;
}
......@@ -486,7 +541,7 @@ static ProcArg brush_get_spacing_inargs[] =
{
GIMP_PDB_STRING,
"name",
"The brush name (\"\" means currently active brush)"
"The brush name"
}
};
......@@ -527,7 +582,7 @@ brush_set_spacing_invoker (Gimp *gimp,
GimpBrush *brush = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name && !g_utf8_validate (name, -1, NULL))
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
spacing = args[1].value.pdb_int;
......@@ -536,16 +591,8 @@ brush_set_spacing_invoker (Gimp *gimp,
if (success)
{
if (name && strlen (name))
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container,
name);
}
else
{
brush = gimp_context_get_brush (context);
}
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable)
gimp_brush_set_spacing (brush, spacing);
......@@ -561,7 +608,7 @@ static ProcArg brush_set_spacing_inargs[] =
{
GIMP_PDB_STRING,
"name",
"The brush name (\"\" means currently active brush)"
"The brush name"
},
{
GIMP_PDB_INT32,
......
......@@ -408,11 +408,11 @@ static ProcArg brushes_get_brush_data_outargs[] =
static ProcRecord brushes_get_brush_data_proc =
{
"gimp_brushes_get_brush_data",
"Retrieve information about the currently active brush (including data).",
"This procedure retrieves information about the currently active brush. This includes the brush name, and the brush extents (width and height). It also returns the brush data.",
"Andy Thomas",
"Andy Thomas",
"1998",
"This procedure is deprecated! Use 'gimp_brush_get_pixels' instead.",
"This procedure is deprecated! Use 'gimp_brush_get_pixels' instead.",
"",
"",
"",
GIMP_INTERNAL,
1,
brushes_get_brush_data_inargs,
......
This diff is collapsed.
......@@ -235,11 +235,11 @@ static ProcArg gradients_sample_uniform_outargs[] =
static ProcRecord gradients_sample_uniform_proc =
{
"gimp_gradients_sample_uniform",
"Sample the active gradient in uniform parts.",
"This procedure samples the active gradient in the specified number of uniform parts. It returns a list of floating-point values which correspond to the RGBA values for each sample. The minimum number of samples to take is 2, in which case the returned colors will correspond to the { 0.0, 1.0 } positions in the gradient. For example, if the number of samples is 3, the procedure will return the colors at positions { 0.0, 0.5, 1.0 }.",
"Federico Mena Quintero",
"Federico Mena Quintero",
"1997",
"This procedure is deprecated! Use 'gimp_gradient_get_uniform_samples' instead.",
"This procedure is deprecated! Use 'gimp_gradient_get_uniform_samples' instead.",
"",
"",
"",
GIMP_INTERNAL,
2,
gradients_sample_uniform_inargs,
......@@ -341,11 +341,11 @@ static ProcArg gradients_sample_custom_outargs[] =
static ProcRecord gradients_sample_custom_proc =
{
"gimp_gradients_sample_custom",
"Sample the active gradient in custom positions.",
"This procedure samples the active gradient in the specified number of points. The procedure will sample the gradient in the specified positions from the list. The left endpoint of the gradient corresponds to position 0.0, and the right endpoint corresponds to 1.0. The procedure returns a list of floating-point values which correspond to the RGBA values for each sample.",
"Federico Mena Quintero",
"Federico Mena Quintero",
"1997",
"This procedure is deprecated! Use 'gimp_gradient_get_custom_samples' instead.",
"This procedure is deprecated! Use 'gimp_gradient_get_custom_samples' instead.",
"",
"",
"",
GIMP_INTERNAL,
3,
gradients_sample_custom_inargs,
......@@ -381,15 +381,15 @@ gradients_get_gradient_data_invoker (Gimp *gimp,
if (success)
{
if (name && strlen (name))
{
gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container,
name);
}
else
{
gradient = gimp_context_get_gradient (context);
}
{
gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container,
name);
}
else
{
gradient = gimp_context_get_gradient (context);
}
if (gradient)
{
......@@ -473,11 +473,11 @@ static ProcArg gradients_get_gradient_data_outargs[] =
static ProcRecord gradients_get_gradient_data_proc =
{
"gimp_gradients_get_gradient_data",
"Retrieve information about the specified gradient (including data).",
"This procedure retrieves information about the gradient. This includes the gradient name, and the sample data for the gradient.",
"Federico Mena Quintero",
"Federico Mena Quintero",
"1997",
"This procedure is deprecated! Use 'gimp_gradient_get_uniform_samples' instead.",
"This procedure is deprecated! Use 'gimp_gradient_get_uniform_samples' instead.",
"",
"",
"",
GIMP_INTERNAL,
3,
gradients_get_gradient_data_inargs,
......
......@@ -73,7 +73,7 @@ void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 408 procedures registered total */
/* 412 procedures registered total */
void
internal_procs_init (Gimp *gimp,
......@@ -85,25 +85,25 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (_("Internal Procedures"), _("Brush"), 0.0);
register_brush_procs (gimp);
(* status_callback) (NULL, _("Brush UI"), 0.017);
(* status_callback) (NULL, _("Brush UI"), 0.019);
register_brush_select_procs (gimp);
(* status_callback) (NULL, _("Brushes"), 0.025);
(* status_callback) (NULL, _("Brushes"), 0.027);
register_brushes_procs (gimp);
(* status_callback) (NULL, _("Channel"), 0.039);
(* status_callback) (NULL, _("Channel"), 0.041);
register_channel_procs (gimp);
(* status_callback) (NULL, _("Color"), 0.061);
(* status_callback) (NULL, _("Color"), 0.063);
register_color_procs (gimp);
(* status_callback) (NULL, _("Context"), 0.096);
(* status_callback) (NULL, _("Context"), 0.097);
register_context_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.15);
register_convert_procs (gimp);
(* status_callback) (NULL, _("Display procedures"), 0.157);
(* status_callback) (NULL, _("Display procedures"), 0.158);
register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.167);
......@@ -115,94 +115,94 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("File Operations"), 0.265);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.287);
(* status_callback) (NULL, _("Floating selections"), 0.286);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.301);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.309);
(* status_callback) (NULL, _("Fonts"), 0.308);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.314);
(* status_callback) (NULL, _("Gimprc procedures"), 0.313);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient"), 0.328);
register_gradient_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.395);
(* status_callback) (NULL, _("Gradient UI"), 0.398);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.402);
(* status_callback) (NULL, _("Gradients"), 0.405);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.414);
(* status_callback) (NULL, _("Guide procedures"), 0.417);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.429);
(* status_callback) (NULL, _("Help procedures"), 0.432);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.431);
(* status_callback) (NULL, _("Image"), 0.434);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.583);
(* status_callback) (NULL, _("Layer"), 0.585);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.647);
(* status_callback) (NULL, _("Message procedures"), 0.648);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.654);
(* status_callback) (NULL, _("Miscellaneous"), 0.655);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.659);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.66);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.696);
(* status_callback) (NULL, _("Palette"), 0.697);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.723);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.73);
(* status_callback) (NULL, _("Palettes"), 0.731);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.74);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.77);
(* status_callback) (NULL, _("Paths"), 0.769);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern"), 0.806);
register_pattern_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.809);
(* status_callback) (NULL, _("Pattern UI"), 0.811);
register_pattern_select_procs (gimp);
(* status_callback) (NULL, _("Patterns"), 0.816);
(* status_callback) (NULL, _("Patterns"), 0.818);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.826);
(* status_callback) (NULL, _("Plug-in"), 0.828);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.838);
(* status_callback) (NULL, _("Procedural database"), 0.84);
register_procedural_db_procs (gimp);
(* status_callback) (NULL, _("Progress"), 0.86);
(* status_callback) (NULL, _("Progress"), 0.862);
register_progress_procs (gimp);
(* status_callback) (NULL, _("Image mask"), 0.873);
(* status_callback) (NULL, _("Image mask"), 0.874);
register_selection_procs (gimp);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.917);
register_selection_tools_procs (gimp);
(* status_callback) (NULL, _("Text procedures"), 0.929);
(* status_callback) (NULL, _("Text procedures"), 0.93);
register_text_tool_procs (gimp);
(* status_callback) (NULL, _("Transform Tool procedures"), 0.939);
register_transform_tools_procs (gimp);
(* status_callback) (NULL, _("Undo"), 0.953);
(* status_callback) (NULL, _("Undo"), 0.954);
register_undo_procs (gimp);
(* status_callback) (NULL, _("Units"), 0.971);
......
......@@ -141,21 +141,13 @@ palette_duplicate_invoker (Gimp *gimp,
GimpPalette *palette_copy = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name && !g_utf8_validate (name, -1, NULL))
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
if (name && strlen (name))
{
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container,
name);
}
else
{
palette = gimp_context_get_palette (context);
}
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette)
{
......@@ -182,7 +174,7 @@ static ProcArg palette_duplicate_inargs[] =
{
GIMP_PDB_STRING,
"name",
"The palette name (\"\" means currently active palette)"
"The palette name."
}
};
......@@ -224,7 +216,7 @@ palette_rename_invoker (Gimp *gimp,
GimpPalette *palette = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name && !g_utf8_validate (name, -1, NULL))
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
new_name = (gchar *) args[1].value.pdb_pointer;
......@@ -233,16 +225,8 @@ palette_rename_invoker (Gimp *gimp,
if (success)
{
if (name && strlen (name))
{
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container,
name);
}
else
{
palette = gimp_context_get_palette (context);
}
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette && GIMP_DATA (palette)->writable)
gimp_object_set_name (GIMP_OBJECT (palette), new_name);
......@@ -263,7 +247,7 @@ static ProcArg palette_rename_inargs[] =
{
GIMP_PDB_STRING,
"name",
"The palette name (\"\" means currently active palette)"
"The palette name."
},
{
GIMP_PDB_STRING,
......@@ -308,21 +292,13 @@ palette_delete_invoker (Gimp *gimp,
GimpPalette *palette = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name && !g_utf8_validate (name, -1, NULL))
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
if (name && strlen (name))
{
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container,
name);
}
else
{
palette = gimp_context_get_palette (context);
}
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette && GIMP_DATA (palette)->deletable)
{
......@@ -350,7 +326,7 @@ static ProcArg palette_delete_inargs[] =
{
GIMP_PDB_STRING,
"name",
"The palette name (\"\" means currently active palette)"