added GError parameter to gimp_image_{raise,lower}_{channel,layer,vectors}

2008-09-16  Sven Neumann  <sven@gimp.org>

	* app/core/gimpimage.[ch]: added GError parameter to
	gimp_image_{raise,lower}_{channel,layer,vectors} functions and
	removed calls to g_message().

	* app/actions/channels-commands.c
	* app/actions/layers-commands.c
	* app/actions/vectors-commands.c: pass NULL for the GError
	parameter as these actions are insensitive if they would fail.

	* tools/pdbgen/pdb/image.pdb: changed accordingly. Corrected the
	documentation.

	* app/pdb/image-cmds.c
	* libgimp/gimpimage_pdb.c: regenerated.


svn path=/trunk/; revision=26953
This commit is contained in:
Sven Neumann 2008-09-16 20:56:41 +00:00 committed by Sven Neumann
parent db7c35373d
commit b2ad06a19f
9 changed files with 96 additions and 102 deletions

View File

@ -1,3 +1,20 @@
2008-09-16 Sven Neumann <sven@gimp.org>
* app/core/gimpimage.[ch]: added GError parameter to
gimp_image_{raise,lower}_{channel,layer,vectors} functions and
removed calls to g_message().
* app/actions/channels-commands.c
* app/actions/layers-commands.c
* app/actions/vectors-commands.c: pass NULL for the GError
parameter as these actions are insensitive if they would fail.
* tools/pdbgen/pdb/image.pdb: changed accordingly. Corrected the
documentation.
* app/pdb/image-cmds.c
* libgimp/gimpimage_pdb.c: regenerated.
2008-09-16 Sven Neumann <sven@gimp.org>
* app/core/gimppalette-load.c (gimp_palette_load): unified error

View File

@ -181,7 +181,7 @@ channels_raise_cmd_callback (GtkAction *action,
GimpChannel *channel;
return_if_no_channel (image, channel, data);
gimp_image_raise_channel (image, channel);
gimp_image_raise_channel (image, channel, NULL);
gimp_image_flush (image);
}
@ -205,7 +205,7 @@ channels_lower_cmd_callback (GtkAction *action,
GimpChannel *channel;
return_if_no_channel (image, channel, data);
gimp_image_lower_channel (image, channel);
gimp_image_lower_channel (image, channel, NULL);
gimp_image_flush (image);
}

View File

@ -387,7 +387,7 @@ layers_raise_cmd_callback (GtkAction *action,
GimpLayer *layer;
return_if_no_layer (image, layer, data);
gimp_image_raise_layer (image, layer);
gimp_image_raise_layer (image, layer, NULL);
gimp_image_flush (image);
}
@ -411,7 +411,7 @@ layers_lower_cmd_callback (GtkAction *action,
GimpLayer *layer;
return_if_no_layer (image, layer, data);
gimp_image_lower_layer (image, layer);
gimp_image_lower_layer (image, layer, NULL);
gimp_image_flush (image);
}

View File

@ -200,7 +200,7 @@ vectors_raise_cmd_callback (GtkAction *action,
GimpVectors *vectors;
return_if_no_vectors (image, vectors, data);
gimp_image_raise_vectors (image, vectors);
gimp_image_raise_vectors (image, vectors, NULL);
gimp_image_flush (image);
}
@ -224,7 +224,7 @@ vectors_lower_cmd_callback (GtkAction *action,
GimpVectors *vectors;
return_if_no_vectors (image, vectors, data);
gimp_image_lower_vectors (image, vectors);
gimp_image_lower_vectors (image, vectors, NULL);
gimp_image_flush (image);
}

View File

