From b0dab70de876de39f8a147c4f6a0735e186ad30f Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 17 Sep 2008 08:27:35 +0000 Subject: [PATCH] add GError parameter to gimp_image_add_{channel,layer,vectors}() and 2008-09-17 Michael Natterer * app/core/gimpimage.[ch]: add GError parameter to gimp_image_add_{channel,layer,vectors}() and remove calls to g_warning(). Changed checks to be possible failures at all. * app/widgets/gimpitemtreeview.h (GimpAddItemFunc): add the GError here too. * app/actions/channels-commands.c * app/actions/edit-commands.c * app/actions/layers-commands.c * app/actions/vectors-commands.c * app/core/gimp-edit.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-merge.c * app/core/gimpimage-quick-mask.c * app/core/gimplayer-floating-sel.c * app/core/gimpselection.c * app/core/gimptemplate.c * app/display/gimpdisplayshell-dnd.c * app/text/gimptext-compat.c * app/tools/gimptexttool.c * app/tools/gimpvectortool.c * app/vectors/gimpvectors-import.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c: pass a NULL error. * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/paths.pdb: pass the error. * app/pdb/image-cmds.c * app/pdb/paths-cmds.c: regenerated. svn path=/trunk/; revision=26963 --- ChangeLog | 38 ++++++++++++++++ app/actions/channels-commands.c | 6 +-- app/actions/edit-commands.c | 2 +- app/actions/layers-commands.c | 12 ++--- app/actions/vectors-commands.c | 6 +-- app/core/gimp-edit.c | 4 +- app/core/gimpimage-duplicate.c | 6 +-- app/core/gimpimage-merge.c | 6 +-- app/core/gimpimage-quick-mask.c | 2 +- app/core/gimpimage.c | 70 +++++++++++++----------------- app/core/gimpimage.h | 9 ++-- app/core/gimplayer-floating-sel.c | 2 +- app/core/gimpselection.c | 2 +- app/core/gimptemplate.c | 2 +- app/display/gimpdisplayshell-dnd.c | 8 ++-- app/pdb/image-cmds.c | 9 ++-- app/pdb/paths-cmds.c | 2 +- app/text/gimptext-compat.c | 12 +++-- app/tools/gimptexttool.c | 6 +-- app/tools/gimpvectortool.c | 2 +- app/vectors/gimpvectors-import.c | 2 +- app/widgets/gimpchanneltreeview.c | 7 +-- app/widgets/gimpitemtreeview.c | 2 +- app/widgets/gimpitemtreeview.h | 3 +- app/widgets/gimplayertreeview.c | 6 +-- app/widgets/gimptoolbox-dnd.c | 6 +-- app/widgets/gimpvectorstreeview.c | 2 +- app/xcf/xcf-load.c | 12 +++-- tools/pdbgen/pdb/image.pdb | 9 ++-- tools/pdbgen/pdb/paths.pdb | 2 +- 30 files changed, 153 insertions(+), 104 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0b4ea51018..cef0a157b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +2008-09-17 Michael Natterer + + * app/core/gimpimage.[ch]: add GError parameter to + gimp_image_add_{channel,layer,vectors}() and remove calls to + g_warning(). Changed checks to be possible failures at all. + + * app/widgets/gimpitemtreeview.h (GimpAddItemFunc): add the GError + here too. + + * app/actions/channels-commands.c + * app/actions/edit-commands.c + * app/actions/layers-commands.c + * app/actions/vectors-commands.c + * app/core/gimp-edit.c + * app/core/gimpimage-duplicate.c + * app/core/gimpimage-merge.c + * app/core/gimpimage-quick-mask.c + * app/core/gimplayer-floating-sel.c + * app/core/gimpselection.c + * app/core/gimptemplate.c + * app/display/gimpdisplayshell-dnd.c + * app/text/gimptext-compat.c + * app/tools/gimptexttool.c + * app/tools/gimpvectortool.c + * app/vectors/gimpvectors-import.c + * app/widgets/gimpchanneltreeview.c + * app/widgets/gimpitemtreeview.c + * app/widgets/gimplayertreeview.c + * app/widgets/gimptoolbox-dnd.c + * app/widgets/gimpvectorstreeview.c + * app/xcf/xcf-load.c: pass a NULL error. + + * tools/pdbgen/pdb/image.pdb + * tools/pdbgen/pdb/paths.pdb: pass the error. + + * app/pdb/image-cmds.c + * app/pdb/paths-cmds.c: regenerated. + 2008-09-16 Sven Neumann * configure.in: bumped version to 2.5.5. diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c index 2a18575661..cce8eb9c61 100644 --- a/app/actions/channels-commands.c +++ b/app/actions/channels-commands.c @@ -166,7 +166,7 @@ channels_new_last_vals_cmd_callback (GtkAction *action, action_data_get_context (data), GIMP_TRANSPARENT_FILL); - gimp_image_add_channel (image, new_channel, -1); + gimp_image_add_channel (image, new_channel, -1, NULL); gimp_image_undo_group_end (image); @@ -262,7 +262,7 @@ channels_duplicate_cmd_callback (GtkAction *action, G_TYPE_FROM_INSTANCE (channel))); } - gimp_image_add_channel (image, new_channel, -1); + gimp_image_add_channel (image, new_channel, -1, NULL); gimp_image_flush (image); } @@ -356,7 +356,7 @@ channels_new_channel_response (GtkWidget *widget, GIMP_TRANSPARENT_FILL); } - gimp_image_add_channel (options->image, new_channel, -1); + gimp_image_add_channel (options->image, new_channel, -1, NULL); gimp_image_flush (options->image); } diff --git a/app/actions/edit-commands.c b/app/actions/edit-commands.c index 16015d62d5..f2a2c864d0 100644 --- a/app/actions/edit-commands.c +++ b/app/actions/edit-commands.c @@ -339,7 +339,7 @@ edit_paste_as_new_layer_cmd_callback (GtkAction *action, GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE); g_object_unref (buffer); - gimp_image_add_layer (image, layer, -1); + gimp_image_add_layer (image, layer, -1, NULL); gimp_image_flush (image); } diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c index b37bad1c66..4e844b46cd 100644 --- a/app/actions/layers-commands.c +++ b/app/actions/layers-commands.c @@ -328,7 +328,7 @@ layers_new_last_vals_cmd_callback (GtkAction *action, layer_fill_type); gimp_item_translate (GIMP_ITEM (new_layer), off_x, off_y, FALSE); - gimp_image_add_layer (image, new_layer, -1); + gimp_image_add_layer (image, new_layer, -1, NULL); gimp_image_undo_group_end (image); @@ -351,7 +351,7 @@ layers_new_from_visible_cmd_callback (GtkAction *action, gimp_image_base_type_with_alpha (image), _("Visible"), GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE); - gimp_image_add_layer (image, layer, -1); + gimp_image_add_layer (image, layer, -1, NULL); gimp_image_flush (image); } @@ -438,7 +438,7 @@ layers_duplicate_cmd_callback (GtkAction *action, new_layer = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer), G_TYPE_FROM_INSTANCE (layer))); - gimp_image_add_layer (image, new_layer, -1); + gimp_image_add_layer (image, new_layer, -1, NULL); gimp_image_flush (image); } @@ -517,7 +517,7 @@ layers_text_to_vectors_cmd_callback (GtkAction *action, gimp_item_offsets (GIMP_ITEM (layer), &x, &y); gimp_item_translate (GIMP_ITEM (vectors), x, y, FALSE); - gimp_image_add_vectors (image, vectors, -1); + gimp_image_add_vectors (image, vectors, -1, NULL); gimp_image_set_active_vectors (image, vectors); gimp_image_flush (image); @@ -545,7 +545,7 @@ layers_text_along_vectors_cmd_callback (GtkAction *action, gimp_item_set_visible (GIMP_ITEM (new_vectors), TRUE, FALSE); - gimp_image_add_vectors (image, new_vectors, -1); + gimp_image_add_vectors (image, new_vectors, -1, NULL); gimp_image_set_active_vectors (image, new_vectors); gimp_image_flush (image); @@ -961,7 +961,7 @@ layers_new_layer_response (GtkWidget *widget, gimp_drawable_fill_by_type (GIMP_DRAWABLE (layer), dialog->context, layer_fill_type); - gimp_image_add_layer (dialog->image, layer, -1); + gimp_image_add_layer (dialog->image, layer, -1, NULL); gimp_image_flush (dialog->image); } diff --git a/app/actions/vectors-commands.c b/app/actions/vectors-commands.c index 6b89759ad8..ad2a189a81 100644 --- a/app/actions/vectors-commands.c +++ b/app/actions/vectors-commands.c @@ -187,7 +187,7 @@ vectors_new_last_vals_cmd_callback (GtkAction *action, new_vectors = gimp_vectors_new (image, vectors_name ? vectors_name : _("New Path")); - gimp_image_add_vectors (image, new_vectors, -1); + gimp_image_add_vectors (image, new_vectors, -1, NULL); gimp_image_flush (image); } @@ -251,7 +251,7 @@ vectors_duplicate_cmd_callback (GtkAction *action, new_vectors = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors), G_TYPE_FROM_INSTANCE (vectors))); - gimp_image_add_vectors (image, new_vectors, -1); + gimp_image_add_vectors (image, new_vectors, -1, NULL); gimp_image_flush (image); } @@ -603,7 +603,7 @@ vectors_new_vectors_response (GtkWidget *widget, new_vectors = gimp_vectors_new (options->image, vectors_name); - gimp_image_add_vectors (options->image, new_vectors, -1); + gimp_image_add_vectors (options->image, new_vectors, -1, NULL); gimp_image_flush (options->image); } diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c index 08ff5ac24e..c76bd317c7 100644 --- a/app/core/gimp-edit.c +++ b/app/core/gimp-edit.c @@ -272,7 +272,7 @@ gimp_edit_paste (GimpImage *image, if (drawable) floating_sel_attach (layer, drawable); else - gimp_image_add_layer (image, layer, 0); + gimp_image_add_layer (image, layer, 0, NULL); /* end the group undo */ gimp_image_undo_group_end (image); @@ -332,7 +332,7 @@ gimp_edit_paste_as_new (Gimp *gimp, return NULL; } - gimp_image_add_layer (image, layer, 0); + gimp_image_add_layer (image, layer, 0, NULL); gimp_image_undo_enable (image); diff --git a/app/core/gimpimage-duplicate.c b/app/core/gimpimage-duplicate.c index 68604c3383..5b9579395a 100644 --- a/app/core/gimpimage-duplicate.c +++ b/app/core/gimpimage-duplicate.c @@ -137,7 +137,7 @@ gimp_image_duplicate (GimpImage *image) new_floating_sel_drawable = GIMP_DRAWABLE (new_layer); if (floating_layer != new_layer) - gimp_image_add_layer (new_image, new_layer, count++); + gimp_image_add_layer (new_image, new_layer, count++, NULL); } /* Copy the channels */ @@ -162,7 +162,7 @@ gimp_image_duplicate (GimpImage *image) if (floating_sel_drawable == GIMP_DRAWABLE (channel)) new_floating_sel_drawable = GIMP_DRAWABLE (new_channel); - gimp_image_add_channel (new_image, new_channel, count++); + gimp_image_add_channel (new_image, new_channel, count++, NULL); } /* Copy any vectors */ @@ -184,7 +184,7 @@ gimp_image_duplicate (GimpImage *image) if (gimp_image_get_active_vectors (image) == vectors) active_vectors = new_vectors; - gimp_image_add_vectors (new_image, new_vectors, count++); + gimp_image_add_vectors (new_image, new_vectors, count++, NULL); } /* Copy the selection mask */ diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c index 94c1f5ca56..9496b364e4 100644 --- a/app/core/gimpimage-merge.c +++ b/app/core/gimpimage-merge.c @@ -276,7 +276,7 @@ gimp_image_merge_visible_vectors (GimpImage *image, g_slist_free (merge_list); - gimp_image_add_vectors (image, target_vectors, pos); + gimp_image_add_vectors (image, target_vectors, pos, NULL); gimp_unset_busy (image->gimp); gimp_image_undo_group_end (image); @@ -593,13 +593,13 @@ gimp_image_merge_layers (GimpImage *image, gimp_image_remove_layer (image, layer); } - gimp_image_add_layer (image, merge_layer, position); + gimp_image_add_layer (image, merge_layer, position, NULL); } else { /* Add the layer to the image */ gimp_image_add_layer (image, merge_layer, - gimp_container_num_children (image->layers) - position + 1); + gimp_container_num_children (image->layers) - position + 1, NULL); } /* set the name after the original layers have been removed so we diff --git a/app/core/gimpimage-quick-mask.c b/app/core/gimpimage-quick-mask.c index 0362175370..0e07ec03af 100644 --- a/app/core/gimpimage-quick-mask.c +++ b/app/core/gimpimage-quick-mask.c @@ -117,7 +117,7 @@ gimp_image_set_quick_mask_state (GimpImage *image, if (image->quick_mask_inverted) gimp_channel_invert (mask, FALSE); - gimp_image_add_channel (image, mask, 0); + gimp_image_add_channel (image, mask, 0, NULL); gimp_image_undo_group_end (image); } diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index 7ac6f5aa5d..254e49ce4d 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -2852,9 +2852,10 @@ gimp_image_get_vectors_by_name (const GimpImage *image, } gboolean -gimp_image_add_layer (GimpImage *image, - GimpLayer *layer, - gint position) +gimp_image_add_layer (GimpImage *image, + GimpLayer *layer, + gint position, + GError **error) { GimpLayer *active_layer; GimpLayer *floating_sel; @@ -2862,17 +2863,13 @@ gimp_image_add_layer (GimpImage *image, 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 (g_object_is_floating (layer), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - if (GIMP_ITEM (layer)->image != NULL && - GIMP_ITEM (layer)->image != image) + if (gimp_item_get_image (GIMP_ITEM (layer)) != image) { - g_warning ("%s: attempting to add layer to wrong image.", G_STRFUNC); - return FALSE; - } - - if (gimp_container_have (image->layers, GIMP_OBJECT (layer))) - { - g_warning ("%s: trying to add layer to image twice.", G_STRFUNC); + g_set_error (error, 0, 0, + _("Attempting to add layer to wrong image.")); return FALSE; } @@ -2880,8 +2877,9 @@ gimp_image_add_layer (GimpImage *image, if (floating_sel && gimp_layer_is_floating_sel (layer)) { - g_warning ("%s: trying to add floating layer to image which alyready " - "has a floating selection.", G_STRFUNC); + g_set_error (error, 0, 0, + _("Trying to add floating layer to image which alyready " + "has a floating selection.")); return FALSE; } @@ -3085,7 +3083,7 @@ gimp_image_add_layers (GimpImage *image, gimp_item_translate (new_item, offset_x, offset_y, FALSE); - gimp_image_add_layer (image, GIMP_LAYER (new_item), position); + gimp_image_add_layer (image, GIMP_LAYER (new_item), position, NULL); position++; } @@ -3214,25 +3212,22 @@ gimp_image_position_layer (GimpImage *image, } gboolean -gimp_image_add_channel (GimpImage *image, - GimpChannel *channel, - gint position) +gimp_image_add_channel (GimpImage *image, + GimpChannel *channel, + gint position, + GError **error) { GimpChannel *active_channel; 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 (g_object_is_floating (channel), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - if (GIMP_ITEM (channel)->image != NULL && - GIMP_ITEM (channel)->image != image) + if (gimp_item_get_image (GIMP_ITEM (channel)) != image) { - g_warning ("%s: attempting to add channel to wrong image.", G_STRFUNC); - return FALSE; - } - - if (gimp_container_have (image->channels, GIMP_OBJECT (channel))) - { - g_warning ("%s: trying to add channel to image twice.", G_STRFUNC); + g_set_error (error, 0, 0, + _("Attempting to add channel to wrong image.")); return FALSE; } @@ -3449,25 +3444,22 @@ gimp_image_position_channel (GimpImage *image, } gboolean -gimp_image_add_vectors (GimpImage *image, - GimpVectors *vectors, - gint position) +gimp_image_add_vectors (GimpImage *image, + GimpVectors *vectors, + gint position, + GError **error) { GimpVectors *active_vectors; 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 (g_object_is_floating (vectors), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - if (GIMP_ITEM (vectors)->image != NULL && - GIMP_ITEM (vectors)->image != image) + if (gimp_item_get_image (GIMP_ITEM (vectors)) != image) { - g_warning ("%s: attempting to add vectors to wrong image.", G_STRFUNC); - return FALSE; - } - - if (gimp_container_have (image->vectors, GIMP_OBJECT (vectors))) - { - g_warning ("%s: trying to add vectors to image twice.", G_STRFUNC); + g_set_error (error, 0, 0, + _("Attempting to add vectors to wrong image.")); return FALSE; } diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h index a637be0e59..5d14d618a2 100644 --- a/app/core/gimpimage.h +++ b/app/core/gimpimage.h @@ -458,7 +458,8 @@ GimpVectors * gimp_image_get_vectors_by_name (const GimpImage *image, gboolean gimp_image_add_layer (GimpImage *image, GimpLayer *layer, - gint position); + gint position, + GError **error); void gimp_image_remove_layer (GimpImage *image, GimpLayer *layer); @@ -489,7 +490,8 @@ gboolean gimp_image_position_layer (GimpImage *image, gboolean gimp_image_add_channel (GimpImage *image, GimpChannel *channel, - gint position); + gint position, + GError **error); void gimp_image_remove_channel (GimpImage *image, GimpChannel *channel); @@ -511,7 +513,8 @@ gboolean gimp_image_position_channel (GimpImage *image, gboolean gimp_image_add_vectors (GimpImage *image, GimpVectors *vectors, - gint position); + gint position, + GError **error); void gimp_image_remove_vectors (GimpImage *image, GimpVectors *vectors); diff --git a/app/core/gimplayer-floating-sel.c b/app/core/gimplayer-floating-sel.c index 1e5021f21f..0616934951 100644 --- a/app/core/gimplayer-floating-sel.c +++ b/app/core/gimplayer-floating-sel.c @@ -79,7 +79,7 @@ floating_sel_attach (GimpLayer *layer, gimp_drawable_bytes (drawable)); /* add the layer to the image */ - gimp_image_add_layer (image, layer, 0); + gimp_image_add_layer (image, layer, 0, NULL); /* store the affected area from the drawable in the backing store */ floating_sel_rigor (layer, TRUE); diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c index c88e371853..5e576186e6 100644 --- a/app/core/gimpselection.c +++ b/app/core/gimpselection.c @@ -587,7 +587,7 @@ gimp_selection_save (GimpChannel *selection) /* saved selections are not visible by default */ gimp_item_set_visible (GIMP_ITEM (new_channel), FALSE, FALSE); - gimp_image_add_channel (image, new_channel, -1); + gimp_image_add_channel (image, new_channel, -1, NULL); return new_channel; } diff --git a/app/core/gimptemplate.c b/app/core/gimptemplate.c index b40f7da5d3..45c58f382a 100644 --- a/app/core/gimptemplate.c +++ b/app/core/gimptemplate.c @@ -406,7 +406,7 @@ gimp_template_create_image (Gimp *gimp, gimp_drawable_fill_by_type (GIMP_DRAWABLE (layer), context, template->fill_type); - gimp_image_add_layer (image, layer, 0); + gimp_image_add_layer (image, layer, 0, NULL); gimp_image_undo_enable (image); gimp_image_clean_all (image); diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c index 4ec8ea1250..f27bb35596 100644 --- a/app/display/gimpdisplayshell-dnd.c +++ b/app/display/gimpdisplayshell-dnd.c @@ -254,7 +254,7 @@ gimp_display_shell_drop_drawable (GtkWidget *widget, gimp_item_set_visible (new_item, TRUE, FALSE); gimp_item_set_linked (new_item, FALSE, FALSE); - gimp_image_add_layer (image, new_layer, -1); + gimp_image_add_layer (image, new_layer, -1, NULL); gimp_image_undo_group_end (image); @@ -294,7 +294,7 @@ gimp_display_shell_drop_vectors (GtkWidget *widget, gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE, _("Drop New Path")); - gimp_image_add_vectors (image, new_vectors, -1); + gimp_image_add_vectors (image, new_vectors, -1, NULL); gimp_image_undo_group_end (image); @@ -574,7 +574,7 @@ gimp_display_shell_drop_component (GtkWidget *widget, gimp_item_translate (new_item, off_x, off_y, FALSE); - gimp_image_add_layer (dest_image, new_layer, -1); + gimp_image_add_layer (dest_image, new_layer, -1, NULL); gimp_image_undo_group_end (dest_image); @@ -660,7 +660,7 @@ gimp_display_shell_drop_pixbuf (GtkWidget *widget, gimp_item_translate (new_item, off_x, off_y, FALSE); } - gimp_image_add_layer (image, new_layer, -1); + gimp_image_add_layer (image, new_layer, -1, NULL); gimp_image_undo_group_end (image); diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c index efe02bf209..feaf7ea9d2 100644 --- a/app/pdb/image-cmds.c +++ b/app/pdb/image-cmds.c @@ -868,7 +868,8 @@ image_add_layer_invoker (GimpProcedure *procedure, GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))), error)) { - success = gimp_image_add_layer (image, layer, MAX (position, -1)); + success = gimp_image_add_layer (image, layer, MAX (position, -1), + error); } else { @@ -1058,7 +1059,8 @@ image_add_channel_invoker (GimpProcedure *procedure, { if (gimp_pdb_item_is_floating (GIMP_ITEM (channel), error)) { - success = gimp_image_add_channel (image, channel, MAX (position, -1)); + success = gimp_image_add_channel (image, channel, MAX (position, -1), + error); } else { @@ -1200,7 +1202,8 @@ image_add_vectors_invoker (GimpProcedure *procedure, { if (gimp_pdb_item_is_floating (GIMP_ITEM (vectors), error)) { - success = gimp_image_add_vectors (image, vectors, MAX (position, -1)); + success = gimp_image_add_vectors (image, vectors, MAX (position, -1), + error); } else { diff --git a/app/pdb/paths-cmds.c b/app/pdb/paths-cmds.c index f184a677a1..d509f4be3f 100644 --- a/app/pdb/paths-cmds.c +++ b/app/pdb/paths-cmds.c @@ -303,7 +303,7 @@ path_set_points_invoker (GimpProcedure *procedure, g_free (points); if (vectors) - gimp_image_add_vectors (image, vectors, 0); + success = gimp_image_add_vectors (image, vectors, 0, error); else success = FALSE; } diff --git a/app/text/gimptext-compat.c b/app/text/gimptext-compat.c index ae3068033d..853347dc04 100644 --- a/app/text/gimptext-compat.c +++ b/app/text/gimptext-compat.c @@ -118,12 +118,16 @@ text_render (GimpImage *image, if (! gimp_channel_is_empty (gimp_image_get_mask (image))) gimp_channel_clear (gimp_image_get_mask (image), NULL, TRUE); - /* If the drawable is NULL, create a new layer */ if (drawable == NULL) - gimp_image_add_layer (image, layer, -1); - /* Otherwise, instantiate the text as the new floating selection */ + { + /* If the drawable is NULL, create a new layer */ + gimp_image_add_layer (image, layer, -1, NULL); + } else - floating_sel_attach (layer, drawable); + { + /* Otherwise, instantiate the text as the new floating selection */ + floating_sel_attach (layer, drawable); + } /* end the group undo */ gimp_image_undo_group_end (image); diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c index f8c0bc7229..c90d4f2454 100644 --- a/app/tools/gimptexttool.c +++ b/app/tools/gimptexttool.c @@ -803,7 +803,7 @@ gimp_text_tool_create_vectors (GimpTextTool *text_tool) gimp_item_translate (GIMP_ITEM (vectors), x, y, FALSE); } - gimp_image_add_vectors (text_tool->image, vectors, -1); + gimp_image_add_vectors (text_tool->image, vectors, -1, NULL); gimp_image_flush (text_tool->image); } @@ -829,7 +829,7 @@ gimp_text_tool_create_vectors_warped (GimpTextTool *text_tool) gimp_vectors_warp_vectors (vectors0, vectors, 0.5 * box_height); - gimp_image_add_vectors (text_tool->image, vectors, -1); + gimp_image_add_vectors (text_tool->image, vectors, -1, NULL); gimp_image_set_active_vectors (text_tool->image, vectors); gimp_item_set_visible (GIMP_ITEM (vectors), TRUE, FALSE); @@ -892,7 +892,7 @@ gimp_text_tool_create_layer (GimpTextTool *text_tool, GIMP_ITEM (layer)->offset_x = text_tool->x1; GIMP_ITEM (layer)->offset_y = text_tool->y1; - gimp_image_add_layer (image, layer, -1); + gimp_image_add_layer (image, layer, -1, NULL); if (text_tool->text_box_fixed) { diff --git a/app/tools/gimpvectortool.c b/app/tools/gimpvectortool.c index c58783c04a..40d0d6b0ad 100644 --- a/app/tools/gimpvectortool.c +++ b/app/tools/gimpvectortool.c @@ -303,7 +303,7 @@ gimp_vector_tool_button_press (GimpTool *tool, vector_tool->undo_motion = TRUE; - gimp_image_add_vectors (display->image, vectors, -1); + gimp_image_add_vectors (display->image, vectors, -1, NULL); gimp_image_flush (display->image); gimp_vector_tool_set_vectors (vector_tool, vectors); diff --git a/app/vectors/gimpvectors-import.c b/app/vectors/gimpvectors-import.c index ddb4a4e798..40d063411f 100644 --- a/app/vectors/gimpvectors-import.c +++ b/app/vectors/gimpvectors-import.c @@ -305,7 +305,7 @@ gimp_vectors_import (GimpImage *image, vectors = gimp_vectors_new (image, ((merge || !path->id) ? _("Imported Path") : path->id)); - gimp_image_add_vectors (image, vectors, position); + gimp_image_add_vectors (image, vectors, position, NULL); gimp_vectors_freeze (vectors); if (ret_vectors) diff --git a/app/widgets/gimpchanneltreeview.c b/app/widgets/gimpchanneltreeview.c index 9799ac3521..d49de2c8a3 100644 --- a/app/widgets/gimpchanneltreeview.c +++ b/app/widgets/gimpchanneltreeview.c @@ -211,7 +211,7 @@ gimp_channel_tree_view_drop_viewable (GimpContainerTreeView *tree_view, gimp_item_set_linked (new_item, FALSE, FALSE); - item_view_class->add_item (item_view->image, new_item, index); + item_view_class->add_item (item_view->image, new_item, index, NULL); gimp_image_flush (item_view->image); return; } @@ -261,7 +261,8 @@ gimp_channel_tree_view_drop_component (GimpContainerTreeView *tree_view, if (src_image != item_view->image) GIMP_ITEM_GET_CLASS (new_item)->convert (new_item, item_view->image); - gimp_image_add_channel (item_view->image, GIMP_CHANNEL (new_item), index); + gimp_image_add_channel (item_view->image, GIMP_CHANNEL (new_item), index, + NULL); gimp_image_flush (item_view->image); } @@ -320,7 +321,7 @@ gimp_channel_tree_view_item_new (GimpImage *image) gimp_image_get_height (image), _("Empty Channel"), &color); - gimp_image_add_channel (image, new_channel, -1); + gimp_image_add_channel (image, new_channel, -1, NULL); gimp_image_undo_group_end (image); diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c index 59af0206f9..2cda72ae56 100644 --- a/app/widgets/gimpitemtreeview.c +++ b/app/widgets/gimpitemtreeview.c @@ -734,7 +734,7 @@ gimp_item_tree_view_drop_viewable (GimpContainerTreeView *tree_view, gimp_item_set_linked (new_item, FALSE, FALSE); - item_view_class->add_item (item_view->image, new_item, dest_index); + item_view_class->add_item (item_view->image, new_item, dest_index, NULL); } else if (dest_viewable) { diff --git a/app/widgets/gimpitemtreeview.h b/app/widgets/gimpitemtreeview.h index 6c35ca743c..c1b06736c9 100644 --- a/app/widgets/gimpitemtreeview.h +++ b/app/widgets/gimpitemtreeview.h @@ -37,7 +37,8 @@ typedef void (* GimpReorderItemFunc) (GimpImage *image, const gchar *undo_desc); typedef void (* GimpAddItemFunc) (GimpImage *image, GimpItem *item, - gint index); + gint index, + GError **error); typedef void (* GimpRemoveItemFunc) (GimpImage *image, GimpItem *item); typedef GimpItem * (* GimpNewItemFunc) (GimpImage *image); diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c index d5c586aa48..a731022479 100644 --- a/app/widgets/gimplayertreeview.c +++ b/app/widgets/gimplayertreeview.c @@ -772,7 +772,7 @@ gimp_layer_tree_view_drop_component (GimpContainerTreeView *tree_view, gimp_object_take_name (GIMP_OBJECT (new_item), g_strdup_printf (_("%s Channel Copy"), desc)); - gimp_image_add_layer (item_view->image, GIMP_LAYER (new_item), index); + gimp_image_add_layer (item_view->image, GIMP_LAYER (new_item), index, NULL); gimp_image_flush (item_view->image); } @@ -801,7 +801,7 @@ gimp_layer_tree_view_drop_pixbuf (GimpContainerTreeView *tree_view, _("Dropped Buffer"), GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE); - gimp_image_add_layer (image, new_layer, index); + gimp_image_add_layer (image, new_layer, index, NULL); gimp_image_flush (image); } @@ -840,7 +840,7 @@ gimp_layer_tree_view_item_new (GimpImage *image) gimp_image_base_type_with_alpha (image), _("Empty Layer"), 1.0, GIMP_NORMAL_MODE); - gimp_image_add_layer (image, new_layer, -1); + gimp_image_add_layer (image, new_layer, -1, NULL); gimp_image_undo_group_end (image); diff --git a/app/widgets/gimptoolbox-dnd.c b/app/widgets/gimptoolbox-dnd.c index 93cb09f76e..7e4429f94c 100644 --- a/app/widgets/gimptoolbox-dnd.c +++ b/app/widgets/gimptoolbox-dnd.c @@ -223,7 +223,7 @@ gimp_toolbox_drop_drawable (GtkWidget *widget, gimp_layer_set_opacity (new_layer, GIMP_OPACITY_OPAQUE, FALSE); gimp_layer_set_lock_alpha (new_layer, FALSE, FALSE); - gimp_image_add_layer (new_image, new_layer, 0); + gimp_image_add_layer (new_image, new_layer, 0, NULL); gimp_image_undo_enable (new_image); @@ -309,7 +309,7 @@ gimp_toolbox_drop_component (GtkWidget *widget, gimp_object_take_name (GIMP_OBJECT (new_layer), g_strdup_printf (_("%s Channel Copy"), desc)); - gimp_image_add_layer (new_image, new_layer, 0); + gimp_image_add_layer (new_image, new_layer, 0, NULL); gimp_image_undo_enable (new_image); @@ -358,7 +358,7 @@ gimp_toolbox_drop_pixbuf (GtkWidget *widget, _("Dropped Buffer"), GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE); - gimp_image_add_layer (new_image, new_layer, 0); + gimp_image_add_layer (new_image, new_layer, 0, NULL); gimp_image_undo_enable (new_image); diff --git a/app/widgets/gimpvectorstreeview.c b/app/widgets/gimpvectorstreeview.c index 0139cd1bf0..df68048010 100644 --- a/app/widgets/gimpvectorstreeview.c +++ b/app/widgets/gimpvectorstreeview.c @@ -252,7 +252,7 @@ gimp_vectors_tree_view_item_new (GimpImage *image) new_vectors = gimp_vectors_new (image, _("Empty Path")); - gimp_image_add_vectors (image, new_vectors, -1); + gimp_image_add_vectors (image, new_vectors, -1, NULL); return GIMP_ITEM (new_vectors); } diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c index 2867116f31..09700f5feb 100644 --- a/app/xcf/xcf-load.c +++ b/app/xcf/xcf-load.c @@ -201,7 +201,8 @@ xcf_load_image (Gimp *gimp, /* add the layer to the image if its not the floating selection */ if (layer != info->floating_sel) gimp_image_add_layer (image, layer, - gimp_container_num_children (image->layers)); + gimp_container_num_children (image->layers), + NULL); /* restore the saved position so we'll be ready to * read the next offset. @@ -242,7 +243,8 @@ xcf_load_image (Gimp *gimp, /* add the channel to the image if its not the selection */ if (channel != gimp_image_get_mask (image)) gimp_image_add_channel (image, channel, - gimp_container_num_children (image->channels)); + gimp_container_num_children (image->channels), + NULL); /* restore the saved position so we'll be ready to * read the next offset. @@ -1625,7 +1627,8 @@ xcf_load_old_path (XcfInfo *info, gimp_item_set_tattoo (GIMP_ITEM (vectors), tattoo); gimp_image_add_vectors (image, vectors, - gimp_container_num_children (image->vectors)); + gimp_container_num_children (image->vectors), + NULL); return TRUE; } @@ -1814,7 +1817,8 @@ xcf_load_vector (XcfInfo *info, } gimp_image_add_vectors (image, vectors, - gimp_container_num_children (image->vectors)); + gimp_container_num_children (image->vectors), + NULL); return TRUE; } diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb index fbf4f84144..2cdeb06ed1 100644 --- a/tools/pdbgen/pdb/image.pdb +++ b/tools/pdbgen/pdb/image.pdb @@ -959,7 +959,8 @@ HELP GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))), error)) { - success = gimp_image_add_layer (image, layer, MAX (position, -1)); + success = gimp_image_add_layer (image, layer, MAX (position, -1), + error); } else { @@ -1163,7 +1164,8 @@ HELP { if (gimp_pdb_item_is_floating (GIMP_ITEM (channel), error)) { - success = gimp_image_add_channel (image, channel, MAX (position, -1)); + success = gimp_image_add_channel (image, channel, MAX (position, -1), + error); } else { @@ -1227,7 +1229,8 @@ HELP { if (gimp_pdb_item_is_floating (GIMP_ITEM (vectors), error)) { - success = gimp_image_add_vectors (image, vectors, MAX (position, -1)); + success = gimp_image_add_vectors (image, vectors, MAX (position, -1), + error); } else { diff --git a/tools/pdbgen/pdb/paths.pdb b/tools/pdbgen/pdb/paths.pdb index f1ff183958..cb93ef276e 100644 --- a/tools/pdbgen/pdb/paths.pdb +++ b/tools/pdbgen/pdb/paths.pdb @@ -242,7 +242,7 @@ sub path_set_points { g_free (points); if (vectors) - gimp_image_add_vectors (image, vectors, 0); + success = gimp_image_add_vectors (image, vectors, 0, error); else success = FALSE; }