[gimp] pdb, libgimp: use GIMP_VALUES_GET, DUP_FOO() in the libgimp PDB wrappers



commit 5e00decc1322365f29a3a4b2a71df6be82e920ab
Author: Michael Natterer <mitch gimp org>
Date:   Wed Sep 4 02:49:33 2019 +0200

    pdb, libgimp: use GIMP_VALUES_GET,DUP_FOO() in the libgimp PDB wrappers

 libgimp/gimp_pdb.c                  |  12 ++--
 libgimp/gimpbrush_pdb.c             |  60 +++++++++---------
 libgimp/gimpbrushes_pdb.c           |   4 +-
 libgimp/gimpbuffer_pdb.c            |  14 ++---
 libgimp/gimpchannel_pdb.c           |  12 ++--
 libgimp/gimpcontext_pdb.c           | 108 ++++++++++++++++----------------
 libgimp/gimpdebug_pdb.c             |   2 +-
 libgimp/gimpdisplay_pdb.c           |   6 +-
 libgimp/gimpdrawable_pdb.c          |  70 ++++++++++-----------
 libgimp/gimpdrawablecolor_pdb.c     |  12 ++--
 libgimp/gimpdynamics_pdb.c          |   4 +-
 libgimp/gimpedit_pdb.c              |  20 +++---
 libgimp/gimpfileops_pdb.c           |   8 +--
 libgimp/gimpfonts_pdb.c             |   4 +-
 libgimp/gimpgimprc_pdb.c            |  14 ++---
 libgimp/gimpgradient_pdb.c          |  44 ++++++-------
 libgimp/gimpgradients_pdb.c         |   4 +-
 libgimp/gimpimage_pdb.c             | 120 ++++++++++++++++++------------------
 libgimp/gimpimagecolorprofile_pdb.c |   8 +--
 libgimp/gimpimagegrid_pdb.c         |  14 ++---
 libgimp/gimpimageguides_pdb.c       |  10 +--
 libgimp/gimpimagesamplepoints_pdb.c |   8 +--
 libgimp/gimpimageundo_pdb.c         |  10 +--
 libgimp/gimpitem_pdb.c              |  48 +++++++--------
 libgimp/gimpitemtransform_pdb.c     |  20 +++---
 libgimp/gimplayer_pdb.c             |  36 +++++------
 libgimp/gimpmessage_pdb.c           |   2 +-
 libgimp/gimppalette_pdb.c           |  22 +++----
 libgimp/gimppalettes_pdb.c          |   4 +-
 libgimp/gimppattern_pdb.c           |  16 ++---
 libgimp/gimppatterns_pdb.c          |   4 +-
 libgimp/gimppdb_pdb.c               |  36 +++++------
 libgimp/gimpplugin_pdb.c            |   2 +-
 libgimp/gimpprogress_pdb.c          |   2 +-
 libgimp/gimpselection_pdb.c         |  18 +++---
 libgimp/gimptextlayer_pdb.c         |  32 +++++-----
 libgimp/gimptexttool_pdb.c          |  10 +--
 libgimp/gimpunit_pdb.c              |  22 +++----
 libgimp/gimpvectors_pdb.c           |  50 +++++++--------
 pdb/lib.pl                          |   2 +-
 pdb/pdb.pl                          |  56 ++++++++---------
 41 files changed, 475 insertions(+), 475 deletions(-)
