[gimp] app, pdb: prevent custom gradient from being renamed



commit bccef43049bb6f5cec0d9e8adecbe756c4349ee2
Author: Ell <ell_se yahoo com>
Date:   Mon Oct 30 17:06:31 2017 -0400

    app, pdb: prevent custom gradient from being renamed
    
    Make internal data objects non-renamable, even if they're writable,
    through gimp_data_is_name_editable().  Currently, the only such
    object is the custom gradient.
    
    Prevent changing the name of non-renamable data by making the name
    entry of GimpDataEditor non-editable whenever
    gimp_viewable_is_name_editable() is FALSE, even if the data is
    otherwise editable.
    
    Prevent the vairous PDB -rename() functions from renaming non-
    renamable data, by adding a GimpPDBDataAccess flags type,
    specifying the desired access mode for the data -- any combination
    of READ, WRITE, and RENAME -- and replacing the 'writable'
    parameter of the gimp_pdb_get_foo() functions with an 'access'
    parameter.  Change the various .pdb files to use READ where they'd
    used FALSE, and WRITE where they'd used TRUE; use RENAME, isntead
    of WRITE, in the -rename() functions.

 app/core/gimpdata.c           |    3 +-
 app/pdb/brush-cmds.c          |   42 +++++++++---------
 app/pdb/context-cmds.c        |    4 +-
 app/pdb/gimppdb-utils.c       |  100 ++++++++++++++++++++++++++++------------
 app/pdb/gimppdb-utils.h       |   12 +++---
 app/pdb/gradient-cmds.c       |   44 +++++++++---------
 app/pdb/palette-cmds.c        |   28 ++++++------
 app/pdb/pdb-types.h           |    8 +++
 app/widgets/gimpdataeditor.c  |    6 ++-
 tools/pdbgen/pdb/brush.pdb    |   42 +++++++++---------
 tools/pdbgen/pdb/context.pdb  |    4 +-
 tools/pdbgen/pdb/gradient.pdb |   44 +++++++++---------
 tools/pdbgen/pdb/palette.pdb  |   28 ++++++------
 13 files changed, 209 insertions(+), 156 deletions(-)
