[gimp] Issue #5946: skip gimp_*get_*() API from GObject Introspection.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #5946: skip gimp_*get_*() API from GObject Introspection.
- Date: Mon, 27 Jun 2022 20:32:13 +0000 (UTC)
commit 15ec254148feb327feb3fc4070c07443170779fd
Author: Jehan <jehan girinstud io>
Date: Mon Jun 27 13:40:27 2022 +0200
Issue #5946: skip gimp_*get_*() API from GObject Introspection.
The get() API are sometimes nicer in C code because it's just simpler to
loop through C arrays, but they end up with similar API to the list()
variants for binding, or with a useless size return value (since most
higher level languages have length-aware array types, which is what
GList are transformed into).
So let's use the list() variants as the main ones and skip the get()
variants. I hesitated to rename the list() variants to get() with
`(rename-to)` annotations but since I am unsure if the get() bindings
are absolutely useless, I don't think it's the best idea. Maybe on some
other language usable as GI binding, the get() variant might be
different again and nicer to use. So if we shadowed these by renaming
list() ones, the day we change our mind, we'd have to rename get() ones
too (which would be very confusing), or else break bindings' API. To
avoid this, I just skip the get() ones altogether in bindings but leave
their name available in the bindings.
libgimp/gimpimage_pdb.c | 10 +++++-----
libgimp/gimpitem_pdb.c | 2 +-
pdb/groups/image.pdb | 10 ++++++++++
pdb/groups/item.pdb | 2 ++
pdb/lib.pl | 7 ++++++-
pdb/pdbgen.pl | 4 ++--
6 files changed, 26 insertions(+), 9 deletions(-)
---
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
index 704a81b9c8..5d3d5ffddd 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -75,7 +75,7 @@ gimp_image_id_is_valid (gint image_id)
}
/**
- * gimp_get_images:
+ * gimp_get_images: (skip)
* @num_images: (out): The number of images currently open.
*
* Returns the list of images currently open.
@@ -463,7 +463,7 @@ gimp_image_get_height (GimpImage *image)
}
/**
- * gimp_image_get_layers:
+ * gimp_image_get_layers: (skip)
* @image: The image.
* @num_layers: (out): The number of root layers contained in the image.
*
@@ -513,7 +513,7 @@ gimp_image_get_layers (GimpImage *image,
}
/**
- * gimp_image_get_channels:
+ * gimp_image_get_channels: (skip)
* @image: The image.
* @num_channels: (out): The number of channels contained in the image.
*
@@ -560,7 +560,7 @@ gimp_image_get_channels (GimpImage *image,
}
/**
- * gimp_image_get_vectors:
+ * gimp_image_get_vectors: (skip)
* @image: The image.
* @num_vectors: (out): The number of vectors contained in the image.
*
@@ -2306,7 +2306,7 @@ gimp_image_set_active_vectors (GimpImage *image,
}
/**
- * gimp_image_get_selected_layers:
+ * gimp_image_get_selected_layers: (skip)
* @image: The image.
* @num_layers: (out): The number of selected layers in the image.
*
diff --git a/libgimp/gimpitem_pdb.c b/libgimp/gimpitem_pdb.c
index c87fe9cdae..76dc470aa5 100644
--- a/libgimp/gimpitem_pdb.c
+++ b/libgimp/gimpitem_pdb.c
@@ -476,7 +476,7 @@ gimp_item_get_parent (GimpItem *item)
}
/**
- * gimp_item_get_children:
+ * gimp_item_get_children: (skip)
* @item: The item.
* @num_children: (out): The item's number of children.
*
diff --git a/pdb/groups/image.pdb b/pdb/groups/image.pdb
index f479c474a0..328cd2b24c 100644
--- a/pdb/groups/image.pdb
+++ b/pdb/groups/image.pdb
@@ -54,6 +54,8 @@ HELP
&std_pdb_misc;
+ $skip_gi = 1;
+
@outargs = (
{ name => 'images', type => 'imagearray',
desc => 'The list of images currently open.',
@@ -254,6 +256,8 @@ HELP
&std_pdb_misc;
+ $skip_gi = 1;
+
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' }
@@ -299,6 +303,8 @@ HELP
&std_pdb_misc;
+ $skip_gi = 1;
+
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' }
@@ -341,6 +347,8 @@ HELP
&simon_pdb_misc('2005', '2.4');
+ $skip_gi = 1;
+
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' }
@@ -1833,6 +1841,8 @@ HELP
&jehan_pdb_misc('2020', '3.0.0');
+ $skip_gi = 1;
+
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' }
diff --git a/pdb/groups/item.pdb b/pdb/groups/item.pdb
index aac3c20f77..1ecb3809e3 100644
--- a/pdb/groups/item.pdb
+++ b/pdb/groups/item.pdb
@@ -400,6 +400,8 @@ HELP
&mitch_pdb_misc('2010', '2.8');
+ $skip_gi = 1;
+
@inargs = (
{ name => 'item', type => 'item',
desc => 'The item' }
diff --git a/pdb/lib.pl b/pdb/lib.pl
index 9bca67ea0d..ac924e2358 100644
--- a/pdb/lib.pl
+++ b/pdb/lib.pl
@@ -87,6 +87,11 @@ sub generate_fun {
$wrapped = '_';
}
+ $skip_gi = '';
+ if ($proc->{skip_gi}) {
+ $skip_gi = ' (skip)';
+ }
+
if ($proc->{deprecated}) {
if ($proc->{deprecated} eq 'NONE') {
push @{$out->{protos}}, "GIMP_DEPRECATED\n";
@@ -514,7 +519,7 @@ CODE
return <<CODE;
/**
- * $wrapped$funcname:$func_annotations
+ * $wrapped$funcname:$func_annotations$skip_gi
$argdesc *
$procdesc
*
diff --git a/pdb/pdbgen.pl b/pdb/pdbgen.pl
index 8a18970437..15c55229c5 100755
--- a/pdb/pdbgen.pl
+++ b/pdb/pdbgen.pl
@@ -69,11 +69,11 @@ $evalcode = <<'CODE';
# Variables to evaluate and insert into the PDB structure
my @procvars = qw($name $group $blurb $help $author $copyright $date $since
$deprecated @inargs @outargs %invoke $canonical_name
- $lib_private);
+ $lib_private $skip_gi);
# These are attached to the group structure
my @groupvars = qw($desc $doc_title $doc_short_desc $doc_long_desc
- $lib_private
+ $lib_private $skip_gi
@headers %extra);
# Hook some variables into the top-level namespace
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]