@ -3096,20 +3096,22 @@ gimp_image_add_layers (GimpImage *image,
}
gboolean
gimp_image_raise_layer (GimpImage *image,
GimpLayer *layer)
gimp_image_raise_layer (GimpImage *image,
GimpLayer *layer,
GError **error)
{
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
index = gimp_container_get_child_index (image->layers,
GIMP_OBJECT (layer));
if (index == 0)
{
g_message (_("Layer cannot be raised higher."));
g_set_error (error, 0, 0, "%s", _("Layer cannot be raised higher."));
return FALSE;
}
@ -3118,20 +3120,22 @@ gimp_image_raise_layer (GimpImage *image,
}
gboolean
gimp_image_lower_layer (GimpImage *image,
GimpLayer *layer)
gimp_image_lower_layer (GimpImage *image,
GimpLayer *layer,
GError **error)
{
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
index = gimp_container_get_child_index (image->layers,
GIMP_OBJECT (layer));
if (index == gimp_container_num_children (image->layers) - 1)
{
g_message (_("Layer cannot be lowered more."));
g_set_error (error, 0, 0, "%s", _("Layer cannot be lowered more."));
return FALSE;
}
@ -3324,20 +3328,22 @@ gimp_image_remove_channel (GimpImage *image,
}
gboolean
gimp_image_raise_channel (GimpImage *image,
GimpChannel *channel)
gimp_image_raise_channel (GimpImage *image,
GimpChannel *channel,
GError **error)
{
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
index = gimp_container_get_child_index (image->channels,
GIMP_OBJECT (channel));
if (index == 0)
{
g_message (_("Channel cannot be raised higher."));
g_set_error (error, 0, 0, "%s", _("Channel cannot be raised higher."));
return FALSE;
}
@ -3349,39 +3355,31 @@ gboolean
gimp_image_raise_channel_to_top (GimpImage *image,
GimpChannel *channel)
{
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
index = gimp_container_get_child_index (image->channels,
GIMP_OBJECT (channel));
if (index == 0)
{
g_message (_("Channel is already on top."));
return FALSE;
}
return gimp_image_position_channel (image, channel, 0,
TRUE, _("Raise Channel to Top"));
}
gboolean
gimp_image_lower_channel (GimpImage *image,
GimpChannel *channel)
gimp_image_lower_channel (GimpImage *image,
GimpChannel *channel,
GError **error)
{
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
index = gimp_container_get_child_index (image->channels,
GIMP_OBJECT (channel));
if (index == gimp_container_num_children (image->channels) - 1)
{
g_message (_("Channel cannot be lowered more."));
g_set_error (error, 0, 0, "%s", _("Channel cannot be lowered more."));
return FALSE;
}
@ -3393,23 +3391,13 @@ gboolean
gimp_image_lower_channel_to_bottom (GimpImage *image,
GimpChannel *channel)
{
gint index;
gint length;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
index = gimp_container_get_child_index (image->channels,
GIMP_OBJECT (channel));
length = gimp_container_num_children (image->channels);
if (index == length - 1)
{
g_message (_("Channel is already on the bottom."));
return FALSE;
}
return gimp_image_position_channel (image, channel, length - 1,
TRUE, _("Lower Channel to Bottom"));
}
@ -3562,20 +3550,22 @@ gimp_image_remove_vectors (GimpImage *image,
}
gboolean
gimp_image_raise_vectors (GimpImage *image,
GimpVectors *vectors)
gimp_image_raise_vectors (GimpImage *image,
GimpVectors *vectors,
GError **error)
{
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
index = gimp_container_get_child_index (image->vectors,
GIMP_OBJECT (vectors));
if (index == 0)
{
g_message (_("Path cannot be raised higher."));
g_set_error (error, 0, 0, "%s", _("Path cannot be raised higher."));
return FALSE;
}
@ -3587,39 +3577,30 @@ gboolean
gimp_image_raise_vectors_to_top (GimpImage *image,
GimpVectors *vectors)
{
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
index = gimp_container_get_child_index (image->vectors,
GIMP_OBJECT (vectors));
if (index == 0)
{
g_message (_("Path is already on top."));
return FALSE;
}
return gimp_image_position_vectors (image, vectors, 0,
TRUE, _("Raise Path to Top"));
}
gboolean
gimp_image_lower_vectors (GimpImage *image,
GimpVectors *vectors)
gimp_image_lower_vectors (GimpImage *image,
GimpVectors *vectors,
GError **error)
{
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
index = gimp_container_get_child_index (image->vectors,
GIMP_OBJECT (vectors));
if (index == gimp_container_num_children (image->vectors) - 1)
{
g_message (_("Path cannot be lowered more."));
g_set_error (error, 0, 0, "%s", _("Path cannot be lowered more."));
return FALSE;
}
@ -3631,23 +3612,13 @@ gboolean
gimp_image_lower_vectors_to_bottom (GimpImage *image,
GimpVectors *vectors)
{
gint index;
gint length;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
index = gimp_container_get_child_index (image->vectors,
GIMP_OBJECT (vectors));
length = gimp_container_num_children (image->vectors);
if (index == length - 1)
{
g_message (_("Path is already on the bottom."));
return FALSE;
}
return gimp_image_position_vectors (image, vectors, length - 1,
TRUE, _("Lower Path to Bottom"));
}

View File

@ -472,9 +472,11 @@ void gimp_image_add_layers (GimpImage *image,
const gchar *undo_desc);
gboolean gimp_image_raise_layer (GimpImage *image,
GimpLayer *layer);
GimpLayer *layer,
GError **error);
gboolean gimp_image_lower_layer (GimpImage *image,
GimpLayer *layer);
GimpLayer *layer,
GError **error);
gboolean gimp_image_raise_layer_to_top (GimpImage *image,
GimpLayer *layer);
gboolean gimp_image_lower_layer_to_bottom (GimpImage *image,
@ -492,11 +494,13 @@ void gimp_image_remove_channel (GimpImage *image,
GimpChannel *channel);
gboolean gimp_image_raise_channel (GimpImage *image,
GimpChannel *channel);
GimpChannel *channel,
GError **error);
gboolean gimp_image_raise_channel_to_top (GimpImage *image,
GimpChannel *channel);
gboolean gimp_image_lower_channel (GimpImage *image,
GimpChannel *channel);
GimpChannel *channel,
GError **error);
gboolean gimp_image_lower_channel_to_bottom (GimpImage *image,
GimpChannel *channel);
gboolean gimp_image_position_channel (GimpImage *image,
@ -512,11 +516,13 @@ void gimp_image_remove_vectors (GimpImage *image,
GimpVectors *vectors);
gboolean gimp_image_raise_vectors (GimpImage *image,
GimpVectors *vectors);
GimpVectors *vectors,
GError **error);
gboolean gimp_image_raise_vectors_to_top (GimpImage *image,
GimpVectors *vectors);
gboolean gimp_image_lower_vectors (GimpImage *image,
GimpVectors *vectors);
GimpVectors *vectors,
GError **error);
gboolean gimp_image_lower_vectors_to_bottom (GimpImage *image,
GimpVectors *vectors);
gboolean gimp_image_position_vectors (GimpImage *image,

View File

@ -958,7 +958,7 @@ image_raise_layer_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_raise_layer (image, layer);
success = gimp_image_raise_layer (image, layer, error);
}
return gimp_procedure_get_return_values (procedure, success,
@ -982,7 +982,7 @@ image_lower_layer_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_lower_layer (image, layer);
success = gimp_image_lower_layer (image, layer, error);
}
return gimp_procedure_get_return_values (procedure, success,
@ -1148,7 +1148,7 @@ image_raise_channel_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_raise_channel (image, channel);
success = gimp_image_raise_channel (image, channel, error);
}
return gimp_procedure_get_return_values (procedure, success,
@ -1172,7 +1172,7 @@ image_lower_channel_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_lower_channel (image, channel);
success = gimp_image_lower_channel (image, channel, error);
}
return gimp_procedure_get_return_values (procedure, success,
@ -1290,7 +1290,7 @@ image_raise_vectors_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_raise_vectors (image, vectors);
success = gimp_image_raise_vectors (image, vectors, error);
}
return gimp_procedure_get_return_values (procedure, success,
@ -1314,7 +1314,7 @@ image_lower_vectors_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_lower_vectors (image, vectors);
success = gimp_image_lower_vectors (image, vectors, error);
}
return gimp_procedure_get_return_values (procedure, success,
@ -3339,7 +3339,7 @@ register_image_procs (GimpPDB *pdb)
gimp_procedure_set_static_strings (procedure,
"gimp-image-raise-layer",
"Raise the specified layer in the image's layer stack",
"This procedure raises the specified layer one step in the existing layer stack. It will not move the layer if there is no layer above it.",
"This procedure raises the specified layer one step in the existing layer stack. The procecure call will fail if there is no layer above it.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -3368,7 +3368,7 @@ register_image_procs (GimpPDB *pdb)
gimp_procedure_set_static_strings (procedure,
"gimp-image-lower-layer",
"Lower the specified layer in the image's layer stack",
"This procedure lowers the specified layer one step in the existing layer stack. It will not move the layer if there is no layer below it.",
"This procedure lowers the specified layer one step in the existing layer stack. The procecure call will fail if there is no layer below it.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -3554,7 +3554,7 @@ register_image_procs (GimpPDB *pdb)
gimp_procedure_set_static_strings (procedure,
"gimp-image-raise-channel",
"Raise the specified channel in the image's channel stack",
"This procedure raises the specified channel one step in the existing channel stack. It will not move the channel if there is no channel above it.",
"This procedure raises the specified channel one step in the existing channel stack. The procecure call will fail if there is no channel above it.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -3583,7 +3583,7 @@ register_image_procs (GimpPDB *pdb)
gimp_procedure_set_static_strings (procedure,
"gimp-image-lower-channel",
"Lower the specified channel in the image's channel stack",
"This procedure lowers the specified channel one step in the existing channel stack. It will not move the channel if there is no channel below it.",
"This procedure lowers the specified channel one step in the existing channel stack. The procecure call will fail if there is no channel below it.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -3711,7 +3711,7 @@ register_image_procs (GimpPDB *pdb)
gimp_procedure_set_static_strings (procedure,
"gimp-image-raise-vectors",
"Raise the specified vectors in the image's vectors stack",
"This procedure raises the specified vectors one step in the existing vectors stack. It will not move the vectors if there is no vectors above it.",
"This procedure raises the specified vectors one step in the existing vectors stack. The procecure call will fail if there is no vectors above it.",
"Simon Budig",
"Simon Budig",
"2005",
@ -3740,7 +3740,7 @@ register_image_procs (GimpPDB *pdb)
gimp_procedure_set_static_strings (procedure,
"gimp-image-lower-vectors",
"Lower the specified vectors in the image's vectors stack",
"This procedure lowers the specified vectors one step in the existing vectors stack. It will not move the vectors if there is no vectors below it.",
"This procedure lowers the specified vectors one step in the existing vectors stack. The procecure call will fail if there is no vectors below it.",
"Simon Budig",
"Simon Budig",
"2005",

View File

@ -1038,7 +1038,7 @@ gimp_image_get_layer_position (gint32 image_ID,
* Raise the specified layer in the image's layer stack
*
* This procedure raises the specified layer one step in the existing
* layer stack. It will not move the layer if there is no layer above
* layer stack. The procecure call will fail if there is no layer above
* it.
*
* Returns: TRUE on success.
@ -1072,7 +1072,7 @@ gimp_image_raise_layer (gint32 image_ID,
* Lower the specified layer in the image's layer stack
*
* This procedure lowers the specified layer one step in the existing
* layer stack. It will not move the layer if there is no layer below
* layer stack. The procecure call will fail if there is no layer below
* it.
*
* Returns: TRUE on success.
@ -1282,7 +1282,7 @@ gimp_image_get_channel_position (gint32 image_ID,
* Raise the specified channel in the image's channel stack
*
* This procedure raises the specified channel one step in the existing
* channel stack. It will not move the channel if there is no channel
* channel stack. The procecure call will fail if there is no channel
* above it.
*
* Returns: TRUE on success.
@ -1316,7 +1316,7 @@ gimp_image_raise_channel (gint32 image_ID,
* Lower the specified channel in the image's channel stack
*
* This procedure lowers the specified channel one step in the existing
* channel stack. It will not move the channel if there is no channel
* channel stack. The procecure call will fail if there is no channel
* below it.
*
* Returns: TRUE on success.
@ -1460,7 +1460,7 @@ gimp_image_get_vectors_position (gint32 image_ID,
* Raise the specified vectors in the image's vectors stack
*
* This procedure raises the specified vectors one step in the existing
* vectors stack. It will not move the vectors if there is no vectors
* vectors stack. The procecure call will fail if there is no vectors
* above it.
*
* Returns: TRUE on success.
@ -1496,7 +1496,7 @@ gimp_image_raise_vectors (gint32 image_ID,
* Lower the specified vectors in the image's vectors stack
*
* This procedure lowers the specified vectors one step in the existing
* vectors stack. It will not move the vectors if there is no vectors
* vectors stack. The procecure call will fail if there is no vectors
* below it.
*
* Returns: TRUE on success.

View File

@ -709,7 +709,7 @@ sub image_raise_layer {
$help = <<'HELP';
This procedure raises the specified layer one step in the existing layer stack.
It will not move the layer if there is no layer above it.
The procecure call will fail if there is no layer above it.
HELP
&std_pdb_misc;
@ -724,7 +724,7 @@ HELP
%invoke = (
code => <<'CODE'
{
success = gimp_image_raise_layer (image, layer);
success = gimp_image_raise_layer (image, layer, error);
}
CODE
);
@ -735,7 +735,7 @@ sub image_lower_layer {
$help = <<'HELP';
This procedure lowers the specified layer one step in the existing layer stack.
It will not move the layer if there is no layer below it.
The procecure call will fail if there is no layer below it.
HELP
&std_pdb_misc;
@ -750,7 +750,7 @@ HELP
%invoke = (
code => <<'CODE'
{
success = gimp_image_lower_layer (image, layer);
success = gimp_image_lower_layer (image, layer, error);
}
CODE
);
@ -1089,7 +1089,7 @@ sub image_raise_channel {
$help = <<'HELP';
This procedure raises the specified channel one step in the existing
channel stack. It will not move the channel if there is no channel
channel stack. The procecure call will fail if there is no channel
above it.
HELP
@ -1105,7 +1105,7 @@ HELP
%invoke = (
code => <<'CODE'
{
success = gimp_image_raise_channel (image, channel);
success = gimp_image_raise_channel (image, channel, error);
}
CODE
);
@ -1116,7 +1116,7 @@ sub image_lower_channel {
$help = <<'HELP';
This procedure lowers the specified channel one step in the existing
channel stack. It will not move the channel if there is no channel
channel stack. The procecure call will fail if there is no channel
below it.
HELP
@ -1132,7 +1132,7 @@ HELP
%invoke = (
code => <<'CODE'
{
success = gimp_image_lower_channel (image, channel);
success = gimp_image_lower_channel (image, channel, error);
}
CODE
);
@ -1307,7 +1307,7 @@ sub image_raise_vectors {
$help = <<'HELP';
This procedure raises the specified vectors one step in the existing
vectors stack. It will not move the vectors if there is no vectors
vectors stack. The procecure call will fail if there is no vectors
above it.
HELP
@ -1323,7 +1323,7 @@ HELP
%invoke = (
code => <<'CODE'
{
success = gimp_image_raise_vectors (image, vectors);
success = gimp_image_raise_vectors (image, vectors, error);
}
CODE
);
@ -1334,7 +1334,7 @@ sub image_lower_vectors {
$help = <<'HELP';
This procedure lowers the specified vectors one step in the existing
vectors stack. It will not move the vectors if there is no vectors
vectors stack. The procecure call will fail if there is no vectors
below it.
HELP
@ -1350,7 +1350,7 @@ HELP
%invoke = (
code => <<'CODE'
{
success = gimp_image_lower_vectors (image, vectors);
success = gimp_image_lower_vectors (image, vectors, error);
}
CODE
);