---
diff --git a/app/core/gimpdata.c b/app/core/gimpdata.c
index c7c8cb3..4f124fd 100644
--- a/app/core/gimpdata.c
+++ b/app/core/gimpdata.c
@@ -370,7 +370,8 @@ gimp_data_get_memsize (GimpObject *object,
 static gboolean
 gimp_data_is_name_editable (GimpViewable *viewable)
 {
-  return gimp_data_is_writable (GIMP_DATA (viewable));
+  return gimp_data_is_writable (GIMP_DATA (viewable)) &&
+         ! gimp_data_is_internal (GIMP_DATA (viewable));
 }
 
 static void
diff --git a/app/pdb/brush-cmds.c b/app/pdb/brush-cmds.c
index dcbe629..bc4ee2c 100644
--- a/app/pdb/brush-cmds.c
+++ b/app/pdb/brush-cmds.c
@@ -95,7 +95,7 @@ brush_duplicate_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (brush)
         {
@@ -138,7 +138,7 @@ brush_is_generated_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (brush)
         generated = GIMP_IS_BRUSH_GENERATED (brush);
@@ -174,7 +174,7 @@ brush_rename_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, TRUE, error);
+      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_RENAME, error);
 
       if (brush)
         {
@@ -209,7 +209,7 @@ brush_delete_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (brush && gimp_data_is_deletable (GIMP_DATA (brush)))
         success = gimp_data_factory_data_delete (gimp->brush_factory,
@@ -240,7 +240,7 @@ brush_is_editable_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (brush)
         editable = gimp_data_is_writable (GIMP_DATA (brush));
@@ -277,7 +277,7 @@ brush_get_info_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (brush)
         {
@@ -331,7 +331,7 @@ brush_get_pixels_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (brush)
         {
@@ -395,7 +395,7 @@ brush_get_spacing_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (brush)
         spacing = gimp_brush_get_spacing (brush);
@@ -429,7 +429,7 @@ brush_set_spacing_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, TRUE, error);
+      GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
       if (brush)
         gimp_brush_set_spacing (brush, spacing);
@@ -458,7 +458,7 @@ brush_get_shape_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
+      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (brush)
         shape = GIMP_BRUSH_GENERATED (brush)->shape;
@@ -494,7 +494,7 @@ brush_set_shape_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
+      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
       if (brush)
         {
@@ -532,7 +532,7 @@ brush_get_radius_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
+      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (brush)
         radius = GIMP_BRUSH_GENERATED (brush)->radius;
@@ -568,7 +568,7 @@ brush_set_radius_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
+      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
       if (brush)
         {
@@ -606,7 +606,7 @@ brush_get_spikes_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
+      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (brush)
         spikes = GIMP_BRUSH_GENERATED (brush)->spikes;
@@ -642,7 +642,7 @@ brush_set_spikes_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
+      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
       if (brush)
         {
@@ -680,7 +680,7 @@ brush_get_hardness_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
+      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (brush)
         hardness = GIMP_BRUSH_GENERATED (brush)->hardness;
@@ -716,7 +716,7 @@ brush_set_hardness_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
+      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
       if (brush)
         {
@@ -754,7 +754,7 @@ brush_get_aspect_ratio_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
+      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (brush)
         aspect_ratio = GIMP_BRUSH_GENERATED (brush)->aspect_ratio;
@@ -790,7 +790,7 @@ brush_set_aspect_ratio_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
+      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
       if (brush)
         {
@@ -828,7 +828,7 @@ brush_get_angle_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
+      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (brush)
         angle = GIMP_BRUSH_GENERATED (brush)->angle;
@@ -864,7 +864,7 @@ brush_set_angle_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
+      GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
       if (brush)
         {
diff --git a/app/pdb/context-cmds.c b/app/pdb/context-cmds.c
index 89b25dd..dfc83f4 100644
--- a/app/pdb/context-cmds.c
+++ b/app/pdb/context-cmds.c
@@ -1384,7 +1384,7 @@ context_set_dynamics_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpDynamics *dynamics = gimp_pdb_get_dynamics (gimp, name, FALSE, error);
+      GimpDynamics *dynamics = gimp_pdb_get_dynamics (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (dynamics)
         gimp_context_set_dynamics (context, dynamics);
@@ -1439,7 +1439,7 @@ context_set_mypaint_brush_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpMybrush *brush = gimp_pdb_get_mybrush (gimp, name, FALSE, error);
+      GimpMybrush *brush = gimp_pdb_get_mybrush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (brush)
         gimp_context_set_mybrush (context, brush);
diff --git a/app/pdb/gimppdb-utils.c b/app/pdb/gimppdb-utils.c
index 59083ea..d5f8e34 100644
--- a/app/pdb/gimppdb-utils.c
+++ b/app/pdb/gimppdb-utils.c
@@ -60,10 +60,10 @@ gimp_pdb_get_data_factory_item (GimpDataFactory *data_factory,
 
 
 GimpBrush *
-gimp_pdb_get_brush (Gimp         *gimp,
-                    const gchar  *name,
-                    gboolean      writable,
-                    GError      **error)
+gimp_pdb_get_brush (Gimp               *gimp,
+                    const gchar        *name,
+                    GimpPDBDataAccess   access,
+                    GError            **error)
 {
   GimpBrush *brush;
 
@@ -84,28 +84,36 @@ gimp_pdb_get_brush (Gimp         *gimp,
       g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                    _("Brush '%s' not found"), name);
     }
-  else if (writable && ! gimp_data_is_writable (GIMP_DATA (brush)))
+  else if ((access & GIMP_PDB_DATA_ACCESS_WRITE) &&
+           ! gimp_data_is_writable (GIMP_DATA (brush)))
     {
       g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                    _("Brush '%s' is not editable"), name);
       return NULL;
     }
+  else if ((access & GIMP_PDB_DATA_ACCESS_RENAME) &&
+           ! gimp_viewable_is_name_editable (GIMP_VIEWABLE (brush)))
+    {
+      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+                   _("Brush '%s' is not renamable"), name);
+      return NULL;
+    }
 
   return brush;
 }
 
 GimpBrush *
-gimp_pdb_get_generated_brush (Gimp         *gimp,
-                              const gchar  *name,
-                              gboolean      writable,
-                              GError      **error)
+gimp_pdb_get_generated_brush (Gimp               *gimp,
+                              const gchar        *name,
+                              GimpPDBDataAccess   access,
+                              GError            **error)
 {
   GimpBrush *brush;
 
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
   g_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
-  brush = gimp_pdb_get_brush (gimp, name, writable, error);
+  brush = gimp_pdb_get_brush (gimp, name, access, error);
 
   if (! brush)
     return NULL;
@@ -121,10 +129,10 @@ gimp_pdb_get_generated_brush (Gimp         *gimp,
 }
 
 GimpDynamics *
-gimp_pdb_get_dynamics (Gimp         *gimp,
-                       const gchar  *name,
-                       gboolean      writable,
-                       GError      **error)
+gimp_pdb_get_dynamics (Gimp               *gimp,
+                       const gchar        *name,
+                       GimpPDBDataAccess   access,
+                       GError            **error)
 {
   GimpDynamics *dynamics;
 
@@ -145,21 +153,29 @@ gimp_pdb_get_dynamics (Gimp         *gimp,
       g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                    _("Paint dynamics '%s' not found"), name);
     }
-  else if (writable && ! gimp_data_is_writable (GIMP_DATA (dynamics)))
+  else if ((access & GIMP_PDB_DATA_ACCESS_WRITE) &&
+           ! gimp_data_is_writable (GIMP_DATA (dynamics)))
     {
       g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                    _("Paint dynamics '%s' is not editable"), name);
       return NULL;
     }
+  else if ((access & GIMP_PDB_DATA_ACCESS_RENAME) &&
+           ! gimp_viewable_is_name_editable (GIMP_VIEWABLE (dynamics)))
+    {
+      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+                   _("Paint dynamics '%s' is not renamable"), name);
+      return NULL;
+    }
 
   return dynamics;
 }
 
 GimpMybrush *
-gimp_pdb_get_mybrush (Gimp         *gimp,
-                      const gchar  *name,
-                      gboolean      writable,
-                      GError      **error)
+gimp_pdb_get_mybrush (Gimp               *gimp,
+                      const gchar        *name,
+                      GimpPDBDataAccess   access,
+                      GError            **error)
 {
   GimpMybrush *brush;
 
@@ -180,12 +196,20 @@ gimp_pdb_get_mybrush (Gimp         *gimp,
       g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                    _("MyPaint brush '%s' not found"), name);
     }
-  else if (writable && ! gimp_data_is_writable (GIMP_DATA (brush)))
+  else if ((access & GIMP_PDB_DATA_ACCESS_WRITE) &&
+           ! gimp_data_is_writable (GIMP_DATA (brush)))
     {
       g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                    _("MyPaint brush '%s' is not editable"), name);
       return NULL;
     }
+  else if ((access & GIMP_PDB_DATA_ACCESS_RENAME) &&
+           ! gimp_viewable_is_name_editable (GIMP_VIEWABLE (brush)))
+    {
+      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+                   _("MyPaint brush '%s' is not renamable"), name);
+      return NULL;
+    }
 
   return brush;
 }
@@ -219,10 +243,10 @@ gimp_pdb_get_pattern (Gimp         *gimp,
 }
 
 GimpGradient *
-gimp_pdb_get_gradient (Gimp         *gimp,
-                       const gchar  *name,
-                       gboolean      writable,
-                       GError      **error)
+gimp_pdb_get_gradient (Gimp               *gimp,
+                       const gchar        *name,
+                       GimpPDBDataAccess   access,
+                       GError            **error)
 {
   GimpGradient *gradient;
 
@@ -243,21 +267,29 @@ gimp_pdb_get_gradient (Gimp         *gimp,
       g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                    _("Gradient '%s' not found"), name);
     }
-  else if (writable && ! gimp_data_is_writable (GIMP_DATA (gradient)))
+  else if ((access & GIMP_PDB_DATA_ACCESS_WRITE) &&
+           ! gimp_data_is_writable (GIMP_DATA (gradient)))
     {
       g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                    _("Gradient '%s' is not editable"), name);
       return NULL;
     }
+  else if ((access & GIMP_PDB_DATA_ACCESS_RENAME) &&
+           ! gimp_viewable_is_name_editable (GIMP_VIEWABLE (gradient)))
+    {
+      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+                   _("Gradient '%s' is not renamable"), name);
+      return NULL;
+    }
 
   return gradient;
 }
 
 GimpPalette *
