check that the palette name actually refers to an existing palette and use

2006-08-18  Sven Neumann  <sven@gimp.org>

	* libgimp/gimppaletteselectbutton.c
	(gimp_palette_select_button_set_palette): check that the palette
	name actually refers to an existing palette and use the active
	palette if name is NULL or empty (like the other select buttons).

	* plug-ins/pygimp/plug-ins/palette-offset.py: use an integer value
	for a PF_INT parameter.
This commit is contained in:
Sven Neumann 2006-08-18 10:52:26 +00:00 committed by Sven Neumann
parent cbbc80c24e
commit cec47fef1f
3 changed files with 33 additions and 8 deletions

View file

@ -1,3 +1,13 @@
2006-08-18 Sven Neumann <sven@gimp.org>
* libgimp/gimppaletteselectbutton.c
(gimp_palette_select_button_set_palette): check that the palette
name actually refers to an existing palette and use the active
palette if name is NULL or empty (like the other select buttons).
* plug-ins/pygimp/plug-ins/palette-offset.py: use an integer value
for a PF_INT parameter.
2006-08-18 Sven Neumann <sven@gimp.org>
* plug-ins/pygimp/gimpfu.py: check if the menupath starts with

View file

@ -204,13 +204,13 @@ gimp_palette_select_button_new (const gchar *title,
if (title)
button = g_object_new (GIMP_TYPE_PALETTE_SELECT_BUTTON,
"title", title,
"palette-name", palette_name,
NULL);
"title", title,
"palette-name", palette_name,
NULL);
else
button = g_object_new (GIMP_TYPE_PALETTE_SELECT_BUTTON,
"palette-name", palette_name,
NULL);
"palette-name", palette_name,
NULL);
return button;
}
@ -256,9 +256,24 @@ gimp_palette_select_button_set_palette (GimpPaletteSelectButton *button,
select_button = GIMP_SELECT_BUTTON (button);
if (select_button->temp_callback)
gimp_palettes_set_popup (select_button->temp_callback, palette_name);
{
gimp_palettes_set_popup (select_button->temp_callback, palette_name);
}
else
gimp_palette_select_button_callback (palette_name, FALSE, button);
{
gchar *name;
gint num_colors;
if (palette_name && *palette_name)
name = g_strdup (palette_name);
else
name = gimp_context_get_palette ();
if (gimp_palette_get_info (name, &num_colors))
gimp_palette_select_button_callback (name, FALSE, button);
g_free (name);
}
}

View file

@ -53,7 +53,7 @@ register(
"",
[
(PF_PALETTE, "palette", "Name of palette to offset", ""),
(PF_INT, "amount", "Amount of colors to offset", ""),
(PF_INT, "amount", "Amount of colors to offset", 1),
(PF_BOOL, "forward", "Offset the palette forward?", True)
],
[(PF_PALETTE, "new-palette", "Name of offset palette.")],