[gimp] plug-ins: port from gimp_image_add_foo() to gimp_image_insert_foo()



commit bbd7ec6b5ca705182ffbe7899b8ee72ae965b2e2
Author: Michael Natterer <mitch gimp org>
Date:   Mon Sep 6 11:40:46 2010 +0200

    plug-ins: port from gimp_image_add_foo() to gimp_image_insert_foo()
    
    I'm sure some plug-ins need to add their items *not* at the toplevel,
    but since making plug-ins really tree-aware is a lot more work than
    just fixing insert positions, I went for passing -1 as parent in
    almost all cases. And because of laziness...

 libgimp/gimpexport.c                           |    2 +-
 plug-ins/common/animation-optimize.c           |    4 ++--
 plug-ins/common/compose.c                      |    2 +-
 plug-ins/common/curve-bend.c                   |    6 +++---
 plug-ins/common/decompose.c                    |    2 +-
 plug-ins/common/edge-dog.c                     |    8 +++++---
 plug-ins/common/file-cel.c                     |    2 +-
 plug-ins/common/file-dicom.c                   |    2 +-
 plug-ins/common/file-gbr.c                     |    2 +-
 plug-ins/common/file-gif-load.c                |    2 +-
 plug-ins/common/file-gih.c                     |    2 +-
 plug-ins/common/file-jp2-load.c                |    2 +-
 plug-ins/common/file-pat.c                     |    2 +-
 plug-ins/common/file-pcx.c                     |    2 +-
 plug-ins/common/file-pdf-load.c                |    2 +-
 plug-ins/common/file-pix.c                     |    2 +-
 plug-ins/common/file-png.c                     |    2 +-
 plug-ins/common/file-pnm.c                     |    2 +-
 plug-ins/common/file-ps.c                      |    4 ++--
 plug-ins/common/file-psp.c                     |    2 +-
 plug-ins/common/file-raw.c                     |    2 +-
 plug-ins/common/file-sunras.c                  |    2 +-
 plug-ins/common/file-svg.c                     |    2 +-
 plug-ins/common/file-tga.c                     |    2 +-
 plug-ins/common/file-tiff-load.c               |    6 +++---
 plug-ins/common/file-wmf.c                     |    2 +-
 plug-ins/common/file-xbm.c                     |    2 +-
 plug-ins/common/file-xmc.c                     |    4 ++--
 plug-ins/common/file-xpm.c                     |    2 +-
 plug-ins/common/file-xwd.c                     |    2 +-
 plug-ins/common/film.c                         |    4 ++--
 plug-ins/common/hot.c                          |    2 +-
 plug-ins/common/iwarp.c                        |    4 ++--
 plug-ins/common/screenshot.c                   |    4 ++--
 plug-ins/common/smooth-palette.c               |    2 +-
 plug-ins/common/tile.c                         |    2 +-
 plug-ins/common/warp.c                         |    4 ++--
 plug-ins/file-bmp/bmp-read.c                   |    4 ++--
 plug-ins/file-faxg3/faxg3.c                    |    2 +-
 plug-ins/file-fits/fits.c                      |    2 +-
 plug-ins/file-fli/fli-gimp.c                   |    2 +-
 plug-ins/file-ico/ico-dialog.c                 |    4 ++--
 plug-ins/file-ico/ico-load.c                   |    2 +-
 plug-ins/file-ico/ico-save.c                   |    2 +-
 plug-ins/file-jpeg/jpeg-load.c                 |    4 ++--
 plug-ins/file-psd/psd-image-res-load.c         |    4 ++--
 plug-ins/file-psd/psd-load.c                   |    8 ++++----
 plug-ins/file-sgi/sgi.c                        |    2 +-
 plug-ins/file-xjt/xjt.c                        |    6 +++---
 plug-ins/gfig/gfig-dialog.c                    |    2 +-
 plug-ins/lighting/lighting-apply.c             |    2 +-
 plug-ins/map-object/map-object-apply.c         |    2 +-
 plug-ins/pagecurl/pagecurl.c                   |    4 +++-
 plug-ins/selection-to-path/selection-to-path.c |    2 +-
 plug-ins/twain/twain.c                         |    4 ++--
 plug-ins/win-snap/winsnap.c                    |    2 +-
 56 files changed, 83 insertions(+), 79 deletions(-)
---
diff --git a/libgimp/gimpexport.c b/libgimp/gimpexport.c
index 5db07a4..bea1ee8 100644
--- a/libgimp/gimpexport.c
+++ b/libgimp/gimpexport.c
@@ -96,7 +96,7 @@ export_merge (gint32  image_ID,
                                gimp_image_height (image_ID),
                                gimp_drawable_type (*drawable_ID) | 1,
                                100.0, GIMP_NORMAL_MODE);
-      gimp_image_add_layer (image_ID, transp, 1);
+      gimp_image_insert_layer (image_ID, transp, -1, 1);
       gimp_selection_none (image_ID);
       gimp_edit_clear (transp);
       nvisible++;
diff --git a/plug-ins/common/animation-optimize.c b/plug-ins/common/animation-optimize.c
index d9157d8..bdc7fd5 100644
--- a/plug-ins/common/animation-optimize.c
+++ b/plug-ins/common/animation-optimize.c
@@ -644,7 +644,7 @@ do_optimizations (GimpRunMode run_mode,
                                     100.0,
                                     GIMP_NORMAL_MODE);
 
-      gimp_image_add_layer (new_image_id, new_layer_id, 0);
+      gimp_image_insert_layer (new_image_id, new_layer_id, -1, 0);
 
       drawable = gimp_drawable_get (new_layer_id);
 
@@ -1068,7 +1068,7 @@ do_optimizations (GimpRunMode run_mode,
                                                GIMP_NORMAL_MODE);
               g_free (newlayer_name);
 
-              gimp_image_add_layer (new_image_id, new_layer_id, 0);
+              gimp_image_insert_layer (new_image_id, new_layer_id, -1, 0);
 
               drawable = gimp_drawable_get (new_layer_id);
 