-gimp_pdb_get_palette (Gimp         *gimp,
-                      const gchar  *name,
-                      gboolean      writable,
-                      GError      **error)
+gimp_pdb_get_palette (Gimp               *gimp,
+                      const gchar        *name,
+                      GimpPDBDataAccess   access,
+                      GError            **error)
 {
   GimpPalette *palette;
 
@@ -278,12 +310,20 @@ gimp_pdb_get_palette (Gimp         *gimp,
       g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                    _("Palette '%s' not found"), name);
     }
-  else if (writable && ! gimp_data_is_writable (GIMP_DATA (palette)))
+  else if ((access & GIMP_PDB_DATA_ACCESS_WRITE) &&
+           ! gimp_data_is_writable (GIMP_DATA (palette)))
     {
       g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                    _("Palette '%s' is not editable"), name);
       return NULL;
     }
+  else if ((access & GIMP_PDB_DATA_ACCESS_RENAME) &&
+           ! gimp_viewable_is_name_editable (GIMP_VIEWABLE (palette)))
+    {
+      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+                   _("Palette '%s' is not renamable"), name);
+      return NULL;
+    }
 
   return palette;
 }
diff --git a/app/pdb/gimppdb-utils.h b/app/pdb/gimppdb-utils.h
index d12c00a..c287644 100644
--- a/app/pdb/gimppdb-utils.h
+++ b/app/pdb/gimppdb-utils.h
@@ -21,30 +21,30 @@
 
 GimpBrush     * gimp_pdb_get_brush              (Gimp               *gimp,
                                                  const gchar        *name,
-                                                 gboolean            writable,
+                                                 GimpPDBDataAccess   access,
                                                  GError            **error);
 GimpBrush     * gimp_pdb_get_generated_brush    (Gimp               *gimp,
                                                  const gchar        *name,
-                                                 gboolean            writable,
+                                                 GimpPDBDataAccess   access,
                                                  GError            **error);
 GimpDynamics  * gimp_pdb_get_dynamics           (Gimp               *gimp,
                                                  const gchar        *name,
-                                                 gboolean            writable,
+                                                 GimpPDBDataAccess   access,
                                                  GError            **error);
 GimpMybrush   * gimp_pdb_get_mybrush            (Gimp               *gimp,
                                                  const gchar        *name,
-                                                 gboolean            writable,
+                                                 GimpPDBDataAccess   access,
                                                  GError            **error);
 GimpPattern   * gimp_pdb_get_pattern            (Gimp               *gimp,
                                                  const gchar        *name,
                                                  GError            **error);
 GimpGradient  * gimp_pdb_get_gradient           (Gimp               *gimp,
                                                  const gchar        *name,
-                                                 gboolean            writable,
+                                                 GimpPDBDataAccess   access,
                                                  GError            **error);
 GimpPalette   * gimp_pdb_get_palette            (Gimp               *gimp,
                                                  const gchar        *name,
-                                                 gboolean            writable,
+                                                 GimpPDBDataAccess   access,
                                                  GError            **error);
 GimpFont      * gimp_pdb_get_font               (Gimp               *gimp,
                                                  const gchar        *name,
diff --git a/app/pdb/gradient-cmds.c b/app/pdb/gradient-cmds.c
index 0db5999..cfce30d 100644
--- a/app/pdb/gradient-cmds.c
+++ b/app/pdb/gradient-cmds.c
@@ -47,12 +47,12 @@
 static GimpGradient *
 gradient_get (Gimp                 *gimp,
               const gchar          *name,
-              gboolean              writable,
+              GimpPDBDataAccess     access,
               gint                  segment,
               GimpGradientSegment **seg,
               GError              **error)
 {
-  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, writable, error);
+  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, access, error);
 
   *seg = NULL;
 
