mirror of https://github.com/GNOME/gimp.git
add GError parameter and replace g_message() by g_set_error().
2008-09-15 Michael Natterer <mitch@gimp.org> * app/core/gimplayer.[ch] (gimp_layer_add_mask): add GError parameter and replace g_message() by g_set_error(). * app/core/gimplayermaskundo.c * app/xcf/xcf-load.c * app/actions/layers-commands.c: pass NULL errors since these places know what they are doing. Ha ha... * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/image.pdb: pass the error so we get more real error messages for failed PDB calls. * app/pdb/image-cmds.c * app/pdb/layer-cmds.c: regenerated. svn path=/trunk/; revision=26948
This commit is contained in:
parent
c7a92cddc2
commit
d2307c1bf6
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2008-09-15 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimplayer.[ch] (gimp_layer_add_mask): add GError
|
||||
parameter and replace g_message() by g_set_error().
|
||||
|
||||
* app/core/gimplayermaskundo.c
|
||||
* app/xcf/xcf-load.c
|
||||
* app/actions/layers-commands.c: pass NULL errors since these
|
||||
places know what they are doing. Ha ha...
|
||||
|
||||
* tools/pdbgen/pdb/layer.pdb
|
||||
* tools/pdbgen/pdb/image.pdb: pass the error so we get more real
|
||||
error messages for failed PDB calls.
|
||||
|
||||
* app/pdb/image-cmds.c
|
||||
* app/pdb/layer-cmds.c: regenerated.
|
||||
|
||||
2008-09-15 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Bug 552413 – Script triggers Gimp-Core-CRITICAL
|
||||
|
|
|
@ -1049,7 +1049,7 @@ layers_add_mask_response (GtkWidget *widget,
|
|||
if (layer_mask_invert)
|
||||
gimp_channel_invert (GIMP_CHANNEL (mask), FALSE);
|
||||
|
||||
gimp_layer_add_mask (layer, mask, TRUE);
|
||||
gimp_layer_add_mask (layer, mask, TRUE, NULL);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
|
||||
|
|
|
@ -538,7 +538,7 @@ gimp_layer_duplicate (GimpItem *item,
|
|||
|
||||
mask = gimp_item_duplicate (GIMP_ITEM (layer->mask),
|
||||
G_TYPE_FROM_INSTANCE (layer->mask));
|
||||
gimp_layer_add_mask (new_layer, GIMP_LAYER_MASK (mask), FALSE);
|
||||
gimp_layer_add_mask (new_layer, GIMP_LAYER_MASK (mask), FALSE, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1241,31 +1241,27 @@ gimp_layer_new_from_region (PixelRegion *region,
|
|||
}
|
||||
|
||||
GimpLayerMask *
|
||||
gimp_layer_add_mask (GimpLayer *layer,
|
||||
GimpLayerMask *mask,
|
||||
gboolean push_undo)
|
||||
gimp_layer_add_mask (GimpLayer *layer,
|
||||
GimpLayerMask *mask,
|
||||
gboolean push_undo,
|
||||
GError **error)
|
||||
{
|
||||
GimpImage *image;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_LAYER_MASK (mask), NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
if (! gimp_item_is_attached (GIMP_ITEM (layer)))
|
||||
push_undo = FALSE;
|
||||
|
||||
image = gimp_item_get_image (GIMP_ITEM (layer));
|
||||
|
||||
if (! image)
|
||||
{
|
||||
g_message (_("Cannot add layer mask to layer "
|
||||
"which is not part of an image."));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (layer->mask)
|
||||
{
|
||||
g_message (_("Unable to add a layer mask since "
|
||||
"the layer already has one."));
|
||||
g_set_error (error, 0, 0,
|
||||
_("Unable to add a layer mask since "
|
||||
"the layer already has one."));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1274,8 +1270,9 @@ gimp_layer_add_mask (GimpLayer *layer,
|
|||
(gimp_item_height (GIMP_ITEM (layer)) !=
|
||||
gimp_item_height (GIMP_ITEM (mask))))
|
||||
{
|
||||
g_message (_("Cannot add layer mask of different "
|
||||
"dimensions than specified layer."));
|
||||
g_set_error (error, 0, 0,
|
||||
_("Cannot add layer mask of different "
|
||||
"dimensions than specified layer."));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,8 @@ GimpLayerMask * gimp_layer_create_mask (const GimpLayer *layer,
|
|||
GimpChannel *channel);
|
||||
GimpLayerMask * gimp_layer_add_mask (GimpLayer *layer,
|
||||
GimpLayerMask *mask,
|
||||
gboolean push_undo);
|
||||
gboolean push_undo,
|
||||
GError **error);
|
||||
void gimp_layer_apply_mask (GimpLayer *layer,
|
||||
GimpMaskApplyMode mode,
|
||||
gboolean push_undo);
|
||||
|
|
|
@ -188,7 +188,7 @@ gimp_layer_mask_undo_pop (GimpUndo *undo,
|
|||
{
|
||||
/* restore layer mask */
|
||||
|
||||
gimp_layer_add_mask (layer, layer_mask_undo->layer_mask, FALSE);
|
||||
gimp_layer_add_mask (layer, layer_mask_undo->layer_mask, FALSE, NULL);
|
||||
|
||||
GIMP_ITEM (layer_mask_undo->layer_mask)->removed = FALSE;
|
||||
}
|
||||
|
|
|
@ -1490,9 +1490,8 @@ image_add_layer_mask_invoker (GimpProcedure *procedure,
|
|||
|
||||
if (success)
|
||||
{
|
||||
if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error) &&
|
||||
! gimp_layer_get_mask (layer))
|
||||
success = (gimp_layer_add_mask (layer, mask, TRUE) == mask);
|
||||
if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error))
|
||||
success = (gimp_layer_add_mask (layer, mask, TRUE, error) == mask);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
|
|
@ -550,9 +550,8 @@ layer_add_mask_invoker (GimpProcedure *procedure,
|
|||
|
||||
if (success)
|
||||
{
|
||||
if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error) &&
|
||||
! gimp_layer_get_mask (layer))
|
||||
success = (gimp_layer_add_mask (layer, mask, TRUE) == mask);
|
||||
if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error))
|
||||
success = (gimp_layer_add_mask (layer, mask, TRUE, error) == mask);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
|
|
@ -1019,7 +1019,7 @@ xcf_load_layer (XcfInfo *info,
|
|||
gimp_layer_mask_set_edit (layer_mask, edit_mask);
|
||||
gimp_layer_mask_set_show (layer_mask, show_mask, FALSE);
|
||||
|
||||
gimp_layer_add_mask (layer, layer_mask, FALSE);
|
||||
gimp_layer_add_mask (layer, layer_mask, FALSE, NULL);
|
||||
}
|
||||
|
||||
/* attach the floating selection... */
|
||||
|
|
|
@ -1015,9 +1015,8 @@ sub image_add_layer_mask {
|
|||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error) &&
|
||||
! gimp_layer_get_mask (layer))
|
||||
success = (gimp_layer_add_mask (layer, mask, TRUE) == mask);
|
||||
if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error))
|
||||
success = (gimp_layer_add_mask (layer, mask, TRUE, error) == mask);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
|
|
@ -276,9 +276,8 @@ HELP
|
|||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error) &&
|
||||
! gimp_layer_get_mask (layer))
|
||||
success = (gimp_layer_add_mask (layer, mask, TRUE) == mask);
|
||||
if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error))
|
||||
success = (gimp_layer_add_mask (layer, mask, TRUE, error) == mask);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue