[gimp] libgimp: rename the newly added item parasite functions



commit 7faaf4df4118de870c1938d5f50a9c44e9d50d5a
Author: Michael Natterer <mitch gimp org>
Date:   Tue Mar 1 22:19:48 2011 +0100

    libgimp: rename the newly added item parasite functions
    
    gimp-item-find-parasite -> gimp-item-get-parasite
    gimp-item-list-parasites -> gimp-item-get-parasite-list
    
    Also changed the signature of gimp-item-get-parasite-list's C wrapper
    in libgimp to be sane.

 app/pdb/gimp-pdb-compat.c          |    8 ++--
 app/pdb/item-cmds.c                |   40 +++++++++---------
 libgimp/gimpdrawable.c             |    8 ++-
 libgimp/gimpitem_pdb.c             |   35 +++++++---------
 libgimp/gimpitem_pdb.h             |   75 ++++++++++++++++++------------------
 libgimp/gimpvectors.c              |    8 ++-
 plug-ins/gfig/gfig-dialog.c        |    2 +-
 plug-ins/gfig/gfig.c               |    2 +-
 plug-ins/ifs-compose/ifs-compose.c |    4 +-
 tools/pdbgen/pdb/item.pdb          |   10 ++--
 10 files changed, 95 insertions(+), 97 deletions(-)