diff --git a/plug-ins/common/compose.c b/plug-ins/common/compose.c
index 1c3c4da..274404d 100644
--- a/plug-ins/common/compose.c
+++ b/plug-ins/common/compose.c
@@ -933,7 +933,7 @@ create_new_image (const gchar    *filename,
 
   *layer_ID = gimp_layer_new (image_ID, _("Background"), width, height,
                               gdtype, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image_ID, *layer_ID, 0);
+  gimp_image_insert_layer (image_ID, *layer_ID, -1, 0);
 
   *drawable = gimp_drawable_get (*layer_ID);
   gimp_pixel_rgn_init (pixel_rgn, *drawable, 0, 0, (*drawable)->width,
diff --git a/plug-ins/common/curve-bend.c b/plug-ins/common/curve-bend.c
index 9e8e704..4943fcf 100644
--- a/plug-ins/common/curve-bend.c
+++ b/plug-ins/common/curve-bend.c
@@ -2692,7 +2692,7 @@ p_create_pv_image (GimpDrawable *src_drawable,
     gimp_layer_add_alpha(*layer_id);
   }
 
-  gimp_image_add_layer(l_new_image_id, *layer_id, 0);
+  gimp_image_insert_layer(l_new_image_id, *layer_id, -1, 0);
 
   dst_drawable = gimp_drawable_get (*layer_id);
   p_init_gdrw(&l_src_gdrw, src_drawable, FALSE, FALSE);
@@ -2769,7 +2769,7 @@ p_add_layer (gint       width,
     }
 
   /* add the copied layer to the temp. working image */
-  gimp_image_add_layer (image_id, l_new_layer_id, stack_position);
+  gimp_image_insert_layer (image_id, l_new_layer_id, -1, stack_position);
 
   /* copy visiblity state */
   gimp_item_set_visible (l_new_layer_id, l_visible);
@@ -3209,7 +3209,7 @@ p_main_bend (BenderDialog *cd,
     * (for the case of undo GIMP must know,
     *  that the layer was part of the image)
     */
-   gimp_image_add_layer (l_image_id, l_tmp_layer_id, 0);
+   gimp_image_insert_layer (l_image_id, l_tmp_layer_id, -1, 0);
    gimp_item_set_visible (l_tmp_layer_id, FALSE);
    gimp_item_set_name (l_tmp_layer_id, "curve_bend_dummylayer");
 
diff --git a/plug-ins/common/decompose.c b/plug-ins/common/decompose.c
index 60b933e..fa4b9a8 100644
--- a/plug-ins/common/decompose.c
+++ b/plug-ins/common/decompose.c
@@ -726,7 +726,7 @@ create_new_layer (gint32              image_ID,
 
   layer_ID = gimp_layer_new (image_ID, layername, width, height,
                              gdtype, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image_ID, layer_ID, position);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, position);
 
   *drawable = gimp_drawable_get (layer_ID);
   gimp_pixel_rgn_init (pixel_rgn, *drawable, 0, 0, (*drawable)->width,
diff --git a/plug-ins/common/edge-dog.c b/plug-ins/common/edge-dog.c
index 750ea64..707f680 100644
--- a/plug-ins/common/edge-dog.c
+++ b/plug-ins/common/edge-dog.c
@@ -468,12 +468,14 @@ dog (gint32        image_ID,
   layer1 = gimp_layer_copy (drawable_id);
   gimp_item_set_visible (layer1, FALSE);
   gimp_item_set_name (layer1, "dog_scratch_layer1");
-  gimp_image_add_layer (image_ID, layer1, 0);
+  gimp_image_insert_layer (image_ID, layer1,
+                           gimp_item_get_parent (drawable_id), 0);
 
   layer2 = gimp_layer_copy (drawable_id);
   gimp_item_set_visible (layer2, FALSE);
   gimp_item_set_name (layer2, "dog_scratch_layer2");
-  gimp_image_add_layer (image_ID, layer2, 0);
+  gimp_image_insert_layer (image_ID, layer2,
+                           gimp_item_get_parent (drawable_id), 0);
 
   drawable1 = gimp_drawable_get (layer1);
   drawable2 = gimp_drawable_get (layer2);
@@ -985,7 +987,7 @@ preview_update_preview (GimpPreview  *preview,
                                100,
                                GIMP_NORMAL_MODE);
   preview_drawable = gimp_drawable_get (preview_id);
-  gimp_image_add_layer (image_id, preview_id, 0);
+  gimp_image_insert_layer (image_id, preview_id, -1, 0);
   gimp_layer_set_offsets (preview_id, 0, 0);
   gimp_pixel_rgn_init (&preview_rgn, preview_drawable,
                        0, 0, width, height, TRUE, TRUE);
diff --git a/plug-ins/common/file-cel.c b/plug-ins/common/file-cel.c
index 02f80a3..040a8c8 100644
--- a/plug-ins/common/file-cel.c
+++ b/plug-ins/common/file-cel.c
@@ -363,7 +363,7 @@ load_image (const gchar  *file,
   else
     layer = gimp_layer_new (image, _("Background"), width, height,
                             GIMP_INDEXEDA_IMAGE, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image, layer, 0);
+  gimp_image_insert_layer (image, layer, -1, 0);
   gimp_layer_set_offsets (layer, offx, offy);
 
   /* Get the drawable and set the pixel region for our load... */
diff --git a/plug-ins/common/file-dicom.c b/plug-ins/common/file-dicom.c
index dff03fa..92d9dd2 100644
--- a/plug-ins/common/file-dicom.c
+++ b/plug-ins/common/file-dicom.c
@@ -611,7 +611,7 @@ load_image (const gchar  *filename,
                              (dicominfo->samples_per_pixel >= 3 ?
                               GIMP_RGB_IMAGE : GIMP_GRAY_IMAGE),
                              100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image_ID, layer_ID, 0);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
 
   drawable = gimp_drawable_get (layer_ID);
   gimp_pixel_rgn_init (&pixel_rgn, drawable,
diff --git a/plug-ins/common/file-gbr.c b/plug-ins/common/file-gbr.c
index fa6af9c..e9ce57e 100644
--- a/plug-ins/common/file-gbr.c
+++ b/plug-ins/common/file-gbr.c
@@ -592,7 +592,7 @@ load_image (const gchar  *filename,
 
   layer_ID = gimp_layer_new (image_ID, name, bh.width, bh.height,
                              image_type, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image_ID, layer_ID, 0);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
 
   g_free (name);
 
diff --git a/plug-ins/common/file-gif-load.c b/plug-ins/common/file-gif-load.c
index 46abe80..f929ce5 100644
--- a/plug-ins/common/file-gif-load.c
+++ b/plug-ins/common/file-gif-load.c
@@ -1033,7 +1033,7 @@ ReadImage (FILE        *fd,
 
   frame_number++;
 
-  gimp_image_add_layer (image_ID, layer_ID, 0);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
   gimp_layer_translate (layer_ID, (gint) leftpos, (gint) toppos);
 
   drawable = gimp_drawable_get (layer_ID);
diff --git a/plug-ins/common/file-gih.c b/plug-ins/common/file-gih.c
index 5fc8f1b..289333b 100644
--- a/plug-ins/common/file-gih.c
+++ b/plug-ins/common/file-gih.c
@@ -597,7 +597,7 @@ gih_load_one_brush (gint   fd,
 
   if (layer_ID != -1)
     {
-      gimp_image_add_layer (image_ID, layer_ID, num_layers++);
+      gimp_image_insert_layer (image_ID, layer_ID, -1, num_layers++);
       gimp_layer_set_offsets (layer_ID,
                               (new_width - bh.width)   / 2,
                               (new_height - bh.height) / 2);
diff --git a/plug-ins/common/file-jp2-load.c b/plug-ins/common/file-jp2-load.c
index 727fb80..62cbe12 100644
--- a/plug-ins/common/file-jp2-load.c
+++ b/plug-ins/common/file-jp2-load.c
@@ -351,7 +351,7 @@ load_image (const gchar  *filename,
                              _("Background"),
                              width, height,
                              image_type, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image_ID, layer_ID, 0);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
   drawable = gimp_drawable_get (layer_ID);
 
   gimp_tile_cache_ntiles (drawable->ntile_cols);
diff --git a/plug-ins/common/file-pat.c b/plug-ins/common/file-pat.c
index 0840440..b6691da 100644
--- a/plug-ins/common/file-pat.c
+++ b/plug-ins/common/file-pat.c
@@ -432,7 +432,7 @@ load_image (const gchar  *filename,
 
   layer_ID = gimp_layer_new (image_ID, name, ph.width, ph.height,
                              image_type, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image_ID, layer_ID, 0);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
 
   g_free (name);
 
diff --git a/plug-ins/common/file-pcx.c b/plug-ins/common/file-pcx.c
index 162e368..51c6479 100644
--- a/plug-ins/common/file-pcx.c
+++ b/plug-ins/common/file-pcx.c
@@ -425,7 +425,7 @@ load_image (const gchar  *filename,
                              GIMP_INDEXED_IMAGE, 100, GIMP_NORMAL_MODE);
     }
   gimp_image_set_filename (image, filename);
-  gimp_image_add_layer (image, layer, 0);
+  gimp_image_insert_layer (image, layer, -1, 0);
   gimp_layer_set_offsets (layer, offset_x, offset_y);
   drawable = gimp_drawable_get (layer);
 
diff --git a/plug-ins/common/file-pdf-load.c b/plug-ins/common/file-pdf-load.c
index 35718f3..84dd7c4 100644
--- a/plug-ins/common/file-pdf-load.c
+++ b/plug-ins/common/file-pdf-load.c
@@ -576,7 +576,7 @@ layer_from_pixbuf (gint32        image,
                                              progress_start,
                                              progress_start + progress_scale);
 
-  gimp_image_add_layer (image, layer, position);
+  gimp_image_insert_layer (image, layer, -1, position);
 
   return layer;
 }
diff --git a/plug-ins/common/file-pix.c b/plug-ins/common/file-pix.c
index 31a0b14..b5454e2 100644
--- a/plug-ins/common/file-pix.c
+++ b/plug-ins/common/file-pix.c
@@ -382,7 +382,7 @@ load_image (const gchar  *filename,
                              width,
                              height,
                              gdtype, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image_ID, layer_ID, 0);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
   drawable = gimp_drawable_get (layer_ID);
   gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width,
                        drawable->height, TRUE, FALSE);
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index 1099d24..be3b4c6 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -850,7 +850,7 @@ load_image (const gchar  *filename,
 
   layer = gimp_layer_new (image, _("Background"), info->width, info->height,
                           layer_type, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image, layer, 0);
+  gimp_image_insert_layer (image, layer, -1, 0);
 
   /*
    * Find out everything we can about the image resolution
diff --git a/plug-ins/common/file-pnm.c b/plug-ins/common/file-pnm.c
index ad433b4..cf1d94a 100644
--- a/plug-ins/common/file-pnm.c
+++ b/plug-ins/common/file-pnm.c
@@ -586,7 +586,7 @@ load_image (const gchar  *filename,
                              (pnminfo->np >= 3 ?
                               GIMP_RGB_IMAGE : GIMP_GRAY_IMAGE),
                              100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image_ID, layer_ID, 0);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
 
   drawable = gimp_drawable_get (layer_ID);
   gimp_pixel_rgn_init (&pixel_rgn, drawable,
diff --git a/plug-ins/common/file-ps.c b/plug-ins/common/file-ps.c
index 975eef6..4209d13 100644
--- a/plug-ins/common/file-ps.c
+++ b/plug-ins/common/file-ps.c
@@ -1137,7 +1137,7 @@ load_image (const gchar  *filename,
 
               current_layer = gimp_layer_new_from_drawable (tmp_ID, image_ID);
               gimp_item_set_name (current_layer, name);
-              gimp_image_add_layer (image_ID, current_layer, -1);
+              gimp_image_insert_layer (image_ID, current_layer, -1, -1);
               gimp_image_delete (image_list[k]);
 
               g_free (name);
@@ -1934,7 +1934,7 @@ create_new_image (const gchar        *filename,
                               gdtype, 100, GIMP_NORMAL_MODE);
   g_free (tmp);
 
-  gimp_image_add_layer (image_ID, *layer_ID, 0);
+  gimp_image_insert_layer (image_ID, *layer_ID, -1, 0);
 
   *drawable = gimp_drawable_get (*layer_ID);
   gimp_pixel_rgn_init (pixel_rgn, *drawable, 0, 0, (*drawable)->width,
diff --git a/plug-ins/common/file-psp.c b/plug-ins/common/file-psp.c
index 5363307..07efd04 100644
--- a/plug-ins/common/file-psp.c
+++ b/plug-ins/common/file-psp.c
@@ -1451,7 +1451,7 @@ read_layer_block (FILE     *f,
 
       g_free (name);
 
-      gimp_image_add_layer (image_ID, layer_ID, -1);
+      gimp_image_insert_layer (image_ID, layer_ID, -1, -1);
 
       if (saved_image_rect[0] != 0 || saved_image_rect[1] != 0)
         gimp_layer_set_offsets (layer_ID,
diff --git a/plug-ins/common/file-raw.c b/plug-ins/common/file-raw.c
index 1c45717..d638bab 100644
--- a/plug-ins/common/file-raw.c
+++ b/plug-ins/common/file-raw.c
@@ -761,7 +761,7 @@ load_image (const gchar  *filename,
   layer_id = gimp_layer_new (data->image_id, _("Background"),
                              runtime->image_width, runtime->image_height, ltype,
                              100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (data->image_id, layer_id, 0);
+  gimp_image_insert_layer (data->image_id, layer_id, -1, 0);
 
   data->drawable = gimp_drawable_get (layer_id);
 
diff --git a/plug-ins/common/file-sunras.c b/plug-ins/common/file-sunras.c
index 0f66ddb..d0784a1 100644
--- a/plug-ins/common/file-sunras.c
+++ b/plug-ins/common/file-sunras.c
@@ -973,7 +973,7 @@ create_new_image (const gchar        *filename,
 
   *layer_ID = gimp_layer_new (image_ID, _("Background"), width, height,
                             gdtype, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image_ID, *layer_ID, 0);
+  gimp_image_insert_layer (image_ID, *layer_ID, -1, 0);
 
   *drawable = gimp_drawable_get (*layer_ID);
   gimp_pixel_rgn_init (pixel_rgn, *drawable, 0, 0, (*drawable)->width,
diff --git a/plug-ins/common/file-svg.c b/plug-ins/common/file-svg.c
index 1403783..ae75baa 100644
--- a/plug-ins/common/file-svg.c
+++ b/plug-ins/common/file-svg.c
@@ -351,7 +351,7 @@ load_image (const gchar  *filename,
 
   layer = gimp_layer_new_from_pixbuf (image, _("Rendered SVG"), pixbuf,
                                       100, GIMP_NORMAL_MODE, 0.0, 1.0);
-  gimp_image_add_layer (image, layer, 0);
+  gimp_image_insert_layer (image, layer, -1, 0);
 
   gimp_image_undo_enable (image);
 
diff --git a/plug-ins/common/file-tga.c b/plug-ins/common/file-tga.c
index 610dbc7..5c8176b 100644
--- a/plug-ins/common/file-tga.c
+++ b/plug-ins/common/file-tga.c
@@ -1065,7 +1065,7 @@ ReadImage (FILE        *fp,
                              dtype, 100,
                              GIMP_NORMAL_MODE);
 
-  gimp_image_add_layer (image_ID, layer_ID, 0);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
 
   drawable = gimp_drawable_get (layer_ID);
 
diff --git a/plug-ins/common/file-tiff-load.c b/plug-ins/common/file-tiff-load.c
index 35af888..1d7cb0b 100644
--- a/plug-ins/common/file-tiff-load.c
+++ b/plug-ins/common/file-tiff-load.c
@@ -1016,7 +1016,7 @@ load_image (const gchar        *filename,
               channel[i].ID = gimp_channel_new (image, _("TIFF Channel"),
                                                 cols, rows,
                                                 100.0, &color);
-              gimp_image_add_channel (image, channel[i].ID, 0);
+              gimp_image_insert_channel (image, channel[i].ID, -1, 0);
               channel[i].drawable = gimp_drawable_get (channel[i].ID);
             }
         }
@@ -1118,7 +1118,7 @@ load_image (const gchar        *filename,
       if (ilayer > 0 && !alpha)
         gimp_layer_add_alpha (layer);
 
-      gimp_image_add_layer (image, layer, -1);
+      gimp_image_insert_layer (image, layer, -1, -1);
 
       if (target == GIMP_PAGE_SELECTOR_TARGET_IMAGES)
         {
@@ -1289,7 +1289,7 @@ load_paths (TIFF *tif, gint image)
           gboolean closed = FALSE;
 
           vectors = gimp_vectors_new (image, name);
-          gimp_image_add_vectors (image, vectors, path_index);
+          gimp_image_insert_vectors (image, vectors, -1, path_index);
           path_index++;
 
           while (rec < pos + len)
diff --git a/plug-ins/common/file-wmf.c b/plug-ins/common/file-wmf.c
index 2cec0fd..6775e5f 100644
--- a/plug-ins/common/file-wmf.c
+++ b/plug-ins/common/file-wmf.c
@@ -1037,7 +1037,7 @@ load_image (const gchar  *filename,
 
   /* Tell GIMP to display the image.
    */
-  gimp_image_add_layer (image, layer, 0);
+  gimp_image_insert_layer (image, layer, -1, 0);
   gimp_drawable_flush (drawable);
 
   return image;
diff --git a/plug-ins/common/file-xbm.c b/plug-ins/common/file-xbm.c
index c528a3a..444ae82 100644
--- a/plug-ins/common/file-xbm.c
+++ b/plug-ins/common/file-xbm.c
@@ -898,7 +898,7 @@ load_image (const gchar  *filename,
                              GIMP_INDEXED_IMAGE,
                              100,
                              GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image_ID, layer_ID, 0);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
 
   drawable = gimp_drawable_get (layer_ID);
 
diff --git a/plug-ins/common/file-xmc.c b/plug-ins/common/file-xmc.c
index 48e97d7..b142d07 100644
--- a/plug-ins/common/file-xmc.c
+++ b/plug-ins/common/file-xmc.c
@@ -739,7 +739,7 @@ load_image (const gchar *filename, GError **error)
                                  imagesp->images[i]->width,
                                  imagesp->images[i]->height,
                                  GIMP_RGBA_IMAGE, 100, GIMP_NORMAL_MODE);
-      gimp_image_add_layer (image_ID, layer_ID, 0);
+      gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
 
       /* Adjust layer position to let hotspot sit on the same point. */
       gimp_layer_translate (layer_ID,
@@ -964,7 +964,7 @@ load_thumbnail (const gchar *filename, gint32 thumb_size,
                              GIMP_RGBA_IMAGE, 100,
                              GIMP_NORMAL_MODE);
 
-  gimp_image_add_layer (image_ID, layer_ID, 0);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
 
   /*
    * Get the drawable and set the pixel region for our load...
diff --git a/plug-ins/common/file-xpm.c b/plug-ins/common/file-xpm.c
index b0e32cd..74cb913 100644
--- a/plug-ins/common/file-xpm.c
+++ b/plug-ins/common/file-xpm.c
@@ -482,7 +482,7 @@ parse_image (gint32    image_ID,
                              100,
                              GIMP_NORMAL_MODE);
 
-  gimp_image_add_layer (image_ID, layer_ID, 0);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
 
   drawable = gimp_drawable_get (layer_ID);
 
diff --git a/plug-ins/common/file-xwd.c b/plug-ins/common/file-xwd.c
index f19879d..dd758eb 100644
--- a/plug-ins/common/file-xwd.c
+++ b/plug-ins/common/file-xwd.c
@@ -1196,7 +1196,7 @@ create_new_image (const gchar         *filename,
 
   *layer_ID = gimp_layer_new (image_ID, "Background", width, height,
                               gdtype, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image_ID, *layer_ID, 0);
+  gimp_image_insert_layer (image_ID, *layer_ID, -1, 0);
 
   *drawable = gimp_drawable_get (*layer_ID);
   gimp_pixel_rgn_init (pixel_rgn, *drawable, 0, 0, (*drawable)->width,
diff --git a/plug-ins/common/film.c b/plug-ins/common/film.c
index ea54780..b3822eb 100644
--- a/plug-ins/common/film.c
+++ b/plug-ins/common/film.c
@@ -486,7 +486,7 @@ film (void)
           gimp_layer_resize_to_image_size (layer_ID_src);
           new_layer = gimp_layer_new_from_drawable (layer_ID_src,
                                                     image_ID_dst);
-          gimp_image_add_layer (image_ID_dst, new_layer, -1);
+          gimp_image_insert_layer (image_ID_dst, new_layer, -1, -1);
           gimp_layer_set_offsets (new_layer, picture_x0, picture_y0);
 
           /* Draw picture numbers */
@@ -744,7 +744,7 @@ create_new_image (const gchar    *filename,
   gimp_image_undo_disable (image_ID);
   *layer_ID = gimp_layer_new (image_ID, _("Background"), width, height,
                               gdtype, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image_ID, *layer_ID, 0);
+  gimp_image_insert_layer (image_ID, *layer_ID, -1, 0);
 
   if (drawable)
     {
diff --git a/plug-ins/common/hot.c b/plug-ins/common/hot.c
index 0f105f2..e000758 100644
--- a/plug-ins/common/hot.c
+++ b/plug-ins/common/hot.c
@@ -351,7 +351,7 @@ pluginCore (piArgs *argp)
                            GIMP_RGBA_IMAGE, (gdouble)100, GIMP_NORMAL_MODE);
       ndrw = gimp_drawable_get (nl);
       gimp_drawable_fill (nl, GIMP_TRANSPARENT_FILL);
-      gimp_image_add_layer (argp->image, nl, 0);
+      gimp_image_insert_layer (argp->image, nl, -1, 0);
     }
 
   gimp_drawable_mask_bounds (drw->drawable_id,
diff --git a/plug-ins/common/iwarp.c b/plug-ins/common/iwarp.c
index 1ed61af..e373ed1 100644
--- a/plug-ins/common/iwarp.c
+++ b/plug-ins/common/iwarp.c
@@ -796,7 +796,7 @@ iwarp (void)
           gimp_item_set_name (animlayers[i], st);
           g_free (st);
 
-          gimp_image_add_layer (imageID, animlayers[i], 0);
+          gimp_image_insert_layer (imageID, animlayers[i], -1, 0);
 
           destdrawable = gimp_drawable_get (animlayers[i]);
 
@@ -828,7 +828,7 @@ iwarp (void)
               gimp_item_set_name (layerID, st);
               g_free (st);
 
-              gimp_image_add_layer (imageID, layerID, 0);
+              gimp_image_insert_layer (imageID, layerID, -1, 0);
             }
         }
       g_free (animlayers);
diff --git a/plug-ins/common/screenshot.c b/plug-ins/common/screenshot.c
index 475d95b..5ddd2ec 100644
--- a/plug-ins/common/screenshot.c
+++ b/plug-ins/common/screenshot.c
@@ -803,7 +803,7 @@ create_image (GdkPixbuf   *pixbuf,
                                       name ? name : _("Screenshot"),
                                       pixbuf,
                                       100, GIMP_NORMAL_MODE, 0.0, 1.0);
-  gimp_image_add_layer (image, layer, 0);
+  gimp_image_insert_layer (image, layer, -1, 0);
 
   if (shape && ! gdk_region_empty (shape))
     {
@@ -887,7 +887,7 @@ add_cursor_image (gint32      image,
 
   gimp_drawable_detach (drawable);
 
-  gimp_image_add_layer (image, layer, -1);
+  gimp_image_insert_layer (image, layer, -1, -1);
   gimp_layer_set_offsets (layer,
                           cursor->x - cursor->xhot, cursor->y - cursor->yhot);
 
diff --git a/plug-ins/common/smooth-palette.c b/plug-ins/common/smooth-palette.c
index 73da590..ed49a64 100644
--- a/plug-ins/common/smooth-palette.c
+++ b/plug-ins/common/smooth-palette.c
@@ -257,7 +257,7 @@ smooth_palette (GimpDrawable *drawable,
                               config.width, config.height,
                               gimp_drawable_type (drawable->drawable_id),
                               100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (new_image_id, *layer_id, 0);
+  gimp_image_insert_layer (new_image_id, *layer_id, -1, 0);
   new_layer = gimp_drawable_get (*layer_id);
 
   psize = config.width;
diff --git a/plug-ins/common/tile.c b/plug-ins/common/tile.c
index 3d05a14..5beb491 100644
--- a/plug-ins/common/tile.c
+++ b/plug-ins/common/tile.c
@@ -271,7 +271,7 @@ tile (gint32  image_id,
       if (*layer_id == -1)
         return -1;
 
-      gimp_image_add_layer (new_image_id, *layer_id, 0);
+      gimp_image_insert_layer (new_image_id, *layer_id, -1, 0);
       new_layer = gimp_drawable_get (*layer_id);
 
       /*  Get the source drawable  */
diff --git a/plug-ins/common/warp.c b/plug-ins/common/warp.c
index db84389..0cec6b5 100644
--- a/plug-ins/common/warp.c
+++ b/plug-ins/common/warp.c
@@ -949,8 +949,8 @@ diff (GimpDrawable *drawable,
   draw_yd = gimp_drawable_get (ylayer_id);
   draw_xd = gimp_drawable_get (xlayer_id);
 
-  gimp_image_add_layer (new_image_id, xlayer_id, 1);
-  gimp_image_add_layer (new_image_id, ylayer_id, 1);
+  gimp_image_insert_layer (new_image_id, xlayer_id, -1, 1);
+  gimp_image_insert_layer (new_image_id, ylayer_id, -1, 1);
   gimp_drawable_fill (xlayer_id, GIMP_BACKGROUND_FILL);
   gimp_drawable_fill (ylayer_id, GIMP_BACKGROUND_FILL);
   gimp_image_set_active_layer (image_id, layer_active);
diff --git a/plug-ins/file-bmp/bmp-read.c b/plug-ins/file-bmp/bmp-read.c
index dae7b66..f72e6b7 100644
--- a/plug-ins/file-bmp/bmp-read.c
+++ b/plug-ins/file-bmp/bmp-read.c
@@ -385,7 +385,7 @@ ReadBMP (const gchar  *name,
           g_object_unref (pixbuf);
 
           gimp_image_set_filename (image_ID, filename);
-          gimp_image_add_layer (image_ID, layer_ID, -1);
+          gimp_image_insert_layer (image_ID, layer_ID, -1, -1);
 
           return image_ID;
         }
@@ -651,7 +651,7 @@ ReadImage (FILE                  *fd,
 
   gimp_image_set_filename (image, filename);
 
-  gimp_image_add_layer (image, layer, 0);
+  gimp_image_insert_layer (image, layer, -1, 0);
   drawable = gimp_drawable_get (layer);
 
   /* use g_malloc0 to initialize the dest buffer so that unspecified
diff --git a/plug-ins/file-faxg3/faxg3.c b/plug-ins/file-faxg3/faxg3.c
index 3ac36bb..35ac011 100644
--- a/plug-ins/file-faxg3/faxg3.c
+++ b/plug-ins/file-faxg3/faxg3.c
@@ -478,7 +478,7 @@ emitgimp (gint         hcol,
 			     hcol,
 			     row,
 			     GIMP_GRAY_IMAGE, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image_ID, layer_ID, 0);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
 
   drawable = gimp_drawable_get (layer_ID);
   gimp_pixel_rgn_init (&pixel_rgn, drawable,
diff --git a/plug-ins/file-fits/fits.c b/plug-ins/file-fits/fits.c
index b2bd553..90260ca 100644
--- a/plug-ins/file-fits/fits.c
+++ b/plug-ins/file-fits/fits.c
@@ -528,7 +528,7 @@ create_new_image (const gchar        *filename,
   gimp_image_undo_disable (image_ID);
   *layer_ID = gimp_layer_new (image_ID, _("Background"), width, height,
 			      dtype, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image_ID, *layer_ID, 0);
+  gimp_image_insert_layer (image_ID, *layer_ID, -1, 0);
 
   *drawable = gimp_drawable_get (*layer_ID);
   gimp_pixel_rgn_init (pixel_rgn, *drawable, 0, 0, (*drawable)->width,
diff --git a/plug-ins/file-fli/fli-gimp.c b/plug-ins/file-fli/fli-gimp.c
index 6307e3a..47ad3e5 100644
--- a/plug-ins/file-fli/fli-gimp.c
+++ b/plug-ins/file-fli/fli-gimp.c
@@ -581,7 +581,7 @@ load_image (const gchar  *filename,
       if (cnt > 0)
 	gimp_layer_add_alpha (layer_ID);
 
-      gimp_image_add_layer (image_id, layer_ID, 0);
+      gimp_image_insert_layer (image_id, layer_ID, -1, 0);
 
       if (cnt < to_frame)
 	{
diff --git a/plug-ins/file-ico/ico-dialog.c b/plug-ins/file-ico/ico-dialog.c
index 8e2962a..6d95862 100644
--- a/plug-ins/file-ico/ico-dialog.c
+++ b/plug-ins/file-ico/ico-dialog.c
@@ -259,7 +259,7 @@ ico_dialog_update_icon_preview (GtkWidget *dialog,
       tmp_layer = gimp_layer_new (tmp_image, "temporary", w, h,
                                   gimp_drawable_type (layer),
                                   100, GIMP_NORMAL_MODE);
-      gimp_image_add_layer (tmp_image, tmp_layer, 0);
+      gimp_image_insert_layer (tmp_image, tmp_layer, -1, 0);
 
       drawable = gimp_drawable_get (layer);
       tmp      = gimp_drawable_get (tmp_layer);
@@ -355,7 +355,7 @@ ico_dialog_update_icon_preview (GtkWidget *dialog,
       tmp_layer = gimp_layer_new (tmp_image, "temporary", w, h,
                                   gimp_drawable_type (layer),
                                   100, GIMP_NORMAL_MODE);
-      gimp_image_add_layer (tmp_image, tmp_layer, 0);
+      gimp_image_insert_layer (tmp_image, tmp_layer, -1, 0);
 
       drawable = gimp_drawable_get (layer);
       tmp      = gimp_drawable_get (tmp_layer);
diff --git a/plug-ins/file-ico/ico-load.c b/plug-ins/file-ico/ico-load.c
index 9c53ec6..807cadf 100644
--- a/plug-ins/file-ico/ico-load.c
+++ b/plug-ins/file-ico/ico-load.c
@@ -615,7 +615,7 @@ ico_load_layer (FILE        *fp,
   g_snprintf (buf, sizeof (buf), _("Icon #%i"), icon_num+1);
   layer = gimp_layer_new (image, buf, width, height,
                           GIMP_RGBA_IMAGE, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image, layer, icon_num);
+  gimp_image_insert_layer (image, layer, -1, icon_num);
   drawable = gimp_drawable_get (layer);
   gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0,
                        drawable->width, drawable->height, TRUE, FALSE);
diff --git a/plug-ins/file-ico/ico-save.c b/plug-ins/file-ico/ico-save.c
index 464c245..fe460b8 100644
--- a/plug-ins/file-ico/ico-save.c
+++ b/plug-ins/file-ico/ico-save.c
@@ -577,7 +577,7 @@ ico_image_get_reduced_buf (guint32   layer,
       tmp_layer = gimp_layer_new (tmp_image, "tmp", w, h,
                                   gimp_drawable_type (layer),
                                   100, GIMP_NORMAL_MODE);
-      gimp_image_add_layer (tmp_image, tmp_layer, 0);
+      gimp_image_insert_layer (tmp_image, tmp_layer, -1, 0);
 
       tmp = gimp_drawable_get (tmp_layer);
 
diff --git a/plug-ins/file-jpeg/jpeg-load.c b/plug-ins/file-jpeg/jpeg-load.c
index 579c8fd..581b6e3 100644
--- a/plug-ins/file-jpeg/jpeg-load.c
+++ b/plug-ins/file-jpeg/jpeg-load.c
@@ -467,7 +467,7 @@ load_image (const gchar  *filename,
       gimp_drawable_detach (drawable);
     }
 
-  gimp_image_add_layer (image_ID, layer_ID, 0);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
 
 #ifdef HAVE_EXIF
   jpeg_exif_rotate_query (image_ID, orientation);
@@ -814,7 +814,7 @@ load_thumbnail_image (const gchar  *filename,
    * corrupt-data warnings occurred (test whether
    * jerr.num_warnings is nonzero).
    */
-  gimp_image_add_layer (image_ID, layer_ID, 0);
+  gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
 
 
   /* NOW to get the dimensions of the actual image to return the
diff --git a/plug-ins/file-psd/psd-image-res-load.c b/plug-ins/file-psd/psd-image-res-load.c
index 0664976..945c876 100644
--- a/plug-ins/file-psd/psd-image-res-load.c
+++ b/plug-ins/file-psd/psd-image-res-load.c
@@ -1045,7 +1045,7 @@ load_resource_1033 (const PSDimageres  *res_a,
    * corrupt-data warnings occurred (test whether
    * jerr.num_warnings is nonzero).
    */
-  gimp_image_add_layer (image_id, layer_id, 0);
+  gimp_image_insert_layer (image_id, layer_id, -1, 0);
   gimp_drawable_detach (drawable);
 
   return 0;
@@ -1408,7 +1408,7 @@ load_resource_2000 (const PSDimageres  *res_a,
 
   /* Create path */
   vector_id = gimp_vectors_new (image_id, res_a->name);
-  gimp_image_add_vectors (image_id, vector_id, -1);
+  gimp_image_insert_vectors (image_id, vector_id, -1, -1);
 
   while (path_rec > 0)
     {
diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c
index bb6129a..7f018de 100644
--- a/plug-ins/file-psd/psd-load.c
+++ b/plug-ins/file-psd/psd-load.c
@@ -1251,7 +1251,7 @@ add_layers (const gint32  image_id,
                                          img_a->columns, img_a->rows,
                                          image_type, 0, GIMP_NORMAL_MODE);
               g_free (lyr_a[lidx]->name);
-              gimp_image_add_layer (image_id, layer_id, -1);
+              gimp_image_insert_layer (image_id, layer_id, -1, -1);
               drawable = gimp_drawable_get (layer_id);
               gimp_drawable_fill (drawable->drawable_id, GIMP_TRANSPARENT_FILL);
               gimp_item_set_visible (drawable->drawable_id, lyr_a[lidx]->layer_flags.visible);
@@ -1288,7 +1288,7 @@ add_layers (const gint32  image_id,
                                          layer_mode);
               IFDBG(3) g_debug ("Layer tattoo: %d", layer_id);
               g_free (lyr_a[lidx]->name);
-              gimp_image_add_layer (image_id, layer_id, -1);
+              gimp_image_insert_layer (image_id, layer_id, -1, -1);
               gimp_layer_set_offsets (layer_id, l_x, l_y);
               gimp_layer_set_lock_alpha  (layer_id, lyr_a[lidx]->layer_flags.trans_prot);
               drawable = gimp_drawable_get (layer_id);
@@ -1575,7 +1575,7 @@ add_merged_image (const gint32  image_id,
                                  img_a->columns, img_a->rows,
                                  image_type,
                                  100, GIMP_NORMAL_MODE);
-      gimp_image_add_layer (image_id, layer_id, 0);
+      gimp_image_insert_layer (image_id, layer_id, -1, 0);
       drawable = gimp_drawable_get (layer_id);
       gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0,
                            drawable->width, drawable->height, TRUE, FALSE);
@@ -1665,7 +1665,7 @@ add_merged_image (const gint32  image_id,
           channel_id = gimp_channel_new (image_id, alpha_name,
                                          chn_a[cidx].columns, chn_a[cidx].rows,
                                          alpha_opacity, &alpha_rgb);
-          gimp_image_add_channel (image_id, channel_id, 0);
+          gimp_image_insert_channel (image_id, channel_id, -1, 0);
           g_free (alpha_name);
           drawable = gimp_drawable_get (channel_id);
           if (alpha_id)
diff --git a/plug-ins/file-sgi/sgi.c b/plug-ins/file-sgi/sgi.c
index bfc8fd2..5cfbab9 100644
--- a/plug-ins/file-sgi/sgi.c
+++ b/plug-ins/file-sgi/sgi.c
@@ -403,7 +403,7 @@ load_image (const gchar  *filename,
 
   layer = gimp_layer_new (image, _("Background"), sgip->xsize, sgip->ysize,
                           layer_type, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image, layer, 0);
+  gimp_image_insert_layer (image, layer, -1, 0);
 
   /*
    * Get the drawable and set the pixel region for our load...
diff --git a/plug-ins/file-xjt/xjt.c b/plug-ins/file-xjt/xjt.c
index 42f007a..cd64419 100644
--- a/plug-ins/file-xjt/xjt.c
+++ b/plug-ins/file-xjt/xjt.c
@@ -3455,7 +3455,7 @@ load_xjt_image (const gchar  *filename,
       else
         {
           /* add the layer on top of the images layerstak */
-          gimp_image_add_layer (l_image_id, l_layer_id, 0);
+          gimp_image_insert_layer (l_image_id, l_layer_id, -1, 0);
 
           if(l_layer_prp_ptr->floating_attached)
             {
@@ -3610,7 +3610,7 @@ load_xjt_image (const gchar  *filename,
       else
         {
           /* add channel on top of the channelstack */
-          gimp_image_add_channel (l_image_id, l_channel_id, 0);
+          gimp_image_insert_channel (l_image_id, l_channel_id, -1, 0);
 
           /* adjust offsets and other channelproperties */
           gimp_drawable_set_visible (l_channel_id, l_channel_prp_ptr->visible);
@@ -3639,7 +3639,7 @@ load_xjt_image (const gchar  *filename,
            * (if patches are not installed you'll get the error for sure)
            */
           printf("XJT: floating_selection is added as top-layer (attach failed)\n");
-          gimp_image_add_layer (l_image_id, l_fsel_id, 0);
+          gimp_image_insert_layer (l_image_id, l_fsel_id, -1, 0);
         }
     }
 
diff --git a/plug-ins/gfig/gfig-dialog.c b/plug-ins/gfig/gfig-dialog.c
index 09dd0ae..7891002 100644
--- a/plug-ins/gfig/gfig-dialog.c
+++ b/plug-ins/gfig/gfig-dialog.c
@@ -247,7 +247,7 @@ gfig_dialog (void)
                                  img_width, img_height,
                                  GIMP_RGBA_IMAGE, 100.0, GIMP_NORMAL_MODE);
       gimp_drawable_fill (newlayer, GIMP_TRANSPARENT_FILL);
-      gimp_image_add_layer (gfig_context->image_id, newlayer, -1);
+      gimp_image_insert_layer (gfig_context->image_id, newlayer, -1, -1);
       gfig_context->drawable_id = newlayer;
       gfig_context->using_new_layer = TRUE;
     }
diff --git a/plug-ins/lighting/lighting-apply.c b/plug-ins/lighting/lighting-apply.c
index 448f902..659096e 100644
--- a/plug-ins/lighting/lighting-apply.c
+++ b/plug-ins/lighting/lighting-apply.c
@@ -69,7 +69,7 @@ compute_image (void)
 					 GIMP_NORMAL_MODE);
         }
 
-      gimp_image_add_layer (new_image_id, new_layer_id, 0);
+      gimp_image_insert_layer (new_image_id, new_layer_id, -1, 0);
       output_drawable = gimp_drawable_get (new_layer_id);
     }
 
diff --git a/plug-ins/map-object/map-object-apply.c b/plug-ins/map-object/map-object-apply.c
index 9308c4e..5824a8a 100644
--- a/plug-ins/map-object/map-object-apply.c
+++ b/plug-ins/map-object/map-object-apply.c
@@ -263,7 +263,7 @@ compute_image (void)
 					 GIMP_NORMAL_MODE);
         }
 
-      gimp_image_add_layer (new_image_id, new_layer_id, 0);
+      gimp_image_insert_layer (new_image_id, new_layer_id, -1, 0);
       output_drawable = gimp_drawable_get (new_layer_id);
     }
 
diff --git a/plug-ins/pagecurl/pagecurl.c b/plug-ins/pagecurl/pagecurl.c
index bf5f14d..3f587e7 100644
--- a/plug-ins/pagecurl/pagecurl.c
+++ b/plug-ins/pagecurl/pagecurl.c
@@ -739,7 +739,9 @@ do_curl_effect (gint32 drawable_id)
 
   curl_layer_id = curl_layer->drawable_id;
 
-  gimp_image_add_layer (image_id, curl_layer->drawable_id, drawable_position);
+  gimp_image_insert_layer (image_id, curl_layer->drawable_id,
+                           gimp_item_get_parent (drawable_id),
+                           drawable_position);
   gimp_drawable_fill (curl_layer->drawable_id, GIMP_TRANSPARENT_FILL);
 
   gimp_drawable_offsets (drawable_id, &x1, &y1);
diff --git a/plug-ins/selection-to-path/selection-to-path.c b/plug-ins/selection-to-path/selection-to-path.c
index 09dde9f..f6bf365 100644
--- a/plug-ins/selection-to-path/selection-to-path.c
+++ b/plug-ins/selection-to-path/selection-to-path.c
@@ -477,7 +477,7 @@ do_points (spline_list_array_type in_splines,
                                      sel_x1, sel_y1 + sel_height + 1);
     }
 
-   gimp_image_add_vectors (image_ID, vectors, -1);
+  gimp_image_insert_vectors (image_ID, vectors, -1, -1);
 }
 
 
diff --git a/plug-ins/twain/twain.c b/plug-ins/twain/twain.c
index c507dc7..9c6f08a 100644
--- a/plug-ins/twain/twain.c
+++ b/plug-ins/twain/twain.c
@@ -570,8 +570,8 @@ beginTransferCallback(pTW_IMAGEINFO imageInfo, void *clientData)
 					   layerType, 100, GIMP_NORMAL_MODE);
 
   /* Add the layer to the image */
-  gimp_image_add_layer(theClientData->image_id,
-		       theClientData->layer_id, 0);
+  gimp_image_insert_layer(theClientData->image_id,
+                          theClientData->layer_id, -1, 0);
 
   /* Update the progress dialog */
   theClientData->totalPixels = imageInfo->ImageWidth * imageInfo->ImageLength;
diff --git a/plug-ins/win-snap/winsnap.c b/plug-ins/win-snap/winsnap.c
index 2c92e82..e5452bf 100644
--- a/plug-ins/win-snap/winsnap.c
+++ b/plug-ins/win-snap/winsnap.c
@@ -1155,7 +1155,7 @@ sendBMPToGimp(HBITMAP hBMP, HDC hDC, RECT rect)
   layer_id = gimp_layer_new(image_id, _("Background"),
 			    ROUND4(width), height,
 			    layerType, 100, GIMP_NORMAL_MODE);
-  gimp_image_add_layer(image_id, layer_id, 0);
+  gimp_image_insert_layer(image_id, layer_id, -1, 0);
 
   /* Get our drawable */
   drawable = gimp_drawable_get(layer_id);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]