[gimp] libgimp, pdb: annotate arguments with none_ok as (nullable).



commit ac1c0ae3ce53d16b17fbde4b659325d0c73b0e3e
Author: Jehan <jehan girinstud io>
Date:   Sat Aug 24 23:02:35 2019 +0200

    libgimp, pdb: annotate arguments with none_ok as (nullable).
    
    Same for returned value though it seems we have no function with none_ok
    as return value. At least we have the rule in the generation script for
    when this will happen.

 libgimp/gimpimage_pdb.c    | 20 ++++++++++----------
 libgimp/gimpprogress_pdb.c |  2 +-
 libgimp/gimptexttool_pdb.c |  4 ++--
 pdb/lib.pl                 |  8 +++++++-
 4 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
index 175f1c4ed8..0d9a2bd8ad 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -1438,7 +1438,7 @@ _gimp_image_floating_sel_attached_to (gint32 image_ID)
 /**
  * gimp_image_pick_color:
  * @image: The image.
- * @drawable: The drawable to pick from.
+ * @drawable: (nullable): The drawable to pick from.
  * @x: x coordinate of upper-left corner of rectangle.
  * @y: y coordinate of upper-left corner of rectangle.
  * @sample_merged: Use the composite image, not the drawable.
@@ -1509,7 +1509,7 @@ gimp_image_pick_color (GimpImage    *image,
 /**
  * _gimp_image_pick_color: (skip)
  * @image_ID: The image.
- * @drawable_ID: The drawable to pick from.
+ * @drawable_ID: (nullable): The drawable to pick from.
  * @x: x coordinate of upper-left corner of rectangle.
  * @y: y coordinate of upper-left corner of rectangle.
  * @sample_merged: Use the composite image, not the drawable.
@@ -1679,7 +1679,7 @@ _gimp_image_pick_correlate_layer (gint32 image_ID,
  * gimp_image_insert_layer:
  * @image: The image.
  * @layer: The layer.
- * @parent: The parent layer.
+ * @parent: (nullable): The parent layer.
  * @position: The layer position.
  *
  * Add the specified layer to the image.
@@ -1736,7 +1736,7 @@ gimp_image_insert_layer (GimpImage *image,
  * _gimp_image_insert_layer: (skip)
  * @image_ID: The image.
  * @layer_ID: The layer.
- * @parent_ID: The parent layer.
+ * @parent_ID: (nullable): The parent layer.
  * @position: The layer position.
  *
  * Add the specified layer to the image.
@@ -2063,7 +2063,7 @@ _gimp_image_thaw_layers (gint32 image_ID)
  * gimp_image_insert_channel:
  * @image: The image.
  * @channel: The channel.
- * @parent: The parent channel.
+ * @parent: (nullable): The parent channel.
  * @position: The channel position.
  *
  * Add the specified channel to the image.
@@ -2115,7 +2115,7 @@ gimp_image_insert_channel (GimpImage   *image,
  * _gimp_image_insert_channel: (skip)
  * @image_ID: The image.
  * @channel_ID: The channel.
- * @parent_ID: The parent channel.
+ * @parent_ID: (nullable): The parent channel.
  * @position: The channel position.
  *
  * Add the specified channel to the image.
@@ -2433,7 +2433,7 @@ _gimp_image_thaw_channels (gint32 image_ID)
  * gimp_image_insert_vectors:
  * @image: The image.
  * @vectors: The vectors.
- * @parent: The parent vectors.
+ * @parent: (nullable): The parent vectors.
  * @position: The vectors position.
  *
  * Add the specified vectors to the image.
@@ -2485,7 +2485,7 @@ gimp_image_insert_vectors (GimpImage   *image,
  * _gimp_image_insert_vectors: (skip)
  * @image_ID: The image.
  * @vectors_ID: The vectors.
- * @parent_ID: The parent vectors.
+ * @parent_ID: (nullable): The parent vectors.
  * @position: The vectors position.
  *
  * Add the specified vectors to the image.
@@ -3255,7 +3255,7 @@ _gimp_image_lower_item_to_bottom (gint32 image_ID,
  * gimp_image_reorder_item:
  * @image: The image.
  * @item: The item to reorder.
- * @parent: The new parent item.
+ * @parent: (nullable): The new parent item.
  * @position: The new position of the item.
  *
  * Reorder the specified item within its item tree
@@ -3304,7 +3304,7 @@ gimp_image_reorder_item (GimpImage *image,
  * _gimp_image_reorder_item: (skip)
  * @image_ID: The image.
  * @item_ID: The item to reorder.
- * @parent_ID: The new parent item.
+ * @parent_ID: (nullable): The new parent item.
  * @position: The new position of the item.
  *
  * Reorder the specified item within its item tree
diff --git a/libgimp/gimpprogress_pdb.c b/libgimp/gimpprogress_pdb.c
index 4d12c94f88..68148cd85a 100644
--- a/libgimp/gimpprogress_pdb.c
+++ b/libgimp/gimpprogress_pdb.c
@@ -37,7 +37,7 @@
 /**
  * _gimp_progress_init:
  * @message: Message to use in the progress dialog.
- * @gdisplay: GimpDisplay to update progressbar in, or -1 for a separate window.
+ * @gdisplay: (nullable): GimpDisplay to update progressbar in, or -1 for a separate window.
  *
  * Initializes the progress bar for the current plug-in.
  *
diff --git a/libgimp/gimptexttool_pdb.c b/libgimp/gimptexttool_pdb.c
index e2269e4ae9..df38b0c567 100644
--- a/libgimp/gimptexttool_pdb.c
+++ b/libgimp/gimptexttool_pdb.c
@@ -37,7 +37,7 @@
 /**
  * gimp_text_fontname:
  * @image: The image.
- * @drawable: The affected drawable: (-1 for a new text layer).
+ * @drawable: (nullable): The affected drawable: (-1 for a new text layer).
  * @x: The x coordinate for the left of the text bounding box.
  * @y: The y coordinate for the top of the text bounding box.
  * @text: The text to generate (in UTF-8 encoding).
@@ -116,7 +116,7 @@ gimp_text_fontname (GimpImage    *image,
 /**
  * _gimp_text_fontname: (skip)
  * @image_ID: The image.
- * @drawable_ID: The affected drawable: (-1 for a new text layer).
+ * @drawable_ID: (nullable): The affected drawable: (-1 for a new text layer).
  * @x: The x coordinate for the left of the text bounding box.
  * @y: The y coordinate for the top of the text bounding box.
  * @text: The text to generate (in UTF-8 encoding).
diff --git a/pdb/lib.pl b/pdb/lib.pl
index 7a0a6ff414..c787b544a0 100644
--- a/pdb/lib.pl
+++ b/pdb/lib.pl
@@ -152,6 +152,9 @@ sub generate_fun {
         if (exists $argtype->{array}) {
             $annotate = " (array length=$retarg->{array}->{name})";
         }
+        if (exists $retarg->{none_ok}) {
+            $annotate .= " (nullable)";
+        }
 
         if ($api_deprecated) {
             if (exists $argtype->{out_annotate_d}) {
@@ -276,8 +279,11 @@ sub generate_fun {
         if (exists $arg->{in_annotate}) {
             $argdesc .= " $arg->{in_annotate}";
         }
+        if (exists $_->{none_ok}) {
+            $argdesc .= " (nullable)";
+        }
 
-        if (exists $arg->{array} || exists $arg->{in_annotate}) {
+        if (exists $arg->{array} || exists $_->{none_ok} || exists $arg->{in_annotate}) {
             $argdesc .= ":";
         }
 


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