---
diff --git a/libgimp/gimp_pdb.c b/libgimp/gimp_pdb.c
index f7cbd01ddf..29d9bc4c78 100644
--- a/libgimp/gimp_pdb.c
+++ b/libgimp/gimp_pdb.c
@@ -65,7 +65,7 @@ gimp_version (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    version = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    version = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -99,7 +99,7 @@ gimp_getpid (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    pid = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    pid = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -206,7 +206,7 @@ gimp_get_parasite (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    parasite = g_value_dup_boxed (gimp_value_array_index (return_vals, 1));
+    parasite = GIMP_VALUES_DUP_PARASITE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -246,8 +246,8 @@ gimp_get_parasite_list (gint *num_parasites)
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_parasites = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      parasites = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
+      *num_parasites = GIMP_VALUES_GET_INT (return_vals, 1);
+      parasites = GIMP_VALUES_DUP_STRING_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -284,7 +284,7 @@ gimp_temp_name (const gchar *extension)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpbrush_pdb.c b/libgimp/gimpbrush_pdb.c
index 2956d8e6da..801ca645b0 100644
--- a/libgimp/gimpbrush_pdb.c
+++ b/libgimp/gimpbrush_pdb.c
@@ -64,7 +64,7 @@ gimp_brush_new (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    actual_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    actual_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -101,7 +101,7 @@ gimp_brush_duplicate (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    copy_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    copy_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -137,7 +137,7 @@ gimp_brush_is_generated (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    generated = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    generated = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -177,7 +177,7 @@ gimp_brush_rename (const gchar *name,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    actual_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    actual_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -248,7 +248,7 @@ gimp_brush_is_editable (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    editable = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    editable = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -301,10 +301,10 @@ gimp_brush_get_info (const gchar *name,
 
   if (success)
     {
-      *width = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *height = g_value_get_int (gimp_value_array_index (return_vals, 2));
-      *mask_bpp = g_value_get_int (gimp_value_array_index (return_vals, 3));
-      *color_bpp = g_value_get_int (gimp_value_array_index (return_vals, 4));
+      *width = GIMP_VALUES_GET_INT (return_vals, 1);
+      *height = GIMP_VALUES_GET_INT (return_vals, 2);
+      *mask_bpp = GIMP_VALUES_GET_INT (return_vals, 3);
+      *color_bpp = GIMP_VALUES_GET_INT (return_vals, 4);
     }
 
   gimp_value_array_unref (return_vals);
@@ -370,14 +370,14 @@ gimp_brush_get_pixels (const gchar  *name,
 
   if (success)
     {
-      *width = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *height = g_value_get_int (gimp_value_array_index (return_vals, 2));
-      *mask_bpp = g_value_get_int (gimp_value_array_index (return_vals, 3));
-      *num_mask_bytes = g_value_get_int (gimp_value_array_index (return_vals, 4));
-      *mask_bytes = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 5));
-      *color_bpp = g_value_get_int (gimp_value_array_index (return_vals, 6));
-      *num_color_bytes = g_value_get_int (gimp_value_array_index (return_vals, 7));
-      *color_bytes = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 8));
+      *width = GIMP_VALUES_GET_INT (return_vals, 1);
+      *height = GIMP_VALUES_GET_INT (return_vals, 2);
+      *mask_bpp = GIMP_VALUES_GET_INT (return_vals, 3);
+      *num_mask_bytes = GIMP_VALUES_GET_INT (return_vals, 4);
+      *mask_bytes = GIMP_VALUES_DUP_UINT8_ARRAY (return_vals, 5);
+      *color_bpp = GIMP_VALUES_GET_INT (return_vals, 6);
+      *num_color_bytes = GIMP_VALUES_GET_INT (return_vals, 7);
+      *color_bytes = GIMP_VALUES_DUP_UINT8_ARRAY (return_vals, 8);
     }
 
   gimp_value_array_unref (return_vals);
@@ -422,7 +422,7 @@ gimp_brush_get_spacing (const gchar *name,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    *spacing = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    *spacing = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -502,7 +502,7 @@ gimp_brush_get_shape (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    shape = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    shape = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -546,7 +546,7 @@ gimp_brush_set_shape (const gchar             *name,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    shape_out = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    shape_out = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -583,7 +583,7 @@ gimp_brush_get_radius (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    radius = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    radius = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -623,7 +623,7 @@ gimp_brush_set_radius (const gchar *name,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    radius_out = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    radius_out = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -660,7 +660,7 @@ gimp_brush_get_spikes (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    spikes = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    spikes = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -700,7 +700,7 @@ gimp_brush_set_spikes (const gchar *name,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    spikes_out = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    spikes_out = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -739,7 +739,7 @@ gimp_brush_get_hardness (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    hardness = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    hardness = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -780,7 +780,7 @@ gimp_brush_set_hardness (const gchar *name,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    hardness_out = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    hardness_out = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -818,7 +818,7 @@ gimp_brush_get_aspect_ratio (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    aspect_ratio = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    aspect_ratio = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -859,7 +859,7 @@ gimp_brush_set_aspect_ratio (const gchar *name,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    aspect_ratio_out = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    aspect_ratio_out = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -896,7 +896,7 @@ gimp_brush_get_angle (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    angle = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    angle = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -936,7 +936,7 @@ gimp_brush_set_angle (const gchar *name,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    angle_out = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    angle_out = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpbrushes_pdb.c b/libgimp/gimpbrushes_pdb.c
index acf39978fd..1e06458ec1 100644
--- a/libgimp/gimpbrushes_pdb.c
+++ b/libgimp/gimpbrushes_pdb.c
@@ -102,8 +102,8 @@ gimp_brushes_get_list (const gchar *filter,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_brushes = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      brush_list = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
+      *num_brushes = GIMP_VALUES_GET_INT (return_vals, 1);
+      brush_list = GIMP_VALUES_DUP_STRING_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimpbuffer_pdb.c b/libgimp/gimpbuffer_pdb.c
index 7c75ba984c..f262c8296c 100644
--- a/libgimp/gimpbuffer_pdb.c
+++ b/libgimp/gimpbuffer_pdb.c
@@ -71,8 +71,8 @@ gimp_buffers_get_list (const gchar *filter,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_buffers = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      buffer_list = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
+      *num_buffers = GIMP_VALUES_GET_INT (return_vals, 1);
+      buffer_list = GIMP_VALUES_DUP_STRING_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -113,7 +113,7 @@ gimp_buffer_rename (const gchar *buffer_name,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    real_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    real_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -184,7 +184,7 @@ gimp_buffer_get_width (const gchar *buffer_name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    width = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    width = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -220,7 +220,7 @@ gimp_buffer_get_height (const gchar *buffer_name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    height = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    height = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -256,7 +256,7 @@ gimp_buffer_get_bytes (const gchar *buffer_name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    bytes = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -292,7 +292,7 @@ gimp_buffer_get_image_type (const gchar *buffer_name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    image_type = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    image_type = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpchannel_pdb.c b/libgimp/gimpchannel_pdb.c
index 52264b010d..97eeca2a39 100644
--- a/libgimp/gimpchannel_pdb.c
+++ b/libgimp/gimpchannel_pdb.c
@@ -82,7 +82,7 @@ _gimp_channel_new (GimpImage     *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    channel = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    channel = GIMP_VALUES_GET_CHANNEL (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -128,7 +128,7 @@ gimp_channel_new_from_component (GimpImage       *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    channel = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    channel = GIMP_VALUES_GET_CHANNEL (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -164,7 +164,7 @@ gimp_channel_copy (GimpChannel *channel)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    channel_copy = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    channel_copy = GIMP_VALUES_GET_CHANNEL (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -246,7 +246,7 @@ gimp_channel_get_show_masked (GimpChannel *channel)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    show_masked = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    show_masked = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -318,7 +318,7 @@ gimp_channel_get_opacity (GimpChannel *channel)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    opacity = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    opacity = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -392,7 +392,7 @@ gimp_channel_get_color (GimpChannel *channel,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    gimp_value_get_rgb (gimp_value_array_index (return_vals, 1), &*color);
+    GIMP_VALUES_GET_RGB (return_vals, 1, &*color);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpcontext_pdb.c b/libgimp/gimpcontext_pdb.c
index e7dcbad6fe..b5673b927a 100644
--- a/libgimp/gimpcontext_pdb.c
+++ b/libgimp/gimpcontext_pdb.c
@@ -179,8 +179,8 @@ gimp_context_list_paint_methods (gint    *num_paint_methods,
 
   if (success)
     {
-      *num_paint_methods = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *paint_methods = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
+      *num_paint_methods = GIMP_VALUES_GET_INT (return_vals, 1);
+      *paint_methods = GIMP_VALUES_DUP_STRING_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -217,7 +217,7 @@ gimp_context_get_paint_method (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -291,7 +291,7 @@ gimp_context_get_stroke_method (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    stroke_method = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    stroke_method = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -367,7 +367,7 @@ gimp_context_get_foreground (GimpRGB *foreground)
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    gimp_value_get_rgb (gimp_value_array_index (return_vals, 1), &*foreground);
+    GIMP_VALUES_GET_RGB (return_vals, 1, &*foreground);
 
   gimp_value_array_unref (return_vals);
 
@@ -443,7 +443,7 @@ gimp_context_get_background (GimpRGB *background)
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    gimp_value_get_rgb (gimp_value_array_index (return_vals, 1), &*background);
+    GIMP_VALUES_GET_RGB (return_vals, 1, &*background);
 
   gimp_value_array_unref (return_vals);
 
@@ -586,7 +586,7 @@ gimp_context_get_opacity (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    opacity = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    opacity = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -658,7 +658,7 @@ gimp_context_get_paint_mode (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    paint_mode = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    paint_mode = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -727,7 +727,7 @@ gimp_context_get_line_width (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    line_width = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    line_width = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -800,7 +800,7 @@ gimp_context_get_line_width_unit (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    line_width_unit = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    line_width_unit = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -874,7 +874,7 @@ gimp_context_get_line_cap_style (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    cap_style = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    cap_style = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -948,7 +948,7 @@ gimp_context_get_line_join_style (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    join_style = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    join_style = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1022,7 +1022,7 @@ gimp_context_get_line_miter_limit (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    miter_limit = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    miter_limit = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1099,7 +1099,7 @@ gimp_context_get_line_dash_offset (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    dash_offset = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    dash_offset = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1182,8 +1182,8 @@ gimp_context_get_line_dash_pattern (gint     *num_dashes,
 
   if (success)
     {
-      *num_dashes = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *dashes = gimp_value_dup_float_array (gimp_value_array_index (return_vals, 2));
+      *num_dashes = GIMP_VALUES_GET_INT (return_vals, 1);
+      *dashes = GIMP_VALUES_DUP_FLOAT_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -1269,7 +1269,7 @@ gimp_context_get_brush (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1342,7 +1342,7 @@ gimp_context_get_brush_size (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    size = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    size = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1445,7 +1445,7 @@ gimp_context_get_brush_aspect_ratio (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    aspect = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    aspect = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1514,7 +1514,7 @@ gimp_context_get_brush_angle (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    angle = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    angle = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1584,7 +1584,7 @@ gimp_context_get_brush_spacing (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    spacing = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    spacing = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1688,7 +1688,7 @@ gimp_context_get_brush_hardness (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    hardness = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    hardness = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1791,7 +1791,7 @@ gimp_context_get_brush_force (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    force = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    force = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1863,7 +1863,7 @@ gimp_context_get_dynamics (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1939,7 +1939,7 @@ gimp_context_get_mypaint_brush (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2016,7 +2016,7 @@ gimp_context_get_pattern (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2091,7 +2091,7 @@ gimp_context_get_gradient (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2306,7 +2306,7 @@ gimp_context_get_gradient_blend_color_space (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    blend_color_space = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    blend_color_space = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2376,7 +2376,7 @@ gimp_context_get_gradient_repeat_mode (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    repeat_mode = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    repeat_mode = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2446,7 +2446,7 @@ gimp_context_get_gradient_reverse (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    reverse = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    reverse = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2517,7 +2517,7 @@ gimp_context_get_palette (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2592,7 +2592,7 @@ gimp_context_get_font (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2665,7 +2665,7 @@ gimp_context_get_antialias (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    antialias = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    antialias = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2745,7 +2745,7 @@ gimp_context_get_feather (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    feather = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    feather = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2832,8 +2832,8 @@ gimp_context_get_feather_radius (gdouble *feather_radius_x,
 
   if (success)
     {
-      *feather_radius_x = g_value_get_double (gimp_value_array_index (return_vals, 1));
-      *feather_radius_y = g_value_get_double (gimp_value_array_index (return_vals, 2));
+      *feather_radius_x = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
+      *feather_radius_y = GIMP_VALUES_GET_DOUBLE (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -2909,7 +2909,7 @@ gimp_context_get_sample_merged (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    sample_merged = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    sample_merged = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2988,7 +2988,7 @@ gimp_context_get_sample_criterion (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    sample_criterion = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    sample_criterion = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3065,7 +3065,7 @@ gimp_context_get_sample_threshold (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    sample_threshold = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    sample_threshold = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3144,7 +3144,7 @@ gimp_context_get_sample_threshold_int (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    sample_threshold = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    sample_threshold = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3214,7 +3214,7 @@ gimp_context_get_sample_transparent (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    sample_transparent = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    sample_transparent = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3291,7 +3291,7 @@ gimp_context_get_diagonal_neighbors (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    diagonal_neighbors = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    diagonal_neighbors = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3370,7 +3370,7 @@ gimp_context_get_distance_metric (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    metric = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    metric = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3449,7 +3449,7 @@ gimp_context_get_interpolation (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    interpolation = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    interpolation = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3527,7 +3527,7 @@ gimp_context_get_transform_direction (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    transform_direction = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    transform_direction = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3604,7 +3604,7 @@ gimp_context_get_transform_resize (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    transform_resize = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    transform_resize = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3683,7 +3683,7 @@ gimp_context_get_ink_size (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    size = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    size = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3752,7 +3752,7 @@ gimp_context_get_ink_angle (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    angle = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    angle = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3821,7 +3821,7 @@ gimp_context_get_ink_size_sensitivity (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    size = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    size = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3890,7 +3890,7 @@ gimp_context_get_ink_tilt_sensitivity (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    tilt = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    tilt = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3959,7 +3959,7 @@ gimp_context_get_ink_speed_sensitivity (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    speed = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    speed = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -4028,7 +4028,7 @@ gimp_context_get_ink_blob_type (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    type = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    type = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -4097,7 +4097,7 @@ gimp_context_get_ink_blob_aspect_ratio (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    aspect = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    aspect = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -4166,7 +4166,7 @@ gimp_context_get_ink_blob_angle (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    angle = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    angle = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpdebug_pdb.c b/libgimp/gimpdebug_pdb.c
index ff94dd2d71..f232f96573 100644
--- a/libgimp/gimpdebug_pdb.c
+++ b/libgimp/gimpdebug_pdb.c
@@ -105,7 +105,7 @@ gimp_debug_timer_end (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    elapsed = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    elapsed = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpdisplay_pdb.c b/libgimp/gimpdisplay_pdb.c
index 5771419ae7..cdafecac2b 100644
--- a/libgimp/gimpdisplay_pdb.c
+++ b/libgimp/gimpdisplay_pdb.c
@@ -64,7 +64,7 @@ gimp_display_id_is_valid (gint display_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    valid = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    valid = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -103,7 +103,7 @@ gimp_display_new (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    display = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    display = GIMP_VALUES_GET_DISPLAY (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -180,7 +180,7 @@ gimp_display_get_window_handle (GimpDisplay *display)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    window = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    window = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpdrawable_pdb.c b/libgimp/gimpdrawable_pdb.c
index ca86b01496..f68bdb6dc9 100644
--- a/libgimp/gimpdrawable_pdb.c
+++ b/libgimp/gimpdrawable_pdb.c
@@ -67,7 +67,7 @@ _gimp_drawable_get_format (GimpDrawable *drawable)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    format = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    format = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -106,7 +106,7 @@ _gimp_drawable_get_thumbnail_format (GimpDrawable *drawable)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    format = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    format = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -140,7 +140,7 @@ gimp_drawable_type (GimpDrawable *drawable)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    type = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    type = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -177,7 +177,7 @@ gimp_drawable_type_with_alpha (GimpDrawable *drawable)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    type_with_alpha = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    type_with_alpha = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -213,7 +213,7 @@ gimp_drawable_has_alpha (GimpDrawable *drawable)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    has_alpha = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    has_alpha = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -248,7 +248,7 @@ gimp_drawable_is_rgb (GimpDrawable *drawable)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    is_rgb = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    is_rgb = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -283,7 +283,7 @@ gimp_drawable_is_gray (GimpDrawable *drawable)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    is_gray = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    is_gray = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -318,7 +318,7 @@ gimp_drawable_is_indexed (GimpDrawable *drawable)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    is_indexed = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    is_indexed = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -352,7 +352,7 @@ gimp_drawable_bpp (GimpDrawable *drawable)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    bpp = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    bpp = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -386,7 +386,7 @@ gimp_drawable_width (GimpDrawable *drawable)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    width = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    width = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -420,7 +420,7 @@ gimp_drawable_height (GimpDrawable *drawable)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    height = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    height = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -466,8 +466,8 @@ gimp_drawable_offsets (GimpDrawable *drawable,
 
   if (success)
     {
-      *offset_x = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *offset_y = g_value_get_int (gimp_value_array_index (return_vals, 2));
+      *offset_x = GIMP_VALUES_GET_INT (return_vals, 1);
+      *offset_y = GIMP_VALUES_GET_INT (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -523,11 +523,11 @@ gimp_drawable_mask_bounds (GimpDrawable *drawable,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
-      *x1 = g_value_get_int (gimp_value_array_index (return_vals, 2));
-      *y1 = g_value_get_int (gimp_value_array_index (return_vals, 3));
-      *x2 = g_value_get_int (gimp_value_array_index (return_vals, 4));
-      *y2 = g_value_get_int (gimp_value_array_index (return_vals, 5));
+      non_empty = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
+      *x1 = GIMP_VALUES_GET_INT (return_vals, 2);
+      *y1 = GIMP_VALUES_GET_INT (return_vals, 3);
+      *x2 = GIMP_VALUES_GET_INT (return_vals, 4);
+      *y2 = GIMP_VALUES_GET_INT (return_vals, 5);
     }
 
   gimp_value_array_unref (return_vals);
@@ -578,11 +578,11 @@ gimp_drawable_mask_intersect (GimpDrawable *drawable,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
-      *x = g_value_get_int (gimp_value_array_index (return_vals, 2));
-      *y = g_value_get_int (gimp_value_array_index (return_vals, 3));
-      *width = g_value_get_int (gimp_value_array_index (return_vals, 4));
-      *height = g_value_get_int (gimp_value_array_index (return_vals, 5));
+      non_empty = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
+      *x = GIMP_VALUES_GET_INT (return_vals, 2);
+      *y = GIMP_VALUES_GET_INT (return_vals, 3);
+      *width = GIMP_VALUES_GET_INT (return_vals, 4);
+      *height = GIMP_VALUES_GET_INT (return_vals, 5);
     }
 
   gimp_value_array_unref (return_vals);
@@ -757,8 +757,8 @@ gimp_drawable_get_pixel (GimpDrawable *drawable,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_channels = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      pixel = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 2));
+      *num_channels = GIMP_VALUES_GET_INT (return_vals, 1);
+      pixel = GIMP_VALUES_DUP_UINT8_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -968,11 +968,11 @@ _gimp_drawable_thumbnail (GimpDrawable  *drawable,
 
   if (success)
     {
-      *actual_width = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *actual_height = g_value_get_int (gimp_value_array_index (return_vals, 2));
-      *bpp = g_value_get_int (gimp_value_array_index (return_vals, 3));
-      *thumbnail_data_count = g_value_get_int (gimp_value_array_index (return_vals, 4));
-      *thumbnail_data = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 5));
+      *actual_width = GIMP_VALUES_GET_INT (return_vals, 1);
+      *actual_height = GIMP_VALUES_GET_INT (return_vals, 2);
+      *bpp = GIMP_VALUES_GET_INT (return_vals, 3);
+      *thumbnail_data_count = GIMP_VALUES_GET_INT (return_vals, 4);
+      *thumbnail_data = GIMP_VALUES_DUP_UINT8_ARRAY (return_vals, 5);
     }
 
   gimp_value_array_unref (return_vals);
@@ -1049,11 +1049,11 @@ _gimp_drawable_sub_thumbnail (GimpDrawable  *drawable,
 
   if (success)
     {
-      *width = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *height = g_value_get_int (gimp_value_array_index (return_vals, 2));
-      *bpp = g_value_get_int (gimp_value_array_index (return_vals, 3));
-      *thumbnail_data_count = g_value_get_int (gimp_value_array_index (return_vals, 4));
-      *thumbnail_data = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 5));
+      *width = GIMP_VALUES_GET_INT (return_vals, 1);
+      *height = GIMP_VALUES_GET_INT (return_vals, 2);
+      *bpp = GIMP_VALUES_GET_INT (return_vals, 3);
+      *thumbnail_data_count = GIMP_VALUES_GET_INT (return_vals, 4);
+      *thumbnail_data = GIMP_VALUES_DUP_UINT8_ARRAY (return_vals, 5);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimpdrawablecolor_pdb.c b/libgimp/gimpdrawablecolor_pdb.c
index 6280331772..d723da2e89 100644
--- a/libgimp/gimpdrawablecolor_pdb.c
+++ b/libgimp/gimpdrawablecolor_pdb.c
@@ -442,12 +442,12 @@ gimp_drawable_histogram (GimpDrawable         *drawable,
 
   if (success)
     {
-      *mean = g_value_get_double (gimp_value_array_index (return_vals, 1));
-      *std_dev = g_value_get_double (gimp_value_array_index (return_vals, 2));
-      *median = g_value_get_double (gimp_value_array_index (return_vals, 3));
-      *pixels = g_value_get_double (gimp_value_array_index (return_vals, 4));
-      *count = g_value_get_double (gimp_value_array_index (return_vals, 5));
-      *percentile = g_value_get_double (gimp_value_array_index (return_vals, 6));
+      *mean = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
+      *std_dev = GIMP_VALUES_GET_DOUBLE (return_vals, 2);
+      *median = GIMP_VALUES_GET_DOUBLE (return_vals, 3);
+      *pixels = GIMP_VALUES_GET_DOUBLE (return_vals, 4);
+      *count = GIMP_VALUES_GET_DOUBLE (return_vals, 5);
+      *percentile = GIMP_VALUES_GET_DOUBLE (return_vals, 6);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimpdynamics_pdb.c b/libgimp/gimpdynamics_pdb.c
index 5d79cf92eb..1e1e7f6907 100644
--- a/libgimp/gimpdynamics_pdb.c
+++ b/libgimp/gimpdynamics_pdb.c
@@ -106,8 +106,8 @@ gimp_dynamics_get_list (const gchar *filter,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_dynamics = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      dynamics_list = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
+      *num_dynamics = GIMP_VALUES_GET_INT (return_vals, 1);
+      dynamics_list = GIMP_VALUES_DUP_STRING_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimpedit_pdb.c b/libgimp/gimpedit_pdb.c
index 08e83d483d..f4df41cfb3 100644
--- a/libgimp/gimpedit_pdb.c
+++ b/libgimp/gimpedit_pdb.c
@@ -68,7 +68,7 @@ gimp_edit_cut (GimpDrawable *drawable)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    non_empty = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -109,7 +109,7 @@ gimp_edit_copy (GimpDrawable *drawable)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    non_empty = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -150,7 +150,7 @@ gimp_edit_copy_visible (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    non_empty = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -201,7 +201,7 @@ gimp_edit_paste (GimpDrawable *drawable,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    floating_sel = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    floating_sel = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -238,7 +238,7 @@ gimp_edit_paste_as_new_image (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    image = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    image = GIMP_VALUES_GET_IMAGE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -282,7 +282,7 @@ gimp_edit_named_cut (GimpDrawable *drawable,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    real_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    real_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -326,7 +326,7 @@ gimp_edit_named_copy (GimpDrawable *drawable,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    real_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    real_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -370,7 +370,7 @@ gimp_edit_named_copy_visible (GimpImage   *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    real_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    real_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -413,7 +413,7 @@ gimp_edit_named_paste (GimpDrawable *drawable,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    floating_sel = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    floating_sel = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -450,7 +450,7 @@ gimp_edit_named_paste_as_new_image (const gchar *buffer_name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    image = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    image = GIMP_VALUES_GET_IMAGE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpfileops_pdb.c b/libgimp/gimpfileops_pdb.c
index 93af081117..fe5501a748 100644
--- a/libgimp/gimpfileops_pdb.c
+++ b/libgimp/gimpfileops_pdb.c
@@ -73,7 +73,7 @@ gimp_file_load (GimpRunMode  run_mode,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    image = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    image = GIMP_VALUES_GET_IMAGE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -118,7 +118,7 @@ gimp_file_load_layer (GimpRunMode  run_mode,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -170,8 +170,8 @@ gimp_file_load_layers (GimpRunMode  run_mode,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_layers = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      layer_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+      *num_layers = GIMP_VALUES_GET_INT (return_vals, 1);
+      layer_ids = GIMP_VALUES_DUP_INT32_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimpfonts_pdb.c b/libgimp/gimpfonts_pdb.c
index 22447e3809..10c78d1f62 100644
--- a/libgimp/gimpfonts_pdb.c
+++ b/libgimp/gimpfonts_pdb.c
@@ -102,8 +102,8 @@ gimp_fonts_get_list (const gchar *filter,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_fonts = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      font_list = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
+      *num_fonts = GIMP_VALUES_GET_INT (return_vals, 1);
+      font_list = GIMP_VALUES_DUP_STRING_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimpgimprc_pdb.c b/libgimp/gimpgimprc_pdb.c
index 76c8e68465..f8693bb7c4 100644
--- a/libgimp/gimpgimprc_pdb.c
+++ b/libgimp/gimpgimprc_pdb.c
@@ -70,7 +70,7 @@ gimp_gimprc_query (const gchar *token)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    value = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    value = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -143,7 +143,7 @@ gimp_get_default_comment (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    comment = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    comment = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -177,7 +177,7 @@ gimp_get_default_unit (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    unit_id = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    unit_id = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -221,8 +221,8 @@ gimp_get_monitor_resolution (gdouble *xres,
 
   if (success)
     {
-      *xres = g_value_get_double (gimp_value_array_index (return_vals, 1));
-      *yres = g_value_get_double (gimp_value_array_index (return_vals, 2));
+      *xres = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
+      *yres = GIMP_VALUES_GET_DOUBLE (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -259,7 +259,7 @@ _gimp_get_color_configuration (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    config = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    config = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -292,7 +292,7 @@ gimp_get_module_load_inhibit (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    load_inhibit = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    load_inhibit = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpgradient_pdb.c b/libgimp/gimpgradient_pdb.c
index 1c32e9eb77..f2786ac5fb 100644
--- a/libgimp/gimpgradient_pdb.c
+++ b/libgimp/gimpgradient_pdb.c
@@ -64,7 +64,7 @@ gimp_gradient_new (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    actual_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    actual_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -101,7 +101,7 @@ gimp_gradient_duplicate (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    copy_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    copy_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -137,7 +137,7 @@ gimp_gradient_is_editable (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    editable = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    editable = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -177,7 +177,7 @@ gimp_gradient_rename (const gchar *name,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    actual_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    actual_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -249,7 +249,7 @@ gimp_gradient_get_number_of_segments (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    num_segments = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    num_segments = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -307,8 +307,8 @@ gimp_gradient_get_uniform_samples (const gchar  *name,
 
   if (success)
     {
-      *num_color_samples = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *color_samples = gimp_value_dup_float_array (gimp_value_array_index (return_vals, 2));
+      *num_color_samples = GIMP_VALUES_GET_INT (return_vals, 1);
+      *color_samples = GIMP_VALUES_DUP_FLOAT_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -370,8 +370,8 @@ gimp_gradient_get_custom_samples (const gchar    *name,
 
   if (success)
     {
-      *num_color_samples = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *color_samples = gimp_value_dup_float_array (gimp_value_array_index (return_vals, 2));
+      *num_color_samples = GIMP_VALUES_GET_INT (return_vals, 1);
+      *color_samples = GIMP_VALUES_DUP_FLOAT_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -421,8 +421,8 @@ gimp_gradient_segment_get_left_color (const gchar *name,
 
   if (success)
     {
-      gimp_value_get_rgb (gimp_value_array_index (return_vals, 1), &*color);
-      *opacity = g_value_get_double (gimp_value_array_index (return_vals, 2));
+      GIMP_VALUES_GET_RGB (return_vals, 1, &*color);
+      *opacity = GIMP_VALUES_GET_DOUBLE (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -517,8 +517,8 @@ gimp_gradient_segment_get_right_color (const gchar *name,
 
   if (success)
     {
-      gimp_value_get_rgb (gimp_value_array_index (return_vals, 1), &*color);
-      *opacity = g_value_get_double (gimp_value_array_index (return_vals, 2));
+      GIMP_VALUES_GET_RGB (return_vals, 1, &*color);
+      *opacity = GIMP_VALUES_GET_DOUBLE (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -610,7 +610,7 @@ gimp_gradient_segment_get_left_pos (const gchar *name,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    *pos = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    *pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -662,7 +662,7 @@ gimp_gradient_segment_set_left_pos (const gchar *name,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    *final_pos = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    *final_pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -708,7 +708,7 @@ gimp_gradient_segment_get_middle_pos (const gchar *name,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    *pos = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    *pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -759,7 +759,7 @@ gimp_gradient_segment_set_middle_pos (const gchar *name,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    *final_pos = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    *final_pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -805,7 +805,7 @@ gimp_gradient_segment_get_right_pos (const gchar *name,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    *pos = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    *pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -857,7 +857,7 @@ gimp_gradient_segment_set_right_pos (const gchar *name,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    *final_pos = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    *final_pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -903,7 +903,7 @@ gimp_gradient_segment_get_blending_function (const gchar             *name,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    *blend_func = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    *blend_func = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -949,7 +949,7 @@ gimp_gradient_segment_get_coloring_type (const gchar              *name,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    *coloring_type = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    *coloring_type = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1432,7 +1432,7 @@ gimp_gradient_segment_range_move (const gchar *name,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    final_delta = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    final_delta = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpgradients_pdb.c b/libgimp/gimpgradients_pdb.c
index bb8e7814aa..c241e15f52 100644
--- a/libgimp/gimpgradients_pdb.c
+++ b/libgimp/gimpgradients_pdb.c
@@ -102,8 +102,8 @@ gimp_gradients_get_list (const gchar *filter,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_gradients = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      gradient_list = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
+      *num_gradients = GIMP_VALUES_GET_INT (return_vals, 1);
+      gradient_list = GIMP_VALUES_DUP_STRING_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
index 9cdb97a27a..478d723dc3 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -65,7 +65,7 @@ gimp_image_id_is_valid (gint image_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    valid = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    valid = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -103,8 +103,8 @@ _gimp_image_list (gint *num_images)
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_images = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      image_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+      *num_images = GIMP_VALUES_GET_INT (return_vals, 1);
+      image_ids = GIMP_VALUES_DUP_INT32_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -154,7 +154,7 @@ gimp_image_new (gint              width,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    image = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    image = GIMP_VALUES_GET_IMAGE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -203,7 +203,7 @@ gimp_image_new_with_precision (gint              width,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    image = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    image = GIMP_VALUES_GET_IMAGE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -238,7 +238,7 @@ gimp_image_duplicate (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    new_image = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    new_image = GIMP_VALUES_GET_IMAGE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -311,7 +311,7 @@ gimp_image_base_type (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    base_type = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    base_type = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -347,7 +347,7 @@ gimp_image_get_precision (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    precision = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    precision = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -383,7 +383,7 @@ gimp_image_get_default_new_layer_mode (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    mode = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    mode = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -418,7 +418,7 @@ gimp_image_width (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    width = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    width = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -453,7 +453,7 @@ gimp_image_height (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    height = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    height = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -495,8 +495,8 @@ _gimp_image_get_layers (GimpImage *image,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_layers = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      layer_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+      *num_layers = GIMP_VALUES_GET_INT (return_vals, 1);
+      layer_ids = GIMP_VALUES_DUP_INT32_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -542,8 +542,8 @@ _gimp_image_get_channels (GimpImage *image,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_channels = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      channel_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+      *num_channels = GIMP_VALUES_GET_INT (return_vals, 1);
+      channel_ids = GIMP_VALUES_DUP_INT32_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -588,8 +588,8 @@ _gimp_image_get_vectors (GimpImage *image,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_vectors = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      vector_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+      *num_vectors = GIMP_VALUES_GET_INT (return_vals, 1);
+      vector_ids = GIMP_VALUES_DUP_INT32_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -629,7 +629,7 @@ gimp_image_get_active_drawable (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    drawable = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    drawable = GIMP_VALUES_GET_DRAWABLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -700,7 +700,7 @@ gimp_image_get_floating_sel (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    floating_sel = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    floating_sel = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -737,7 +737,7 @@ gimp_image_floating_sel_attached_to (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    drawable = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    drawable = GIMP_VALUES_GET_DRAWABLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -803,7 +803,7 @@ gimp_image_pick_color (GimpImage    *image,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    gimp_value_get_rgb (gimp_value_array_index (return_vals, 1), &*color);
+    GIMP_VALUES_GET_RGB (return_vals, 1, &*color);
 
   gimp_value_array_unref (return_vals);
 
@@ -847,7 +847,7 @@ gimp_image_pick_correlate_layer (GimpImage *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1393,7 +1393,7 @@ gimp_image_get_item_position (GimpImage *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    position = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    position = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1631,7 +1631,7 @@ gimp_image_flatten (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1673,7 +1673,7 @@ gimp_image_merge_visible_layers (GimpImage     *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1719,7 +1719,7 @@ gimp_image_merge_down (GimpImage     *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1764,8 +1764,8 @@ _gimp_image_get_colormap (GimpImage *image,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      colormap = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 2));
+      *num_bytes = GIMP_VALUES_GET_INT (return_vals, 1);
+      colormap = GIMP_VALUES_DUP_UINT8_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -1845,7 +1845,7 @@ _gimp_image_get_metadata (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    metadata_string = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    metadata_string = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1956,7 +1956,7 @@ gimp_image_is_dirty (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    dirty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    dirty = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2018,11 +2018,11 @@ _gimp_image_thumbnail (GimpImage  *image,
 
   if (success)
     {
-      *actual_width = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *actual_height = g_value_get_int (gimp_value_array_index (return_vals, 2));
-      *bpp = g_value_get_int (gimp_value_array_index (return_vals, 3));
-      *thumbnail_data_count = g_value_get_int (gimp_value_array_index (return_vals, 4));
-      *thumbnail_data = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 5));
+      *actual_width = GIMP_VALUES_GET_INT (return_vals, 1);
+      *actual_height = GIMP_VALUES_GET_INT (return_vals, 2);
+      *bpp = GIMP_VALUES_GET_INT (return_vals, 3);
+      *thumbnail_data_count = GIMP_VALUES_GET_INT (return_vals, 4);
+      *thumbnail_data = GIMP_VALUES_DUP_UINT8_ARRAY (return_vals, 5);
     }
 
   gimp_value_array_unref (return_vals);
@@ -2059,7 +2059,7 @@ gimp_image_get_active_layer (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    active_layer = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    active_layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2133,7 +2133,7 @@ gimp_image_get_active_channel (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    active_channel = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    active_channel = GIMP_VALUES_GET_CHANNEL (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2206,7 +2206,7 @@ gimp_image_get_active_vectors (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    active_vectors = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    active_vectors = GIMP_VALUES_GET_VECTORS (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2277,7 +2277,7 @@ gimp_image_get_selection (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    selection = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    selection = GIMP_VALUES_GET_SELECTION (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2317,7 +2317,7 @@ gimp_image_get_component_active (GimpImage       *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    active = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    active = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2400,7 +2400,7 @@ gimp_image_get_component_visible (GimpImage       *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    visible = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    visible = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2481,7 +2481,7 @@ gimp_image_get_filename (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    filename = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    filename = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2561,7 +2561,7 @@ gimp_image_get_uri (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    uri = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2599,7 +2599,7 @@ gimp_image_get_xcf_uri (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    uri = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2639,7 +2639,7 @@ gimp_image_get_imported_uri (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    uri = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2678,7 +2678,7 @@ gimp_image_get_exported_uri (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    uri = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2719,7 +2719,7 @@ gimp_image_get_name (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2764,8 +2764,8 @@ gimp_image_get_resolution (GimpImage *image,
 
   if (success)
     {
-      *xresolution = g_value_get_double (gimp_value_array_index (return_vals, 1));
-      *yresolution = g_value_get_double (gimp_value_array_index (return_vals, 2));
+      *xresolution = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
+      *yresolution = GIMP_VALUES_GET_DOUBLE (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -2844,7 +2844,7 @@ gimp_image_get_unit (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    unit = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    unit = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -2920,7 +2920,7 @@ gimp_image_get_tattoo_state (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    tattoo_state = g_value_get_uint (gimp_value_array_index (return_vals, 1));
+    tattoo_state = GIMP_VALUES_GET_UINT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3005,7 +3005,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3043,7 +3043,7 @@ gimp_image_get_channel_by_tattoo (GimpImage *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    channel = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    channel = GIMP_VALUES_GET_CHANNEL (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3083,7 +3083,7 @@ gimp_image_get_vectors_by_tattoo (GimpImage *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    vectors = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    vectors = GIMP_VALUES_GET_VECTORS (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3123,7 +3123,7 @@ gimp_image_get_layer_by_name (GimpImage   *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3163,7 +3163,7 @@ gimp_image_get_channel_by_name (GimpImage   *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    channel = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    channel = GIMP_VALUES_GET_CHANNEL (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3203,7 +3203,7 @@ gimp_image_get_vectors_by_name (GimpImage   *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    vectors = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    vectors = GIMP_VALUES_GET_VECTORS (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3321,7 +3321,7 @@ gimp_image_get_parasite (GimpImage   *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    parasite = g_value_dup_boxed (gimp_value_array_index (return_vals, 1));
+    parasite = GIMP_VALUES_DUP_PARASITE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -3364,8 +3364,8 @@ gimp_image_get_parasite_list (GimpImage *image,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_parasites = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      parasites = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
+      *num_parasites = GIMP_VALUES_GET_INT (return_vals, 1);
+      parasites = GIMP_VALUES_DUP_STRING_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimpimagecolorprofile_pdb.c b/libgimp/gimpimagecolorprofile_pdb.c
index 7f2e80705f..f793158910 100644
--- a/libgimp/gimpimagecolorprofile_pdb.c
+++ b/libgimp/gimpimagecolorprofile_pdb.c
@@ -71,8 +71,8 @@ _gimp_image_get_color_profile (GimpImage *image,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      profile_data = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 2));
+      *num_bytes = GIMP_VALUES_GET_INT (return_vals, 1);
+      profile_data = GIMP_VALUES_DUP_UINT8_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -120,8 +120,8 @@ _gimp_image_get_effective_color_profile (GimpImage *image,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      profile_data = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 2));
+      *num_bytes = GIMP_VALUES_GET_INT (return_vals, 1);
+      profile_data = GIMP_VALUES_DUP_UINT8_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimpimagegrid_pdb.c b/libgimp/gimpimagegrid_pdb.c
index c616adef38..4e9ddd3fb5 100644
--- a/libgimp/gimpimagegrid_pdb.c
+++ b/libgimp/gimpimagegrid_pdb.c
@@ -74,8 +74,8 @@ gimp_image_grid_get_spacing (GimpImage *image,
 
   if (success)
     {
-      *xspacing = g_value_get_double (gimp_value_array_index (return_vals, 1));
-      *yspacing = g_value_get_double (gimp_value_array_index (return_vals, 2));
+      *xspacing = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
+      *yspacing = GIMP_VALUES_GET_DOUBLE (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -165,8 +165,8 @@ gimp_image_grid_get_offset (GimpImage *image,
 
   if (success)
     {
-      *xoffset = g_value_get_double (gimp_value_array_index (return_vals, 1));
-      *yoffset = g_value_get_double (gimp_value_array_index (return_vals, 2));
+      *xoffset = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
+      *yoffset = GIMP_VALUES_GET_DOUBLE (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -249,7 +249,7 @@ gimp_image_grid_get_foreground_color (GimpImage *image,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    gimp_value_get_rgb (gimp_value_array_index (return_vals, 1), &*fgcolor);
+    GIMP_VALUES_GET_RGB (return_vals, 1, &*fgcolor);
 
   gimp_value_array_unref (return_vals);
 
@@ -327,7 +327,7 @@ gimp_image_grid_get_background_color (GimpImage *image,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    gimp_value_get_rgb (gimp_value_array_index (return_vals, 1), &*bgcolor);
+    GIMP_VALUES_GET_RGB (return_vals, 1, &*bgcolor);
 
   gimp_value_array_unref (return_vals);
 
@@ -401,7 +401,7 @@ gimp_image_grid_get_style (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    style = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    style = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpimageguides_pdb.c b/libgimp/gimpimageguides_pdb.c
index 00098559bf..65187e01c9 100644
--- a/libgimp/gimpimageguides_pdb.c
+++ b/libgimp/gimpimageguides_pdb.c
@@ -66,7 +66,7 @@ gimp_image_add_hguide (GimpImage *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    guide = g_value_get_uint (gimp_value_array_index (return_vals, 1));
+    guide = GIMP_VALUES_GET_UINT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -105,7 +105,7 @@ gimp_image_add_vguide (GimpImage *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    guide = g_value_get_uint (gimp_value_array_index (return_vals, 1));
+    guide = GIMP_VALUES_GET_UINT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -183,7 +183,7 @@ gimp_image_find_next_guide (GimpImage *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    next_guide = g_value_get_uint (gimp_value_array_index (return_vals, 1));
+    next_guide = GIMP_VALUES_GET_UINT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -221,7 +221,7 @@ gimp_image_get_guide_orientation (GimpImage *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    orientation = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    orientation = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -259,7 +259,7 @@ gimp_image_get_guide_position (GimpImage *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    position = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    position = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpimagesamplepoints_pdb.c b/libgimp/gimpimagesamplepoints_pdb.c
index 1986e61cf2..914dc66593 100644
--- a/libgimp/gimpimagesamplepoints_pdb.c
+++ b/libgimp/gimpimagesamplepoints_pdb.c
@@ -71,7 +71,7 @@ gimp_image_add_sample_point (GimpImage *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    sample_point = g_value_get_uint (gimp_value_array_index (return_vals, 1));
+    sample_point = GIMP_VALUES_GET_UINT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -154,7 +154,7 @@ gimp_image_find_next_sample_point (GimpImage *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    next_sample_point = g_value_get_uint (gimp_value_array_index (return_vals, 1));
+    next_sample_point = GIMP_VALUES_GET_UINT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -198,8 +198,8 @@ gimp_image_get_sample_point_position (GimpImage *image,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      position_x = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *position_y = g_value_get_int (gimp_value_array_index (return_vals, 2));
+      position_x = GIMP_VALUES_GET_INT (return_vals, 1);
+      *position_y = GIMP_VALUES_GET_INT (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimpimageundo_pdb.c b/libgimp/gimpimageundo_pdb.c
index 254941f466..a0681f674b 100644
--- a/libgimp/gimpimageundo_pdb.c
+++ b/libgimp/gimpimageundo_pdb.c
@@ -134,7 +134,7 @@ gimp_image_undo_is_enabled (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    enabled = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    enabled = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -172,7 +172,7 @@ gimp_image_undo_disable (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    disabled = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    disabled = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -209,7 +209,7 @@ gimp_image_undo_enable (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    enabled = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    enabled = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -253,7 +253,7 @@ gimp_image_undo_freeze (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    frozen = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    frozen = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -296,7 +296,7 @@ gimp_image_undo_thaw (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    thawed = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    thawed = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpitem_pdb.c b/libgimp/gimpitem_pdb.c
index e8287ad9f0..6ed12d6ed1 100644
--- a/libgimp/gimpitem_pdb.c
+++ b/libgimp/gimpitem_pdb.c
@@ -64,7 +64,7 @@ gimp_item_id_is_valid (gint item_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    valid = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    valid = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -100,7 +100,7 @@ gimp_item_id_is_drawable (gint item_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    drawable = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    drawable = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -136,7 +136,7 @@ gimp_item_id_is_layer (gint item_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    layer = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -173,7 +173,7 @@ gimp_item_id_is_text_layer (gint item_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    text_layer = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    text_layer = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -209,7 +209,7 @@ gimp_item_id_is_channel (gint item_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    channel = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    channel = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -246,7 +246,7 @@ gimp_item_id_is_layer_mask (gint item_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    layer_mask = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -282,7 +282,7 @@ gimp_item_id_is_selection (gint item_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    selection = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    selection = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -318,7 +318,7 @@ gimp_item_id_is_vectors (gint item_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    vectors = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    vectors = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -354,7 +354,7 @@ gimp_item_get_image (GimpItem *item)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    image = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    image = GIMP_VALUES_GET_IMAGE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -430,7 +430,7 @@ gimp_item_is_group (GimpItem *item)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    group = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    group = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -466,7 +466,7 @@ gimp_item_get_parent (GimpItem *item)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    parent = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    parent = GIMP_VALUES_GET_ITEM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -510,8 +510,8 @@ _gimp_item_get_children (GimpItem *item,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_children = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      child_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+      *num_children = GIMP_VALUES_GET_INT (return_vals, 1);
+      child_ids = GIMP_VALUES_DUP_INT32_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -548,7 +548,7 @@ gimp_item_get_expanded (GimpItem *item)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    expanded = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    expanded = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -623,7 +623,7 @@ gimp_item_get_name (GimpItem *item)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -697,7 +697,7 @@ gimp_item_get_visible (GimpItem *item)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    visible = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    visible = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -771,7 +771,7 @@ gimp_item_get_linked (GimpItem *item)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    linked = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    linked = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -845,7 +845,7 @@ gimp_item_get_lock_content (GimpItem *item)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    lock_content = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    lock_content = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -919,7 +919,7 @@ gimp_item_get_lock_position (GimpItem *item)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    lock_position = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    lock_position = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -993,7 +993,7 @@ gimp_item_get_color_tag (GimpItem *item)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    color_tag = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    color_tag = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1069,7 +1069,7 @@ gimp_item_get_tattoo (GimpItem *item)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    tattoo = g_value_get_uint (gimp_value_array_index (return_vals, 1));
+    tattoo = GIMP_VALUES_GET_UINT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1226,7 +1226,7 @@ gimp_item_get_parasite (GimpItem    *item,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    parasite = g_value_dup_boxed (gimp_value_array_index (return_vals, 1));
+    parasite = GIMP_VALUES_DUP_PARASITE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1269,8 +1269,8 @@ gimp_item_get_parasite_list (GimpItem *item,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_parasites = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      parasites = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
+      *num_parasites = GIMP_VALUES_GET_INT (return_vals, 1);
+      parasites = GIMP_VALUES_DUP_STRING_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimpitemtransform_pdb.c b/libgimp/gimpitemtransform_pdb.c
index c97531f069..7dc305e949 100644
--- a/libgimp/gimpitemtransform_pdb.c
+++ b/libgimp/gimpitemtransform_pdb.c
@@ -77,7 +77,7 @@ gimp_item_transform_translate (GimpItem *item,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    ret_item = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    ret_item = GIMP_VALUES_GET_ITEM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -140,7 +140,7 @@ gimp_item_transform_flip_simple (GimpItem            *item,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    ret_item = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    ret_item = GIMP_VALUES_GET_ITEM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -206,7 +206,7 @@ gimp_item_transform_flip (GimpItem *item,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    ret_item = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    ret_item = GIMP_VALUES_GET_ITEM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -293,7 +293,7 @@ gimp_item_transform_perspective (GimpItem *item,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    ret_item = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    ret_item = GIMP_VALUES_GET_ITEM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -362,7 +362,7 @@ gimp_item_transform_rotate_simple (GimpItem         *item,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    ret_item = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    ret_item = GIMP_VALUES_GET_ITEM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -433,7 +433,7 @@ gimp_item_transform_rotate (GimpItem *item,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    ret_item = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    ret_item = GIMP_VALUES_GET_ITEM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -501,7 +501,7 @@ gimp_item_transform_scale (GimpItem *item,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    ret_item = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    ret_item = GIMP_VALUES_GET_ITEM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -565,7 +565,7 @@ gimp_item_transform_shear (GimpItem            *item,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    ret_item = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    ret_item = GIMP_VALUES_GET_ITEM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -645,7 +645,7 @@ gimp_item_transform_2d (GimpItem *item,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    ret_item = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    ret_item = GIMP_VALUES_GET_ITEM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -729,7 +729,7 @@ gimp_item_transform_matrix (GimpItem *item,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    ret_item = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    ret_item = GIMP_VALUES_GET_ITEM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimplayer_pdb.c b/libgimp/gimplayer_pdb.c
index 34c526a5be..6fe4971175 100644
--- a/libgimp/gimplayer_pdb.c
+++ b/libgimp/gimplayer_pdb.c
@@ -84,7 +84,7 @@ _gimp_layer_new (GimpImage     *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -130,7 +130,7 @@ gimp_layer_new_from_visible (GimpImage   *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -171,7 +171,7 @@ gimp_layer_new_from_drawable (GimpDrawable *drawable,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer_copy = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer_copy = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -213,7 +213,7 @@ gimp_layer_group_new (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer_group = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer_group = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -255,7 +255,7 @@ _gimp_layer_copy (GimpLayer *layer,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer_copy = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer_copy = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -556,7 +556,7 @@ gimp_layer_create_mask (GimpLayer       *layer,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    mask = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    mask = GIMP_VALUES_GET_LAYER_MASK (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -591,7 +591,7 @@ gimp_layer_get_mask (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    mask = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    mask = GIMP_VALUES_GET_LAYER_MASK (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -628,7 +628,7 @@ gimp_layer_from_mask (GimpLayerMask *mask)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -743,7 +743,7 @@ gimp_layer_is_floating_sel (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    is_floating_sel = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    is_floating_sel = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -778,7 +778,7 @@ gimp_layer_get_lock_alpha (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    lock_alpha = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    lock_alpha = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -851,7 +851,7 @@ gimp_layer_get_apply_mask (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    apply_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    apply_mask = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -927,7 +927,7 @@ gimp_layer_get_show_mask (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    show_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    show_mask = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1002,7 +1002,7 @@ gimp_layer_get_edit_mask (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    edit_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    edit_mask = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1075,7 +1075,7 @@ gimp_layer_get_opacity (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    opacity = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    opacity = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1145,7 +1145,7 @@ gimp_layer_get_mode (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    mode = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    mode = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1217,7 +1217,7 @@ gimp_layer_get_blend_space (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    blend_space = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    blend_space = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1291,7 +1291,7 @@ gimp_layer_get_composite_space (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    composite_space = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    composite_space = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1365,7 +1365,7 @@ gimp_layer_get_composite_mode (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    composite_mode = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    composite_mode = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpmessage_pdb.c b/libgimp/gimpmessage_pdb.c
index 83530aab53..efdf86c407 100644
--- a/libgimp/gimpmessage_pdb.c
+++ b/libgimp/gimpmessage_pdb.c
@@ -95,7 +95,7 @@ gimp_message_get_handler (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    handler = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    handler = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimppalette_pdb.c b/libgimp/gimppalette_pdb.c
index 7b104c4d68..4e32db3824 100644
--- a/libgimp/gimppalette_pdb.c
+++ b/libgimp/gimppalette_pdb.c
@@ -64,7 +64,7 @@ gimp_palette_new (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    actual_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    actual_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -101,7 +101,7 @@ gimp_palette_duplicate (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    copy_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    copy_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -141,7 +141,7 @@ gimp_palette_rename (const gchar *name,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    actual_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    actual_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -212,7 +212,7 @@ gimp_palette_is_editable (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    editable = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    editable = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -255,7 +255,7 @@ gimp_palette_get_info (const gchar *name,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    *num_colors = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    *num_colors = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -298,8 +298,8 @@ gimp_palette_get_colors (const gchar *name,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_colors = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      colors = gimp_value_dup_rgb_array (gimp_value_array_index (return_vals, 2));
+      *num_colors = GIMP_VALUES_GET_INT (return_vals, 1);
+      colors = GIMP_VALUES_DUP_RGB_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -337,7 +337,7 @@ gimp_palette_get_columns (const gchar *name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    num_columns = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    num_columns = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -426,7 +426,7 @@ gimp_palette_add_entry (const gchar   *name,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    *entry_num = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    *entry_num = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -510,7 +510,7 @@ gimp_palette_entry_get_color (const gchar *name,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    gimp_value_get_rgb (gimp_value_array_index (return_vals, 1), &*color);
+    GIMP_VALUES_GET_RGB (return_vals, 1, &*color);
 
   gimp_value_array_unref (return_vals);
 
@@ -600,7 +600,7 @@ gimp_palette_entry_get_name (const gchar  *name,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    *entry_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    *entry_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimppalettes_pdb.c b/libgimp/gimppalettes_pdb.c
index 182d55fe3a..a949154753 100644
--- a/libgimp/gimppalettes_pdb.c
+++ b/libgimp/gimppalettes_pdb.c
@@ -102,8 +102,8 @@ gimp_palettes_get_list (const gchar *filter,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_palettes = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      palette_list = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
+      *num_palettes = GIMP_VALUES_GET_INT (return_vals, 1);
+      palette_list = GIMP_VALUES_DUP_STRING_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimppattern_pdb.c b/libgimp/gimppattern_pdb.c
index 807958d63d..e2b81c0b4f 100644
--- a/libgimp/gimppattern_pdb.c
+++ b/libgimp/gimppattern_pdb.c
@@ -77,9 +77,9 @@ gimp_pattern_get_info (const gchar *name,
 
   if (success)
     {
-      *width = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *height = g_value_get_int (gimp_value_array_index (return_vals, 2));
-      *bpp = g_value_get_int (gimp_value_array_index (return_vals, 3));
+      *width = GIMP_VALUES_GET_INT (return_vals, 1);
+      *height = GIMP_VALUES_GET_INT (return_vals, 2);
+      *bpp = GIMP_VALUES_GET_INT (return_vals, 3);
     }
 
   gimp_value_array_unref (return_vals);
@@ -137,11 +137,11 @@ gimp_pattern_get_pixels (const gchar  *name,
 
   if (success)
     {
-      *width = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *height = g_value_get_int (gimp_value_array_index (return_vals, 2));
-      *bpp = g_value_get_int (gimp_value_array_index (return_vals, 3));
-      *num_color_bytes = g_value_get_int (gimp_value_array_index (return_vals, 4));
-      *color_bytes = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 5));
+      *width = GIMP_VALUES_GET_INT (return_vals, 1);
+      *height = GIMP_VALUES_GET_INT (return_vals, 2);
+      *bpp = GIMP_VALUES_GET_INT (return_vals, 3);
+      *num_color_bytes = GIMP_VALUES_GET_INT (return_vals, 4);
+      *color_bytes = GIMP_VALUES_DUP_UINT8_ARRAY (return_vals, 5);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimppatterns_pdb.c b/libgimp/gimppatterns_pdb.c
index f2a6996bb5..fcca94d2bb 100644
--- a/libgimp/gimppatterns_pdb.c
+++ b/libgimp/gimppatterns_pdb.c
@@ -102,8 +102,8 @@ gimp_patterns_get_list (const gchar *filter,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_patterns = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      pattern_list = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
+      *num_patterns = GIMP_VALUES_GET_INT (return_vals, 1);
+      pattern_list = GIMP_VALUES_DUP_STRING_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimppdb_pdb.c b/libgimp/gimppdb_pdb.c
index 7ea26eaa99..0549eb641a 100644
--- a/libgimp/gimppdb_pdb.c
+++ b/libgimp/gimppdb_pdb.c
@@ -52,7 +52,7 @@ _gimp_pdb_temp_name (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    temp_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    temp_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -161,8 +161,8 @@ _gimp_pdb_query (const gchar   *name,
 
   if (success)
     {
-      *num_matches = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *procedure_names = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
+      *num_matches = GIMP_VALUES_GET_INT (return_vals, 1);
+      *procedure_names = GIMP_VALUES_DUP_STRING_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -200,7 +200,7 @@ _gimp_pdb_proc_exists (const gchar *procedure_name)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    exists = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    exists = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -252,9 +252,9 @@ _gimp_pdb_proc_info (const gchar     *procedure_name,
 
   if (success)
     {
-      *proc_type = g_value_get_enum (gimp_value_array_index (return_vals, 1));
-      *num_args = g_value_get_int (gimp_value_array_index (return_vals, 2));
-      *num_values = g_value_get_int (gimp_value_array_index (return_vals, 3));
+      *proc_type = GIMP_VALUES_GET_ENUM (return_vals, 1);
+      *num_args = GIMP_VALUES_GET_INT (return_vals, 2);
+      *num_values = GIMP_VALUES_GET_INT (return_vals, 3);
     }
 
   gimp_value_array_unref (return_vals);
@@ -306,9 +306,9 @@ _gimp_pdb_proc_documentation (const gchar  *procedure_name,
 
   if (success)
     {
-      *blurb = g_value_dup_string (gimp_value_array_index (return_vals, 1));
-      *help = g_value_dup_string (gimp_value_array_index (return_vals, 2));
-      *help_id = g_value_dup_string (gimp_value_array_index (return_vals, 3));
+      *blurb = GIMP_VALUES_DUP_STRING (return_vals, 1);
+      *help = GIMP_VALUES_DUP_STRING (return_vals, 2);
+      *help_id = GIMP_VALUES_DUP_STRING (return_vals, 3);
     }
 
   gimp_value_array_unref (return_vals);
@@ -360,9 +360,9 @@ _gimp_pdb_proc_attribution (const gchar  *procedure_name,
 
   if (success)
     {
-      *authors = g_value_dup_string (gimp_value_array_index (return_vals, 1));
-      *copyright = g_value_dup_string (gimp_value_array_index (return_vals, 2));
-      *date = g_value_dup_string (gimp_value_array_index (return_vals, 3));
+      *authors = GIMP_VALUES_DUP_STRING (return_vals, 1);
+      *copyright = GIMP_VALUES_DUP_STRING (return_vals, 2);
+      *date = GIMP_VALUES_DUP_STRING (return_vals, 3);
     }
 
   gimp_value_array_unref (return_vals);
@@ -404,7 +404,7 @@ _gimp_pdb_proc_argument (const gchar *procedure_name,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    param_spec = g_value_dup_param (gimp_value_array_index (return_vals, 1));
+    param_spec = GIMP_VALUES_DUP_PARAM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -446,7 +446,7 @@ _gimp_pdb_proc_return_value (const gchar *procedure_name,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    param_spec = g_value_dup_param (gimp_value_array_index (return_vals, 1));
+    param_spec = GIMP_VALUES_DUP_PARAM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -493,8 +493,8 @@ _gimp_pdb_get_data (const gchar  *identifier,
 
   if (success)
     {
-      *bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *data = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 2));
+      *bytes = GIMP_VALUES_GET_INT (return_vals, 1);
+      *data = GIMP_VALUES_DUP_UINT8_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -531,7 +531,7 @@ _gimp_pdb_get_data_size (const gchar *identifier)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    bytes = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpplugin_pdb.c b/libgimp/gimpplugin_pdb.c
index ec53155599..fb2a99da76 100644
--- a/libgimp/gimpplugin_pdb.c
+++ b/libgimp/gimpplugin_pdb.c
@@ -304,7 +304,7 @@ _gimp_plugin_get_pdb_error_handler (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    handler = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    handler = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpprogress_pdb.c b/libgimp/gimpprogress_pdb.c
index 325a5e85bc..d96f3fa98d 100644
--- a/libgimp/gimpprogress_pdb.c
+++ b/libgimp/gimpprogress_pdb.c
@@ -243,7 +243,7 @@ gimp_progress_get_window_handle (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    window = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    window = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpselection_pdb.c b/libgimp/gimpselection_pdb.c
index fac3a43029..6e64a93b66 100644
--- a/libgimp/gimpselection_pdb.c
+++ b/libgimp/gimpselection_pdb.c
@@ -87,11 +87,11 @@ gimp_selection_bounds (GimpImage *image,
 
   if (success)
     {
-      *non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
-      *x1 = g_value_get_int (gimp_value_array_index (return_vals, 2));
-      *y1 = g_value_get_int (gimp_value_array_index (return_vals, 3));
-      *x2 = g_value_get_int (gimp_value_array_index (return_vals, 4));
-      *y2 = g_value_get_int (gimp_value_array_index (return_vals, 5));
+      *non_empty = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
+      *x1 = GIMP_VALUES_GET_INT (return_vals, 2);
+      *y1 = GIMP_VALUES_GET_INT (return_vals, 3);
+      *x2 = GIMP_VALUES_GET_INT (return_vals, 4);
+      *y2 = GIMP_VALUES_GET_INT (return_vals, 5);
     }
 
   gimp_value_array_unref (return_vals);
@@ -133,7 +133,7 @@ gimp_selection_value (GimpImage *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    value = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    value = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -168,7 +168,7 @@ gimp_selection_is_empty (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    is_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    is_empty = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -256,7 +256,7 @@ _gimp_selection_float (GimpDrawable *drawable,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -618,7 +618,7 @@ gimp_selection_save (GimpImage *image)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    channel = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    channel = GIMP_VALUES_GET_CHANNEL (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimptextlayer_pdb.c b/libgimp/gimptextlayer_pdb.c
index f2e59435ae..daab2b838f 100644
--- a/libgimp/gimptextlayer_pdb.c
+++ b/libgimp/gimptextlayer_pdb.c
@@ -80,7 +80,7 @@ gimp_text_layer_new (GimpImage   *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    layer = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -117,7 +117,7 @@ gimp_text_layer_get_text (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    text = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    text = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -197,7 +197,7 @@ gimp_text_layer_get_markup (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    markup = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    markup = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -235,7 +235,7 @@ gimp_text_layer_get_font (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    font = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    font = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -314,8 +314,8 @@ gimp_text_layer_get_font_size (GimpLayer *layer,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      font_size = g_value_get_double (gimp_value_array_index (return_vals, 1));
-      *unit = g_value_get_int (gimp_value_array_index (return_vals, 2));
+      font_size = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
+      *unit = GIMP_VALUES_GET_INT (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -395,7 +395,7 @@ gimp_text_layer_get_antialias (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    antialias = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    antialias = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -472,7 +472,7 @@ gimp_text_layer_get_hint_style (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    style = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    style = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -549,7 +549,7 @@ gimp_text_layer_get_kerning (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    kerning = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    kerning = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -625,7 +625,7 @@ gimp_text_layer_get_language (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    language = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    language = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -701,7 +701,7 @@ gimp_text_layer_get_base_direction (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    direction = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    direction = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -777,7 +777,7 @@ gimp_text_layer_get_justification (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    justify = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+    justify = GIMP_VALUES_GET_ENUM (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -856,7 +856,7 @@ gimp_text_layer_get_color (GimpLayer *layer,
   success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
 
   if (success)
-    gimp_value_get_rgb (gimp_value_array_index (return_vals, 1), &*color);
+    GIMP_VALUES_GET_RGB (return_vals, 1, &*color);
 
   gimp_value_array_unref (return_vals);
 
@@ -931,7 +931,7 @@ gimp_text_layer_get_indent (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    indent = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    indent = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1007,7 +1007,7 @@ gimp_text_layer_get_line_spacing (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    line_spacing = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    line_spacing = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1083,7 +1083,7 @@ gimp_text_layer_get_letter_spacing (GimpLayer *layer)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    letter_spacing = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    letter_spacing = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimptexttool_pdb.c b/libgimp/gimptexttool_pdb.c
index 3cb17f3f89..a15cc6f395 100644
--- a/libgimp/gimptexttool_pdb.c
+++ b/libgimp/gimptexttool_pdb.c
@@ -102,7 +102,7 @@ gimp_text_fontname (GimpImage    *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    text_layer = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    text_layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -167,10 +167,10 @@ gimp_text_get_extents_fontname (const gchar  *text,
 
   if (success)
     {
-      *width = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *height = g_value_get_int (gimp_value_array_index (return_vals, 2));
-      *ascent = g_value_get_int (gimp_value_array_index (return_vals, 3));
-      *descent = g_value_get_int (gimp_value_array_index (return_vals, 4));
+      *width = GIMP_VALUES_GET_INT (return_vals, 1);
+      *height = GIMP_VALUES_GET_INT (return_vals, 2);
+      *ascent = GIMP_VALUES_GET_INT (return_vals, 3);
+      *descent = GIMP_VALUES_GET_INT (return_vals, 4);
     }
 
   gimp_value_array_unref (return_vals);
diff --git a/libgimp/gimpunit_pdb.c b/libgimp/gimpunit_pdb.c
index a283415e00..684faf043c 100644
--- a/libgimp/gimpunit_pdb.c
+++ b/libgimp/gimpunit_pdb.c
@@ -50,7 +50,7 @@ _gimp_unit_get_number_of_units (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    num_units = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    num_units = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -82,7 +82,7 @@ _gimp_unit_get_number_of_built_in_units (void)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    num_units = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    num_units = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -137,7 +137,7 @@ _gimp_unit_new (const gchar *identifier,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    unit_id = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    unit_id = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -173,7 +173,7 @@ _gimp_unit_get_deletion_flag (GimpUnit unit_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    deletion_flag = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+    deletion_flag = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -248,7 +248,7 @@ _gimp_unit_get_identifier (GimpUnit unit_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    identifier = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    identifier = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -284,7 +284,7 @@ _gimp_unit_get_factor (GimpUnit unit_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    factor = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    factor = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -321,7 +321,7 @@ _gimp_unit_get_digits (GimpUnit unit_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    digits = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    digits = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -356,7 +356,7 @@ _gimp_unit_get_symbol (GimpUnit unit_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    symbol = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    symbol = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -392,7 +392,7 @@ _gimp_unit_get_abbreviation (GimpUnit unit_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    abbreviation = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    abbreviation = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -427,7 +427,7 @@ _gimp_unit_get_singular (GimpUnit unit_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    singular = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    singular = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -462,7 +462,7 @@ _gimp_unit_get_plural (GimpUnit unit_id)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    plural = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    plural = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/libgimp/gimpvectors_pdb.c b/libgimp/gimpvectors_pdb.c
index 53a0954427..9d1c341ed0 100644
--- a/libgimp/gimpvectors_pdb.c
+++ b/libgimp/gimpvectors_pdb.c
@@ -68,7 +68,7 @@ gimp_vectors_new (GimpImage   *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    vectors = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    vectors = GIMP_VALUES_GET_VECTORS (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -108,7 +108,7 @@ gimp_vectors_new_from_text_layer (GimpImage *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    vectors = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    vectors = GIMP_VALUES_GET_VECTORS (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -145,7 +145,7 @@ gimp_vectors_copy (GimpVectors *vectors)
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    vectors_copy = g_value_get_object (gimp_value_array_index (return_vals, 1));
+    vectors_copy = GIMP_VALUES_GET_VECTORS (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -189,8 +189,8 @@ gimp_vectors_get_strokes (GimpVectors *vectors,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_strokes = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      stroke_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+      *num_strokes = GIMP_VALUES_GET_INT (return_vals, 1);
+      stroke_ids = GIMP_VALUES_DUP_INT32_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -233,7 +233,7 @@ gimp_vectors_stroke_get_length (GimpVectors *vectors,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    length = g_value_get_double (gimp_value_array_index (return_vals, 1));
+    length = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -299,10 +299,10 @@ gimp_vectors_stroke_get_point_at_dist (GimpVectors *vectors,
 
   if (success)
     {
-      *x_point = g_value_get_double (gimp_value_array_index (return_vals, 1));
-      *y_point = g_value_get_double (gimp_value_array_index (return_vals, 2));
-      *slope = g_value_get_double (gimp_value_array_index (return_vals, 3));
-      *valid = g_value_get_boolean (gimp_value_array_index (return_vals, 4));
+      *x_point = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
+      *y_point = GIMP_VALUES_GET_DOUBLE (return_vals, 2);
+      *slope = GIMP_VALUES_GET_DOUBLE (return_vals, 3);
+      *valid = GIMP_VALUES_GET_BOOLEAN (return_vals, 4);
     }
 
   gimp_value_array_unref (return_vals);
@@ -661,10 +661,10 @@ gimp_vectors_stroke_get_points (GimpVectors  *vectors,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      type = g_value_get_enum (gimp_value_array_index (return_vals, 1));
-      *num_points = g_value_get_int (gimp_value_array_index (return_vals, 2));
-      *controlpoints = gimp_value_dup_float_array (gimp_value_array_index (return_vals, 3));
-      *closed = g_value_get_boolean (gimp_value_array_index (return_vals, 4));
+      type = GIMP_VALUES_GET_ENUM (return_vals, 1);
+      *num_points = GIMP_VALUES_GET_INT (return_vals, 2);
+      *controlpoints = GIMP_VALUES_DUP_FLOAT_ARRAY (return_vals, 3);
+      *closed = GIMP_VALUES_GET_BOOLEAN (return_vals, 4);
     }
 
   gimp_value_array_unref (return_vals);
@@ -721,7 +721,7 @@ gimp_vectors_stroke_new_from_points (GimpVectors           *vectors,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    stroke_id = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    stroke_id = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -772,9 +772,9 @@ gimp_vectors_stroke_interpolate (GimpVectors *vectors,
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
     {
-      *num_coords = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      coords = gimp_value_dup_float_array (gimp_value_array_index (return_vals, 2));
-      *closed = g_value_get_boolean (gimp_value_array_index (return_vals, 3));
+      *num_coords = GIMP_VALUES_GET_INT (return_vals, 1);
+      coords = GIMP_VALUES_DUP_FLOAT_ARRAY (return_vals, 2);
+      *closed = GIMP_VALUES_GET_BOOLEAN (return_vals, 3);
     }
 
   gimp_value_array_unref (return_vals);
@@ -817,7 +817,7 @@ gimp_vectors_bezier_stroke_new_moveto (GimpVectors *vectors,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    stroke_id = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    stroke_id = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1020,7 +1020,7 @@ gimp_vectors_bezier_stroke_new_ellipse (GimpVectors *vectors,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    stroke_id = g_value_get_int (gimp_value_array_index (return_vals, 1));
+    stroke_id = GIMP_VALUES_GET_INT (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
@@ -1076,8 +1076,8 @@ gimp_vectors_import_from_file (GimpImage    *image,
 
   if (success)
     {
-      *num_vectors = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *vectors_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+      *num_vectors = GIMP_VALUES_GET_INT (return_vals, 1);
+      *vectors_ids = GIMP_VALUES_DUP_INT32_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -1138,8 +1138,8 @@ gimp_vectors_import_from_string (GimpImage    *image,
 
   if (success)
     {
-      *num_vectors = g_value_get_int (gimp_value_array_index (return_vals, 1));
-      *vectors_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+      *num_vectors = GIMP_VALUES_GET_INT (return_vals, 1);
+      *vectors_ids = GIMP_VALUES_DUP_INT32_ARRAY (return_vals, 2);
     }
 
   gimp_value_array_unref (return_vals);
@@ -1228,7 +1228,7 @@ gimp_vectors_export_to_string (GimpImage   *image,
   gimp_value_array_unref (args);
 
   if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
-    string = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+    string = GIMP_VALUES_DUP_STRING (return_vals, 1);
 
   gimp_value_array_unref (return_vals);
 
diff --git a/pdb/lib.pl b/pdb/lib.pl
index 37646e3528..fc8c91d9d7 100644
--- a/pdb/lib.pl
+++ b/pdb/lib.pl
@@ -392,7 +392,7 @@ CODE
             $var = exists $_->{retval} ? "" : '*';
             $var .= $_->{libname};
 
-            $value = "gimp_value_array_index (return_vals, $argc)";
+            $value = "return_vals, $argc";
 
             $return_marshal .= ' ' x 2 if $#outargs;
             $return_marshal .= eval qq/"    $arg->{dup_value_func};\n"/;
diff --git a/pdb/pdb.pl b/pdb/pdb.pl
index fb754abfc3..de0affbf4e 100644
--- a/pdb/pdb.pl
+++ b/pdb/pdb.pl
@@ -23,7 +23,7 @@ package Gimp::CodeGen::pdb;
                     const_type      => 'gint ',
                     init_value      => '0',
                     get_value_func  => '$var = g_value_get_int ($value)',
-                    dup_value_func  => '$var = g_value_get_int ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_INT ($value)',
                     set_value_func  => 'g_value_set_int ($value, $var)',
                     take_value_func => 'g_value_set_int ($value, $var)' },
 
@@ -33,7 +33,7 @@ package Gimp::CodeGen::pdb;
                     const_type      => 'guchar ',
                     init_value      => '0',
                     get_value_func  => '$var = g_value_get_uchar ($value)',
-                    dup_value_func  => '$var = g_value_get_uchar ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_UVHAR ($value)',
                     set_value_func  => 'g_value_set_uchar ($value, $var)',
                     take_value_func => 'g_value_set_uchar ($value, $var)' },
 
@@ -43,7 +43,7 @@ package Gimp::CodeGen::pdb;
                     const_type      => 'gdouble ',
                     init_value      => '0.0',
                     get_value_func  => '$var = g_value_get_double ($value)',
-                    dup_value_func  => '$var = g_value_get_double ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_DOUBLE ($value)',
                     set_value_func  => 'g_value_set_double ($value, $var)',
                     take_value_func => 'g_value_set_double ($value, $var)' },
 
@@ -54,7 +54,7 @@ package Gimp::CodeGen::pdb;
                     init_value      => 'NULL',
                     out_annotate    => '(transfer full)',
                     get_value_func  => '$var = g_value_get_string ($value)',
-                    dup_value_func  => '$var = g_value_dup_string ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_DUP_STRING ($value)',
                     set_value_func  => 'g_value_set_string ($value, $var)',
                     take_value_func => 'g_value_take_string ($value, $var)' },
 
@@ -67,7 +67,7 @@ package Gimp::CodeGen::pdb;
                     in_annotate     => '(element-type gint32)',
                     out_annotate    => '(element-type gint32) (transfer full)',
                     get_value_func  => '$var = gimp_value_get_int32_array ($value)',
-                    dup_value_func  => '$var = gimp_value_dup_int32_array ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_DUP_INT32_ARRAY ($value)',
                     set_value_func  => 'gimp_value_set_int32_array ($value, $var, $var_len)',
                     take_value_func => 'gimp_value_take_int32_array ($value, $var, $var_len)' },
 
@@ -80,7 +80,7 @@ package Gimp::CodeGen::pdb;
                     in_annotate     => '(element-type gint16)',
                     out_annotate    => '(element-type gint16) (transfer full)',
                     get_value_func  => '$var = gimp_value_get_int16_array ($value)',
-                    dup_value_func  => '$var = gimp_value_dup_int16_array ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_DUP_INT16_ARRAY ($value)',
                     set_value_func  => 'gimp_value_set_int16_array ($value, $var, $var_len)',
                     take_value_func => 'gimp_value_take_int16_array ($value, $var, $var_len)' },
 
@@ -93,7 +93,7 @@ package Gimp::CodeGen::pdb;
                     in_annotate     => '(element-type guint8)',
                     out_annotate    => '(element-type guint8) (transfer full)',
                     get_value_func  => '$var = gimp_value_get_uint8_array ($value)',
-                    dup_value_func  => '$var = gimp_value_dup_uint8_array ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_DUP_UINT8_ARRAY ($value)',
                     set_value_func  => 'gimp_value_set_uint8_array ($value, $var, $var_len)',
                     take_value_func => 'gimp_value_take_uint8_array ($value, $var, $var_len)' },
 
@@ -106,7 +106,7 @@ package Gimp::CodeGen::pdb;
                     in_annotate     => '(element-type gdouble)',
                     out_annotate    => '(element-type gdouble) (transfer full)',
                     get_value_func  => '$var = gimp_value_get_float_array ($value)',
-                    dup_value_func  => '$var = gimp_value_dup_float_array ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_DUP_FLOAT_ARRAY ($value)',
                     set_value_func  => 'gimp_value_set_float_array ($value, $var, $var_len)',
                     take_value_func => 'gimp_value_take_float_array ($value, $var, $var_len)' },
 
@@ -119,7 +119,7 @@ package Gimp::CodeGen::pdb;
                     in_annotate     => '(element-type gchar*)',
                     out_annotate    => '(element-type gchar*) (transfer full)',
                     get_value_func  => '$var = gimp_value_get_string_array ($value)',
-                    dup_value_func  => '$var = gimp_value_dup_string_array ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_DUP_STRING_ARRAY ($value)',
                     set_value_func  => 'gimp_value_set_string_array ($value, $var, $var_len)',
                     take_value_func => 'gimp_value_take_string_array ($value, $var, $var_len)' },
 
@@ -132,7 +132,7 @@ package Gimp::CodeGen::pdb;
                     in_annotate     => '(element-type GimpRGB)',
                     out_annotate    => '(element-type GimpRGB) (transfer full)',
                     get_value_func  => '$var = gimp_value_get_rgb_array ($value)',
-                    dup_value_func  => '$var = gimp_value_dup_rgb_array ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_DUP_RGB_ARRAY ($value)',
                     set_value_func  => 'gimp_value_set_rgb_array ($value, $var, $var_len)',
                     take_value_func => 'gimp_value_take_rgb_array ($value, $var, $var_len)' },
 
@@ -143,7 +143,7 @@ package Gimp::CodeGen::pdb;
                     struct          => 1,
                     init_value      => '{ 0.0, 0.0, 0.0, 1.0 }',
                     get_value_func  => 'gimp_value_get_rgb ($value, &$var)',
-                    dup_value_func  => 'gimp_value_get_rgb ($value, &$var)',
+                    dup_value_func  => 'GIMP_VALUES_GET_RGB ($value, &$var)',
                     set_value_func  => 'gimp_value_set_rgb ($value, $var)',
                     take_value_func => 'gimp_value_set_rgb ($value, &$var)',
                     headers         => [ qw(<cairo.h> "libgimpcolor/gimpcolor.h") ] },
@@ -157,7 +157,7 @@ package Gimp::CodeGen::pdb;
                     init_value      => 'NULL',
                     out_annotate    => '(transfer none)',
                     get_value_func  => '$var = g_value_get_object ($value)',
-                    dup_value_func  => '$var = g_value_get_object ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_DISPLAY ($value)',
                     set_value_func  => 'g_value_set_object ($value, $var)',
                     take_value_func => 'g_value_set_object ($value, $var)' },
 
@@ -168,7 +168,7 @@ package Gimp::CodeGen::pdb;
                     init_value      => 'NULL',
                     out_annotate    => '(transfer none)',
                     get_value_func  => '$var = g_value_get_object ($value)',
-                    dup_value_func  => '$var = g_value_get_object ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_IMAGE ($value)',
                     set_value_func  => 'g_value_set_object ($value, $var)',
                     take_value_func => 'g_value_set_object ($value, $var)',
                     headers         => [ qw("core/gimpimage.h") ] },
@@ -180,7 +180,7 @@ package Gimp::CodeGen::pdb;
                     init_value      => 'NULL',
                     out_annotate    => '(transfer none)',
                     get_value_func  => '$var = g_value_get_object ($value)',
-                    dup_value_func  => '$var = g_value_get_object ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_ITEM ($value)',
                     set_value_func  => 'g_value_set_object ($value, $var)',
                     take_value_func => 'g_value_set_object ($value, $var)',
                     headers         => [ qw("core/gimpitem.h") ] },
@@ -192,7 +192,7 @@ package Gimp::CodeGen::pdb;
                     init_value      => 'NULL',
                     out_annotate    => '(transfer none)',
                     get_value_func  => '$var = g_value_get_object ($value)',
-                    dup_value_func  => '$var = g_value_get_object ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_LAYER ($value)',
                     set_value_func  => 'g_value_set_object ($value, $var)',
                     take_value_func => 'g_value_set_object ($value, $var)',
                     headers         => [ qw("core/gimplayer.h") ] },
@@ -204,7 +204,7 @@ package Gimp::CodeGen::pdb;
                     init_value      => 'NULL',
                     out_annotate    => '(transfer none)',
                     get_value_func  => '$var = g_value_get_object ($value)',
-                    dup_value_func  => '$var = g_value_get_object ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_CHANNEL ($value)',
                     set_value_func  => 'g_value_set_object ($value, $var)',
                     take_value_func => 'g_value_set_object ($value, $var)',
                     headers         => [ qw("core/gimpchannel.h") ] },
@@ -216,7 +216,7 @@ package Gimp::CodeGen::pdb;
                     init_value      => 'NULL',
                     out_annotate    => '(transfer none)',
                     get_value_func  => '$var = g_value_get_object ($value)',
-                    dup_value_func  => '$var = g_value_get_object ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_DRAWABLE ($value)',
                     set_value_func  => 'g_value_set_object ($value, $var)',
                     take_value_func => 'g_value_set_object ($value, $var)',
                     headers         => [ qw("core/gimpdrawable.h") ] },
@@ -228,7 +228,7 @@ package Gimp::CodeGen::pdb;
                     init_value      => 'NULL',
                     out_annotate    => '(transfer none)',
                     get_value_func  => '$var = g_value_get_object ($value)',
-                    dup_value_func  => '$var = g_value_get_object ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_SELECTION ($value)',
                     set_value_func  => 'g_value_set_object ($value, $var)',
                     take_value_func => 'g_value_set_object ($value, $var)',
                     headers         => [ qw("core/gimpselection.h") ] },
@@ -240,7 +240,7 @@ package Gimp::CodeGen::pdb;
                     init_value      => 'NULL',
                     out_annotate    => '(transfer none)',
                     get_value_func  => '$var = g_value_get_object ($value)',
-                    dup_value_func  => '$var = g_value_get_object ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_LAYER_MASK ($value)',
                     set_value_func  => 'g_value_set_object ($value, $var)',
                     take_value_func => 'g_value_set_object ($value, $var)',
                     headers         => [ qw("core/gimplayermask.h") ] },
@@ -252,7 +252,7 @@ package Gimp::CodeGen::pdb;
                     init_value      => 'NULL',
                     out_annotate    => '(transfer none)',
                     get_value_func  => '$var = g_value_get_object ($value)',
-                    dup_value_func  => '$var = g_value_get_object ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_VECTORS ($value)',
                     set_value_func  => 'g_value_set_object ($value, $var)',
                     take_value_func => 'g_value_set_object ($value, $var)',
                     headers         => [ qw("vectors/gimpvectors.h") ] },
@@ -264,7 +264,7 @@ package Gimp::CodeGen::pdb;
                     init_value      => 'NULL',
                     out_annotate    => '(transfer full)',
                     get_value_func  => '$var = g_value_get_boxed ($value)',
-                    dup_value_func  => '$var = g_value_dup_boxed ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_DUP_PARASITE ($value)',
                     set_value_func  => 'g_value_set_boxed ($value, $var)',
                     take_value_func => 'g_value_take_boxed ($value, $var)',
                     headers         => [ qw("libgimpbase/gimpbase.h") ] },
@@ -276,7 +276,7 @@ package Gimp::CodeGen::pdb;
                     init_value      => 'NULL',
                     out_annotate    => '(transfer full)',
                     get_value_func  => '$var = g_value_get_param ($value)',
-                    dup_value_func  => '$var = g_value_dup_param ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_DUP_PARAM ($value)',
                     set_value_func  => 'g_value_set_param ($value, $var)',
                     take_value_func => 'g_value_take_param ($value, $var)' },
 
@@ -287,7 +287,7 @@ package Gimp::CodeGen::pdb;
                     const_type      => 'gint ',
                     init_value      => '0',
                     get_value_func  => '$var = g_value_get_enum ($value)',
-                    dup_value_func  => '$var = g_value_get_enum ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_ENUM ($value)',
                     set_value_func  => 'g_value_set_enum ($value, $var)',
                     take_value_func => 'g_value_set_enum ($value, $var)' },
 
@@ -297,7 +297,7 @@ package Gimp::CodeGen::pdb;
                     const_type      => 'gboolean ',
                     init_value      => 'FALSE',
                     get_value_func  => '$var = g_value_get_boolean ($value)',
-                    dup_value_func  => '$var = g_value_get_boolean ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_BOOLEAN ($value)',
                     set_value_func  => 'g_value_set_boolean ($value, $var)',
                     take_value_func => 'g_value_set_boolean ($value, $var)' },
 
@@ -307,7 +307,7 @@ package Gimp::CodeGen::pdb;
                     const_type      => 'guint ',
                     init_value      => '0',
                     get_value_func  => '$var = g_value_get_uint ($value)',
-                    dup_value_func  => '$var = g_value_get_uint ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_UINT ($value)',
                     set_value_func  => 'g_value_set_uint ($value, $var)',
                     take_value_func => 'g_value_set_uint ($value, $var)' },
 
@@ -317,7 +317,7 @@ package Gimp::CodeGen::pdb;
                     const_type      => 'guint ',
                     init_value      => '0',
                     get_value_func  => '$var = g_value_get_uint ($value)',
-                    dup_value_func  => '$var = g_value_get_uint ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_UINT ($value)',
                     set_value_func  => 'g_value_set_uint ($value, $var)',
                     take_value_func => 'g_value_set_uint ($value, $var)' },
 
@@ -327,7 +327,7 @@ package Gimp::CodeGen::pdb;
                     const_type      => 'guint ',
                     init_value      => '0',
                     get_value_func  => '$var = g_value_get_uint ($value)',
-                    dup_value_func  => '$var = g_value_get_uint ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_UINT ($value)',
                     set_value_func  => 'g_value_set_uint ($value, $var)',
                     take_value_func => 'g_value_set_uint ($value, $var)' },
 
@@ -338,7 +338,7 @@ package Gimp::CodeGen::pdb;
                     init_value      => 'GIMP_UNIT_PIXEL',
                     out_annotate    => '(transfer none)',
                     get_value_func  => '$var = g_value_get_int ($value)',
-                    dup_value_func  => '$var = g_value_get_int ($value)',
+                    dup_value_func  => '$var = GIMP_VALUES_GET_INT ($value)',
                     set_value_func  => 'g_value_set_int ($value, $var)',
                     take_value_func => 'g_value_set_int ($value, $var)' }
 );


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