@@ -71,7 +71,7 @@ gradient_get_range (Gimp                 *gimp,
                     GimpGradientSegment **end_seg,
                     GError              **error)
 {
-  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, TRUE, error);
+  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
   *start_seg = NULL;
   *end_seg   = NULL;
@@ -145,7 +145,7 @@ gradient_duplicate_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
+      GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (gradient)
         {
@@ -188,7 +188,7 @@ gradient_is_editable_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
+      GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (gradient)
         editable = gimp_data_is_writable (GIMP_DATA (gradient));
@@ -224,7 +224,7 @@ gradient_rename_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, TRUE, error);
+      GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_RENAME, error);
 
       if (gradient)
         {
@@ -259,7 +259,7 @@ gradient_delete_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
+      GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (gradient && gimp_data_is_deletable (GIMP_DATA (gradient)))
         success = gimp_data_factory_data_delete (gimp->gradient_factory,
@@ -293,7 +293,7 @@ gradient_get_number_of_segments_invoker (GimpProcedure         *procedure,
       GimpGradient        *gradient;
       GimpGradientSegment *seg;
 
-      gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
+      gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (gradient)
         {
@@ -335,7 +335,7 @@ gradient_get_uniform_samples_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
+      GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (gradient)
         {
@@ -403,7 +403,7 @@ gradient_get_custom_samples_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
+      GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (gradient)
         {
@@ -469,7 +469,7 @@ gradient_segment_get_left_color_invoker (GimpProcedure         *procedure,
       GimpGradient        *gradient;
       GimpGradientSegment *seg;
 
-      gradient = gradient_get (gimp, name, FALSE, segment, &seg, error);
+      gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
 
       if (seg)
         {
@@ -516,7 +516,7 @@ gradient_segment_set_left_color_invoker (GimpProcedure         *procedure,
       GimpGradient        *gradient;
       GimpGradientSegment *seg;
 
-      gradient = gradient_get (gimp, name, TRUE, segment, &seg, error);
+      gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
 
       if (seg)
         {
@@ -554,7 +554,7 @@ gradient_segment_get_right_color_invoker (GimpProcedure         *procedure,
       GimpGradient        *gradient;
       GimpGradientSegment *seg;
 
-      gradient = gradient_get (gimp, name, FALSE, segment, &seg, error);
+      gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
 
       if (seg)
         {
@@ -601,7 +601,7 @@ gradient_segment_set_right_color_invoker (GimpProcedure         *procedure,
       GimpGradient        *gradient;
       GimpGradientSegment *seg;
 
-      gradient = gradient_get (gimp, name, TRUE, segment, &seg, error);
+      gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
 
       if (seg)
         {
@@ -638,7 +638,7 @@ gradient_segment_get_left_pos_invoker (GimpProcedure         *procedure,
       GimpGradient        *gradient;
       GimpGradientSegment *seg;
 
-      gradient = gradient_get (gimp, name, FALSE, segment, &seg, error);
+      gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
 
       if (seg)
         {
@@ -681,7 +681,7 @@ gradient_segment_set_left_pos_invoker (GimpProcedure         *procedure,
       GimpGradient        *gradient;
       GimpGradientSegment *seg;
 
-      gradient = gradient_get (gimp, name, TRUE, segment, &seg, error);
+      gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
 
       if (seg)
         {
@@ -722,7 +722,7 @@ gradient_segment_get_middle_pos_invoker (GimpProcedure         *procedure,
       GimpGradient        *gradient;
       GimpGradientSegment *seg;
 
-      gradient = gradient_get (gimp, name, FALSE, segment, &seg, error);
+      gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
 
       if (seg)
         {
@@ -765,7 +765,7 @@ gradient_segment_set_middle_pos_invoker (GimpProcedure         *procedure,
       GimpGradient        *gradient;
       GimpGradientSegment *seg;
 
-      gradient = gradient_get (gimp, name, TRUE, segment, &seg, error);
+      gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
 
       if (seg)
         {
@@ -807,7 +807,7 @@ gradient_segment_get_right_pos_invoker (GimpProcedure         *procedure,
       GimpGradient        *gradient;
       GimpGradientSegment *seg;
 
-      gradient = gradient_get (gimp, name, FALSE, segment, &seg, error);
+      gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
 
       if (seg)
         {
@@ -850,7 +850,7 @@ gradient_segment_set_right_pos_invoker (GimpProcedure         *procedure,
       GimpGradient        *gradient;
       GimpGradientSegment *seg;
 
-      gradient = gradient_get (gimp, name, TRUE, segment, &seg, error);
+      gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
 
       if (seg)
         {
@@ -892,7 +892,7 @@ gradient_segment_get_blending_function_invoker (GimpProcedure         *procedure
       GimpGradient        *gradient;
       GimpGradientSegment *seg;
 
-      gradient = gradient_get (gimp, name, FALSE, segment, &seg, error);
+      gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
 
       if (seg)
         {
@@ -933,7 +933,7 @@ gradient_segment_get_coloring_type_invoker (GimpProcedure         *procedure,
       GimpGradient        *gradient;
       GimpGradientSegment *seg;
 
-      gradient = gradient_get (gimp, name, FALSE, segment, &seg, error);
+      gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
 
       if (seg)
         {
diff --git a/app/pdb/palette-cmds.c b/app/pdb/palette-cmds.c
index f5add2f..6268cb5 100644
--- a/app/pdb/palette-cmds.c
+++ b/app/pdb/palette-cmds.c
@@ -96,7 +96,7 @@ palette_duplicate_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (palette)
         {
@@ -141,7 +141,7 @@ palette_rename_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, TRUE, error);
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_RENAME, error);
 
       if (palette)
         {
@@ -176,7 +176,7 @@ palette_delete_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (palette && gimp_data_is_deletable (GIMP_DATA (palette)))
         success = gimp_data_factory_data_delete (gimp->palette_factory,
@@ -207,7 +207,7 @@ palette_is_editable_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (palette)
         editable = gimp_data_is_writable (GIMP_DATA (palette));
@@ -241,7 +241,7 @@ palette_get_info_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (palette)
         num_colors = gimp_palette_get_n_colors (palette);
@@ -276,7 +276,7 @@ palette_get_colors_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (palette)
         {
@@ -326,7 +326,7 @@ palette_get_columns_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (palette)
         num_columns = gimp_palette_get_columns (palette);
@@ -360,7 +360,7 @@ palette_set_columns_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, TRUE, error);
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
       if (palette)
         gimp_palette_set_columns (palette, columns);
@@ -393,7 +393,7 @@ palette_add_entry_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, TRUE, error);
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
       if (palette)
         {
@@ -432,7 +432,7 @@ palette_delete_entry_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, TRUE, error);
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
       if (palette)
         {
@@ -470,7 +470,7 @@ palette_entry_get_color_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (palette)
         {
@@ -513,7 +513,7 @@ palette_entry_set_color_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, TRUE, error);
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
       if (palette)
         success = gimp_palette_set_entry_color (palette, entry_num, &color);
@@ -544,7 +544,7 @@ palette_entry_get_name_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
       if (palette)
         {
@@ -587,7 +587,7 @@ palette_entry_set_name_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, TRUE, error);
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
       if (palette)
         success = gimp_palette_set_entry_name (palette, entry_num, entry_name);
diff --git a/app/pdb/pdb-types.h b/app/pdb/pdb-types.h
index e5a5529..3da77bf 100644
--- a/app/pdb/pdb-types.h
+++ b/app/pdb/pdb-types.h
@@ -43,4 +43,12 @@ typedef enum
 } GimpPDBItemModify;
 
 
+typedef enum
+{
+  GIMP_PDB_DATA_ACCESS_READ   = 0,
+  GIMP_PDB_DATA_ACCESS_WRITE  = 1 << 0,
+  GIMP_PDB_DATA_ACCESS_RENAME = 1 << 1
+} GimpPDBDataAccess;
+
+
 #endif /* __PDB_TYPES_H__ */
diff --git a/app/widgets/gimpdataeditor.c b/app/widgets/gimpdataeditor.c
index dce5c85..cd5edaf 100644
--- a/app/widgets/gimpdataeditor.c
+++ b/app/widgets/gimpdataeditor.c
@@ -454,9 +454,13 @@ gimp_data_editor_real_set_data (GimpDataEditor *editor,
     {
       editor->data_editable = editable;
 
-      gtk_editable_set_editable (GTK_EDITABLE (editor->name_entry), editable);
       gimp_docked_title_changed (GIMP_DOCKED (editor));
     }
+
+  gtk_editable_set_editable (
+    GTK_EDITABLE (editor->name_entry),
+    editable &&
+    gimp_viewable_is_name_editable (GIMP_VIEWABLE (editor->data)));
 }
 
 void
diff --git a/tools/pdbgen/pdb/brush.pdb b/tools/pdbgen/pdb/brush.pdb
index 92d0b42..4fe01e1 100644
--- a/tools/pdbgen/pdb/brush.pdb
+++ b/tools/pdbgen/pdb/brush.pdb
@@ -66,7 +66,7 @@ sub brush_duplicate {
     %invoke = (
         code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (brush)
     {
@@ -105,7 +105,7 @@ sub brush_is_generated {
     %invoke = (
         code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (brush)
     generated = GIMP_IS_BRUSH_GENERATED (brush);
@@ -135,7 +135,7 @@ sub brush_is_editable {
     %invoke = (
         code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (brush)
     editable = gimp_data_is_writable (GIMP_DATA (brush));
@@ -167,7 +167,7 @@ sub brush_rename {
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, TRUE, error);
+  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_RENAME, error);
 
   if (brush)
     {
@@ -195,7 +195,7 @@ sub brush_delete {
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (brush && gimp_data_is_deletable (GIMP_DATA (brush)))
     success = gimp_data_factory_data_delete (gimp->brush_factory,
@@ -237,7 +237,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (brush)
     {
@@ -291,7 +291,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (brush)
     {
@@ -347,7 +347,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (brush)
     spacing = gimp_brush_get_spacing (brush);
@@ -385,7 +385,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
+  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (brush)
     shape = GIMP_BRUSH_GENERATED (brush)->shape;
@@ -419,7 +419,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
+  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (brush)
     radius = GIMP_BRUSH_GENERATED (brush)->radius;
@@ -453,7 +453,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
+  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (brush)
     spikes = GIMP_BRUSH_GENERATED (brush)->spikes;
@@ -490,7 +490,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
+  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (brush)
     hardness = GIMP_BRUSH_GENERATED (brush)->hardness;
@@ -525,7 +525,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
+  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (brush)
     aspect_ratio = GIMP_BRUSH_GENERATED (brush)->aspect_ratio;
@@ -559,7 +559,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
+  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (brush)
     angle = GIMP_BRUSH_GENERATED (brush)->angle;
@@ -590,7 +590,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, TRUE, error);
+  GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
   if (brush)
     gimp_brush_set_spacing (brush, spacing);
@@ -630,7 +630,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
+  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
   if (brush)
     {
@@ -670,7 +670,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
+  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
   if (brush)
     {
@@ -710,7 +710,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
+  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
   if (brush)
     {
@@ -751,7 +751,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
+  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
   if (brush)
     {
@@ -792,7 +792,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
+  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
   if (brush)
     {
@@ -832,7 +832,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
+  GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
   if (brush)
     {
diff --git a/tools/pdbgen/pdb/context.pdb b/tools/pdbgen/pdb/context.pdb
index 290e591..ef4c4e0 100644
--- a/tools/pdbgen/pdb/context.pdb
+++ b/tools/pdbgen/pdb/context.pdb
@@ -1498,7 +1498,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpDynamics *dynamics = gimp_pdb_get_dynamics (gimp, name, FALSE, error);
+  GimpDynamics *dynamics = gimp_pdb_get_dynamics (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (dynamics)
     gimp_context_set_dynamics (context, dynamics);
@@ -1559,7 +1559,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpMybrush *brush = gimp_pdb_get_mybrush (gimp, name, FALSE, error);
+  GimpMybrush *brush = gimp_pdb_get_mybrush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (brush)
     gimp_context_set_mybrush (context, brush);
diff --git a/tools/pdbgen/pdb/gradient.pdb b/tools/pdbgen/pdb/gradient.pdb
index 56c591c..303c9f5 100644
--- a/tools/pdbgen/pdb/gradient.pdb
+++ b/tools/pdbgen/pdb/gradient.pdb
@@ -64,7 +64,7 @@ sub gradient_duplicate {
     %invoke = (
         code => <<'CODE'
 {
-  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
+  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (gradient)
     {
@@ -103,7 +103,7 @@ sub gradient_is_editable {
     %invoke = (
         code => <<'CODE'
 {
-  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
+  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (gradient)
     editable = gimp_data_is_writable (GIMP_DATA (gradient));
@@ -135,7 +135,7 @@ sub gradient_rename {
     %invoke = (
        code => <<'CODE'
 {
-  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, TRUE, error);
+  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_RENAME, error);
 
   if (gradient)
     {
@@ -163,7 +163,7 @@ sub gradient_delete {
     %invoke = (
        code => <<'CODE'
 {
-  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
+  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (gradient && gimp_data_is_deletable (GIMP_DATA (gradient)))
     success = gimp_data_factory_data_delete (gimp->gradient_factory,
@@ -204,7 +204,7 @@ HELP
   GimpGradient        *gradient;
   GimpGradientSegment *seg;
 
-  gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
+  gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (gradient)
     {
@@ -251,7 +251,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
+  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (gradient)
     {
@@ -321,7 +321,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
+  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (gradient)
     {
@@ -385,7 +385,7 @@ HELP
   GimpGradient        *gradient;
   GimpGradientSegment *seg;
 
-  gradient = gradient_get (gimp, name, FALSE, segment, &seg, error);
+  gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
 
   if (seg)
     {
@@ -429,7 +429,7 @@ HELP
   GimpGradient        *gradient;
   GimpGradientSegment *seg;
 
-  gradient = gradient_get (gimp, name, FALSE, segment, &seg, error);
+  gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
 
   if (seg)
     {
@@ -470,7 +470,7 @@ HELP
   GimpGradient        *gradient;
   GimpGradientSegment *seg;
 
-  gradient = gradient_get (gimp, name, TRUE, segment, &seg, error);
+  gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
 
   if (seg)
     {
@@ -511,7 +511,7 @@ HELP
   GimpGradient        *gradient;
   GimpGradientSegment *seg;
 
-  gradient = gradient_get (gimp, name, TRUE, segment, &seg, error);
+  gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
 
   if (seg)
     {
@@ -553,7 +553,7 @@ HELP
   GimpGradient        *gradient;
   GimpGradientSegment *seg;
 
-  gradient = gradient_get (gimp, name, FALSE, segment, &seg, error);
+  gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
 
   if (seg)
     {
@@ -594,7 +594,7 @@ HELP
   GimpGradient        *gradient;
   GimpGradientSegment *seg;
 
-  gradient = gradient_get (gimp, name, FALSE, segment, &seg, error);
+  gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
 
   if (seg)
     {
@@ -635,7 +635,7 @@ HELP
   GimpGradient        *gradient;
   GimpGradientSegment *seg;
 
-  gradient = gradient_get (gimp, name, FALSE, segment, &seg, error);
+  gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
 
   if (seg)
     {
@@ -682,7 +682,7 @@ HELP
   GimpGradient        *gradient;
   GimpGradientSegment *seg;
 
-  gradient = gradient_get (gimp, name, TRUE, segment, &seg, error);
+  gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
 
   if (seg)
     {
@@ -729,7 +729,7 @@ HELP
   GimpGradient        *gradient;
   GimpGradientSegment *seg;
 
-  gradient = gradient_get (gimp, name, TRUE, segment, &seg, error);
+  gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
 
   if (seg)
     {
@@ -776,7 +776,7 @@ HELP
   GimpGradient        *gradient;
   GimpGradientSegment *seg;
 
-  gradient = gradient_get (gimp, name, TRUE, segment, &seg, error);
+  gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
 
   if (seg)
     {
@@ -819,7 +819,7 @@ HELP
   GimpGradient        *gradient;
   GimpGradientSegment *seg;
 
-  gradient = gradient_get (gimp, name, FALSE, segment, &seg, error);
+  gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
 
   if (seg)
     {
@@ -861,7 +861,7 @@ HELP
   GimpGradient        *gradient;
   GimpGradientSegment *seg;
 
-  gradient = gradient_get (gimp, name, FALSE, segment, &seg, error);
+  gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
 
   if (seg)
     {
@@ -1375,12 +1375,12 @@ $extra{app}->{code} = <<'CODE';
 static GimpGradient *
 gradient_get (Gimp                 *gimp,
               const gchar          *name,
-              gboolean              writable,
+              GimpPDBDataAccess     access,
               gint                  segment,
               GimpGradientSegment **seg,
               GError              **error)
 {
-  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, writable, error);
+  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, access, error);
 
   *seg = NULL;
 
@@ -1399,7 +1399,7 @@ gradient_get_range (Gimp                 *gimp,
                     GimpGradientSegment **end_seg,
                     GError              **error)
 {
-  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, TRUE, error);
+  GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
   *start_seg = NULL;
   *end_seg   = NULL;
diff --git a/tools/pdbgen/pdb/palette.pdb b/tools/pdbgen/pdb/palette.pdb
index 4ef5ea2..da5dc4c 100644
--- a/tools/pdbgen/pdb/palette.pdb
+++ b/tools/pdbgen/pdb/palette.pdb
@@ -66,7 +66,7 @@ sub palette_is_editable {
     %invoke = (
         code => <<'CODE'
 {
-  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (palette)
     editable = gimp_data_is_writable (GIMP_DATA (palette));
@@ -96,7 +96,7 @@ sub palette_duplicate {
     %invoke = (
         code => <<'CODE'
 {
-  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (palette)
     {
@@ -137,7 +137,7 @@ sub palette_rename {
     %invoke = (
        code => <<'CODE'
 {
-  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, TRUE, error);
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_RENAME, error);
 
   if (palette)
     {
@@ -165,7 +165,7 @@ sub palette_delete {
     %invoke = (
        code => <<'CODE'
 {
-  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (palette && gimp_data_is_deletable (GIMP_DATA (palette)))
     success = gimp_data_factory_data_delete (gimp->palette_factory,
@@ -201,7 +201,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (palette)
     num_colors = gimp_palette_get_n_colors (palette);
@@ -237,7 +237,7 @@ HELP
        vars => [ 'GimpPalette *palette = NULL' ],
        code => <<'CODE'
 {
-  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (palette)
     {
@@ -283,7 +283,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (palette)
     num_columns = gimp_palette_get_columns (palette);
@@ -314,7 +314,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, TRUE, error);
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
   if (palette)
     gimp_palette_set_columns (palette, columns);
@@ -352,7 +352,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, TRUE, error);
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
   if (palette)
     {
@@ -388,7 +388,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, TRUE, error);
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
   if (palette)
     {
@@ -431,7 +431,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (palette)
     {
@@ -471,7 +471,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, TRUE, error);
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
   if (palette)
     success = gimp_palette_set_entry_color (palette, entry_num, &color);
@@ -507,7 +507,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
 
   if (palette)
     {
@@ -547,7 +547,7 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, TRUE, error);
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
 
   if (palette)
     success = gimp_palette_set_entry_name (palette, entry_num, entry_name);


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