---
diff --git a/app/pdb/gimp-pdb-compat.c b/app/pdb/gimp-pdb-compat.c
index 5e30764..4b174d6 100644
--- a/app/pdb/gimp-pdb-compat.c
+++ b/app/pdb/gimp-pdb-compat.c
@@ -441,10 +441,10 @@ gimp_pdb_compat_procs_register (GimpPDB           *pdb,
     { "gimp-drawable-set-linked",           "gimp-item-set-linked"            },
     { "gimp-drawable-get-tattoo",           "gimp-item-get-tattoo"            },
     { "gimp-drawable-set-tattoo",           "gimp-item-set-tattoo"            },
-    { "gimp-drawable-parasite-find",        "gimp-item-find-parasite"         },
+    { "gimp-drawable-parasite-find",        "gimp-item-get-parasite"          },
     { "gimp-drawable-parasite-attach",      "gimp-item-attach-parasite"       },
     { "gimp-drawable-parasite-detach",      "gimp-item-detach-parasite"       },
-    { "gimp-drawable-parasite-list",        "gimp-item-list-parasites"        },
+    { "gimp-drawable-parasite-list",        "gimp-item-get-parasite-list"     },
     { "gimp-image-get-layer-position",      "gimp-image-get-item-position"    },
     { "gimp-image-raise-layer",             "gimp-image-raise-item"           },
     { "gimp-image-lower-layer",             "gimp-image-lower-item"           },
@@ -468,10 +468,10 @@ gimp_pdb_compat_procs_register (GimpPDB           *pdb,
     { "gimp-vectors-set-linked",            "gimp-item-set-linked"            },
     { "gimp-vectors-get-tattoo",            "gimp-item-get-tattoo"            },
     { "gimp-vectors-set-tattoo",            "gimp-item-set-tattoo"            },
-    { "gimp-vectors-parasite-find",         "gimp-item-find-parasite"         },
+    { "gimp-vectors-parasite-find",         "gimp-item-get-parasite"          },
     { "gimp-vectors-parasite-attach",       "gimp-item-attach-parasite"       },
     { "gimp-vectors-parasite-detach",       "gimp-item-detach-parasite"       },
-    { "gimp-vectors-parasite-list",         "gimp-item-list-parasites"        }
+    { "gimp-vectors-parasite-list",         "gimp-item-get-parasite-list"     }
   };
 
   g_return_if_fail (GIMP_IS_PDB (pdb));
diff --git a/app/pdb/item-cmds.c b/app/pdb/item-cmds.c
index 7c090c3..4a2438a 100644
--- a/app/pdb/item-cmds.c
+++ b/app/pdb/item-cmds.c
@@ -757,12 +757,12 @@ item_detach_parasite_invoker (GimpProcedure      *procedure,
 }
 
 static GValueArray *
-item_find_parasite_invoker (GimpProcedure      *procedure,
-                            Gimp               *gimp,
-                            GimpContext        *context,
-                            GimpProgress       *progress,
-                            const GValueArray  *args,
-                            GError            **error)
+item_get_parasite_invoker (GimpProcedure      *procedure,
+                           Gimp               *gimp,
+                           GimpContext        *context,
+                           GimpProgress       *progress,
+                           const GValueArray  *args,
+                           GError            **error)
 {
   gboolean success = TRUE;
   GValueArray *return_vals;
@@ -791,12 +791,12 @@ item_find_parasite_invoker (GimpProcedure      *procedure,
 }
 
 static GValueArray *
-item_list_parasites_invoker (GimpProcedure      *procedure,
-                             Gimp               *gimp,
-                             GimpContext        *context,
-                             GimpProgress       *progress,
-                             const GValueArray  *args,
-                             GError            **error)
+item_get_parasite_list_invoker (GimpProcedure      *procedure,
+                                Gimp               *gimp,
+                                GimpContext        *context,
+                                GimpProgress       *progress,
+                                const GValueArray  *args,
+                                GError            **error)
 {
   gboolean success = TRUE;
   GValueArray *return_vals;
@@ -1555,13 +1555,13 @@ register_item_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
-   * gimp-item-find-parasite
+   * gimp-item-get-parasite
    */
-  procedure = gimp_procedure_new (item_find_parasite_invoker);
+  procedure = gimp_procedure_new (item_get_parasite_invoker);
   gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-item-find-parasite");
+                               "gimp-item-get-parasite");
   gimp_procedure_set_static_strings (procedure,
-                                     "gimp-item-find-parasite",
+                                     "gimp-item-get-parasite",
                                      "Look up a parasite in an item",
                                      "Finds and returns the parasite that is attached to an item.",
                                      "Jay Cox",
@@ -1590,13 +1590,13 @@ register_item_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
-   * gimp-item-list-parasites
+   * gimp-item-get-parasite-list
    */
-  procedure = gimp_procedure_new (item_list_parasites_invoker);
+  procedure = gimp_procedure_new (item_get_parasite_list_invoker);
   gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-item-list-parasites");
+                               "gimp-item-get-parasite-list");
   gimp_procedure_set_static_strings (procedure,
-                                     "gimp-item-list-parasites",
+                                     "gimp-item-get-parasite-list",
                                      "List all parasites.",
                                      "Returns a list of all parasites currently attached the an item.",
                                      "Marc Lehmann",
diff --git a/libgimp/gimpdrawable.c b/libgimp/gimpdrawable.c
index ebe71a7..32482e0 100644
--- a/libgimp/gimpdrawable.c
+++ b/libgimp/gimpdrawable.c
@@ -548,7 +548,7 @@ gimp_drawable_set_tattoo (gint32 drawable_ID,
  * @drawable_ID: The drawable.
  * @name: The name of the parasite to find.
  *
- * Deprecated: Use gimp_item_find_parasite() instead.
+ * Deprecated: Use gimp_item_get_parasite() instead.
  *
  * Returns: The found parasite.
  **/
@@ -556,7 +556,7 @@ GimpParasite *
 gimp_drawable_parasite_find (gint32       drawable_ID,
                              const gchar *name)
 {
-  return gimp_item_find_parasite (drawable_ID, name);
+  return gimp_item_get_parasite (drawable_ID, name);
 }
 
 /**
@@ -606,7 +606,9 @@ gimp_drawable_parasite_list (gint32    drawable_ID,
                              gint     *num_parasites,
                              gchar  ***parasites)
 {
-  return gimp_item_list_parasites (drawable_ID, num_parasites, parasites);
+  *parasites = gimp_item_get_parasite_list (drawable_ID, num_parasites);
+
+  return *parasites != NULL;
 }
 
 /**
diff --git a/libgimp/gimpitem_pdb.c b/libgimp/gimpitem_pdb.c
index aab7bc7..6f8b00a 100644
--- a/libgimp/gimpitem_pdb.c
+++ b/libgimp/gimpitem_pdb.c
@@ -873,7 +873,7 @@ gimp_item_detach_parasite (gint32       item_ID,
 }
 
 /**
- * gimp_item_find_parasite:
+ * gimp_item_get_parasite:
  * @item_ID: The item.
  * @name: The name of the parasite to find.
  *
@@ -886,14 +886,14 @@ gimp_item_detach_parasite (gint32       item_ID,
  * Since: GIMP 2.8
  **/
 GimpParasite *
-gimp_item_find_parasite (gint32       item_ID,
-                         const gchar *name)
+gimp_item_get_parasite (gint32       item_ID,
+                        const gchar *name)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
   GimpParasite *parasite = NULL;
 
-  return_vals = gimp_run_procedure ("gimp-item-find-parasite",
+  return_vals = gimp_run_procedure ("gimp-item-get-parasite",
                                     &nreturn_vals,
                                     GIMP_PDB_ITEM, item_ID,
                                     GIMP_PDB_STRING, name,
@@ -908,48 +908,43 @@ gimp_item_find_parasite (gint32       item_ID,
 }
 
 /**
- * gimp_item_list_parasites:
+ * gimp_item_get_parasite_list:
  * @item_ID: The item.
  * @num_parasites: The number of attached parasites.
- * @parasites: The names of currently attached parasites.
  *
  * List all parasites.
  *
  * Returns a list of all parasites currently attached the an item.
  *
- * Returns: TRUE on success.
+ * Returns: The names of currently attached parasites.
  *
  * Since: GIMP 2.8
  **/
-gboolean
-gimp_item_list_parasites (gint32    item_ID,
-                          gint     *num_parasites,
-                          gchar  ***parasites)
+gchar **
+gimp_item_get_parasite_list (gint32  item_ID,
+                             gint   *num_parasites)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
-  gboolean success = TRUE;
+  gchar **parasites = NULL;
   gint i;
 
-  return_vals = gimp_run_procedure ("gimp-item-list-parasites",
+  return_vals = gimp_run_procedure ("gimp-item-get-parasite-list",
                                     &nreturn_vals,
                                     GIMP_PDB_ITEM, item_ID,
                                     GIMP_PDB_END);
 
   *num_parasites = 0;
-  *parasites = NULL;
 
-  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
-
-  if (success)
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
     {
       *num_parasites = return_vals[1].data.d_int32;
-      *parasites = g_new (gchar *, *num_parasites);
+      parasites = g_new (gchar *, *num_parasites);
       for (i = 0; i < *num_parasites; i++)
-        (*parasites)[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+        parasites[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
     }
 
   gimp_destroy_params (return_vals, nreturn_vals);
 
-  return success;
+  return parasites;
 }
diff --git a/libgimp/gimpitem_pdb.h b/libgimp/gimpitem_pdb.h
index 8602992..e372748 100644
--- a/libgimp/gimpitem_pdb.h
+++ b/libgimp/gimpitem_pdb.h
@@ -28,44 +28,43 @@ G_BEGIN_DECLS
 /* For information look into the C source or the html documentation */
 
 
-gboolean      gimp_item_is_valid         (gint32                item_ID);
-gint32        gimp_item_get_image        (gint32                item_ID);
-gboolean      gimp_item_delete           (gint32                item_ID);
-gboolean      gimp_item_is_drawable      (gint32                item_ID);
-gboolean      gimp_item_is_layer         (gint32                item_ID);
-gboolean      gimp_item_is_text_layer    (gint32                item_ID);
-gboolean      gimp_item_is_channel       (gint32                item_ID);
-gboolean      gimp_item_is_layer_mask    (gint32                item_ID);
-gboolean      gimp_item_is_selection     (gint32                item_ID);
-gboolean      gimp_item_is_vectors       (gint32                item_ID);
-gboolean      gimp_item_is_group         (gint32                item_ID);
-gint32        gimp_item_get_parent       (gint32                item_ID);
-gint*         gimp_item_get_children     (gint32                item_ID,
-                                          gint                 *num_children);
-gchar*        gimp_item_get_name         (gint32                item_ID);
-gboolean      gimp_item_set_name         (gint32                item_ID,
-                                          const gchar          *name);
-gboolean      gimp_item_get_visible      (gint32                item_ID);
-gboolean      gimp_item_set_visible      (gint32                item_ID,
-                                          gboolean              visible);
-gboolean      gimp_item_get_linked       (gint32                item_ID);
-gboolean      gimp_item_set_linked       (gint32                item_ID,
-                                          gboolean              linked);
-gboolean      gimp_item_get_lock_content (gint32                item_ID);
-gboolean      gimp_item_set_lock_content (gint32                item_ID,
-                                          gboolean              lock_content);
-gint          gimp_item_get_tattoo       (gint32                item_ID);
-gboolean      gimp_item_set_tattoo       (gint32                item_ID,
-                                          gint                  tattoo);
-gboolean      gimp_item_attach_parasite  (gint32                item_ID,
-                                          const GimpParasite   *parasite);
-gboolean      gimp_item_detach_parasite  (gint32                item_ID,
-                                          const gchar          *name);
-GimpParasite* gimp_item_find_parasite    (gint32                item_ID,
-                                          const gchar          *name);
-gboolean      gimp_item_list_parasites   (gint32                item_ID,
-                                          gint                 *num_parasites,
-                                          gchar              ***parasites);
+gboolean      gimp_item_is_valid          (gint32              item_ID);
+gint32        gimp_item_get_image         (gint32              item_ID);
+gboolean      gimp_item_delete            (gint32              item_ID);
+gboolean      gimp_item_is_drawable       (gint32              item_ID);
+gboolean      gimp_item_is_layer          (gint32              item_ID);
+gboolean      gimp_item_is_text_layer     (gint32              item_ID);
+gboolean      gimp_item_is_channel        (gint32              item_ID);
+gboolean      gimp_item_is_layer_mask     (gint32              item_ID);
+gboolean      gimp_item_is_selection      (gint32              item_ID);
+gboolean      gimp_item_is_vectors        (gint32              item_ID);
+gboolean      gimp_item_is_group          (gint32              item_ID);
+gint32        gimp_item_get_parent        (gint32              item_ID);
+gint*         gimp_item_get_children      (gint32              item_ID,
+                                           gint               *num_children);
+gchar*        gimp_item_get_name          (gint32              item_ID);
+gboolean      gimp_item_set_name          (gint32              item_ID,
+                                           const gchar        *name);
+gboolean      gimp_item_get_visible       (gint32              item_ID);
+gboolean      gimp_item_set_visible       (gint32              item_ID,
+                                           gboolean            visible);
+gboolean      gimp_item_get_linked        (gint32              item_ID);
+gboolean      gimp_item_set_linked        (gint32              item_ID,
+                                           gboolean            linked);
+gboolean      gimp_item_get_lock_content  (gint32              item_ID);
+gboolean      gimp_item_set_lock_content  (gint32              item_ID,
+                                           gboolean            lock_content);
+gint          gimp_item_get_tattoo        (gint32              item_ID);
+gboolean      gimp_item_set_tattoo        (gint32              item_ID,
+                                           gint                tattoo);
+gboolean      gimp_item_attach_parasite   (gint32              item_ID,
+                                           const GimpParasite *parasite);
+gboolean      gimp_item_detach_parasite   (gint32              item_ID,
+                                           const gchar        *name);
+GimpParasite* gimp_item_get_parasite      (gint32              item_ID,
+                                           const gchar        *name);
+gchar**       gimp_item_get_parasite_list (gint32              item_ID,
+                                           gint               *num_parasites);
 
 
 G_END_DECLS
diff --git a/libgimp/gimpvectors.c b/libgimp/gimpvectors.c
index c03f1c5..197fd74 100644
--- a/libgimp/gimpvectors.c
+++ b/libgimp/gimpvectors.c
@@ -201,7 +201,7 @@ gimp_vectors_set_tattoo (gint32 vectors_ID,
  * @vectors_ID: The vectors object.
  * @name: The name of the parasite to find.
  *
- * Deprecated: Use gimp_item_find_parasite() instead.
+ * Deprecated: Use gimp_item_get_parasite() instead.
  *
  * Returns: The found parasite.
  *
@@ -211,7 +211,7 @@ GimpParasite *
 gimp_vectors_parasite_find (gint32       vectors_ID,
                             const gchar *name)
 {
-  return gimp_item_find_parasite (vectors_ID, name);
+  return gimp_item_get_parasite (vectors_ID, name);
 }
 
 /**
@@ -267,5 +267,7 @@ gimp_vectors_parasite_list (gint32    vectors_ID,
                             gint     *num_parasites,
                             gchar  ***parasites)
 {
-  return gimp_item_list_parasites (vectors_ID, num_parasites, parasites);
+  *parasites = gimp_item_get_parasite_list (vectors_ID, num_parasites);
+
+  return *parasites != NULL;
 }
diff --git a/plug-ins/gfig/gfig-dialog.c b/plug-ins/gfig/gfig-dialog.c
index da6569a..a012122 100644
--- a/plug-ins/gfig/gfig-dialog.c
+++ b/plug-ins/gfig/gfig-dialog.c
@@ -225,7 +225,7 @@ gfig_dialog (void)
    */
   gfig_list = NULL;
   undo_level = -1;
-  parasite = gimp_item_find_parasite (gfig_context->drawable_id, "gfig");
+  parasite = gimp_item_get_parasite (gfig_context->drawable_id, "gfig");
   gfig_context->enable_repaint = FALSE;
 
   /* debug */
diff --git a/plug-ins/gfig/gfig.c b/plug-ins/gfig/gfig.c
index c42a746..d106d2c 100644
--- a/plug-ins/gfig/gfig.c
+++ b/plug-ins/gfig/gfig.c
@@ -750,7 +750,7 @@ gfig_load_from_parasite (void)
   GimpParasite *parasite;
   GFigObj      *gfig;
 
-  parasite = gimp_item_find_parasite (gfig_context->drawable_id, "gfig");
+  parasite = gimp_item_get_parasite (gfig_context->drawable_id, "gfig");
   if (! parasite)
     return NULL;
 
diff --git a/plug-ins/ifs-compose/ifs-compose.c b/plug-ins/ifs-compose/ifs-compose.c
index b1af5bd..2a093ea 100644
--- a/plug-ins/ifs-compose/ifs-compose.c
+++ b/plug-ins/ifs-compose/ifs-compose.c
@@ -384,8 +384,8 @@ run (const gchar      *name,
       /*  Possibly retrieve data; first look for a parasite -
        *  if not found, fall back to global values
        */
-      parasite = gimp_item_find_parasite (drawable->drawable_id,
-                                          PLUG_IN_PARASITE);
+      parasite = gimp_item_get_parasite (drawable->drawable_id,
+                                         PLUG_IN_PARASITE);
       if (parasite)
         {
           found_parasite = ifsvals_parse_string (gimp_parasite_data (parasite),
diff --git a/tools/pdbgen/pdb/item.pdb b/tools/pdbgen/pdb/item.pdb
index 8c97d0a..2c7eb43 100644
--- a/tools/pdbgen/pdb/item.pdb
+++ b/tools/pdbgen/pdb/item.pdb
@@ -732,7 +732,7 @@ CODE
     );
 }
 
-sub item_find_parasite {
+sub item_get_parasite {
     $blurb = 'Look up a parasite in an item';
 
     $help = <<'HELP';
@@ -765,7 +765,7 @@ CODE
     );
 }
 
-sub item_list_parasites {
+sub item_get_parasite_list {
     $blurb = 'List all parasites.';
     $help  = 'Returns a list of all parasites currently attached the an item.';
 
@@ -777,7 +777,7 @@ sub item_list_parasites {
     );
 
     @outargs = (
-	{ name => 'parasites', type => 'stringarray', void_ret => 1,
+	{ name => 'parasites', type => 'stringarray',
 	  desc => 'The names of currently attached parasites',
 	  array => { desc => 'The number of attached parasites' } }
     );
@@ -819,8 +819,8 @@ CODE
             item_get_lock_content item_set_lock_content
             item_get_tattoo item_set_tattoo
 	    item_attach_parasite item_detach_parasite
-	    item_find_parasite
-	    item_list_parasites);
+	    item_get_parasite
+	    item_get_parasite_list);
 
 %exports = (app => [ procs], lib => [ procs]);
 



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