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.
This commit is contained in:
Jehan 2022-06-27 13:40:27 +02:00
parent 3473883edb
commit 15ec254148
6 changed files with 26 additions and 9 deletions

View file

@ -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. * @num_images: (out): The number of images currently open.
* *
* Returns the list 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. * @image: The image.
* @num_layers: (out): The number of root layers contained in 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. * @image: The image.
* @num_channels: (out): The number of channels contained in 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. * @image: The image.
* @num_vectors: (out): The number of vectors contained in 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. * @image: The image.
* @num_layers: (out): The number of selected layers in the image. * @num_layers: (out): The number of selected layers in the image.
* *

View file

@ -476,7 +476,7 @@ gimp_item_get_parent (GimpItem *item)
} }
/** /**
* gimp_item_get_children: * gimp_item_get_children: (skip)
* @item: The item. * @item: The item.
* @num_children: (out): The item's number of children. * @num_children: (out): The item's number of children.
* *

View file

@ -54,6 +54,8 @@ HELP
&std_pdb_misc; &std_pdb_misc;
$skip_gi = 1;
@outargs = ( @outargs = (
{ name => 'images', type => 'imagearray', { name => 'images', type => 'imagearray',
desc => 'The list of images currently open.', desc => 'The list of images currently open.',
@ -254,6 +256,8 @@ HELP
&std_pdb_misc; &std_pdb_misc;
$skip_gi = 1;
@inargs = ( @inargs = (
{ name => 'image', type => 'image', { name => 'image', type => 'image',
desc => 'The image' } desc => 'The image' }
@ -299,6 +303,8 @@ HELP
&std_pdb_misc; &std_pdb_misc;
$skip_gi = 1;
@inargs = ( @inargs = (
{ name => 'image', type => 'image', { name => 'image', type => 'image',
desc => 'The image' } desc => 'The image' }
@ -341,6 +347,8 @@ HELP
&simon_pdb_misc('2005', '2.4'); &simon_pdb_misc('2005', '2.4');
$skip_gi = 1;
@inargs = ( @inargs = (
{ name => 'image', type => 'image', { name => 'image', type => 'image',
desc => 'The image' } desc => 'The image' }
@ -1833,6 +1841,8 @@ HELP
&jehan_pdb_misc('2020', '3.0.0'); &jehan_pdb_misc('2020', '3.0.0');
$skip_gi = 1;
@inargs = ( @inargs = (
{ name => 'image', type => 'image', { name => 'image', type => 'image',
desc => 'The image' } desc => 'The image' }

View file

@ -400,6 +400,8 @@ HELP
&mitch_pdb_misc('2010', '2.8'); &mitch_pdb_misc('2010', '2.8');
$skip_gi = 1;
@inargs = ( @inargs = (
{ name => 'item', type => 'item', { name => 'item', type => 'item',
desc => 'The item' } desc => 'The item' }

View file

@ -87,6 +87,11 @@ sub generate_fun {
$wrapped = '_'; $wrapped = '_';
} }
$skip_gi = '';
if ($proc->{skip_gi}) {
$skip_gi = ' (skip)';
}
if ($proc->{deprecated}) { if ($proc->{deprecated}) {
if ($proc->{deprecated} eq 'NONE') { if ($proc->{deprecated} eq 'NONE') {
push @{$out->{protos}}, "GIMP_DEPRECATED\n"; push @{$out->{protos}}, "GIMP_DEPRECATED\n";
@ -514,7 +519,7 @@ CODE
return <<CODE; return <<CODE;
/** /**
* $wrapped$funcname:$func_annotations * $wrapped$funcname:$func_annotations$skip_gi
$argdesc * $argdesc *
$procdesc $procdesc
* *

View file

@ -69,11 +69,11 @@ $evalcode = <<'CODE';
# Variables to evaluate and insert into the PDB structure # Variables to evaluate and insert into the PDB structure
my @procvars = qw($name $group $blurb $help $author $copyright $date $since my @procvars = qw($name $group $blurb $help $author $copyright $date $since
$deprecated @inargs @outargs %invoke $canonical_name $deprecated @inargs @outargs %invoke $canonical_name
$lib_private); $lib_private $skip_gi);
# These are attached to the group structure # These are attached to the group structure
my @groupvars = qw($desc $doc_title $doc_short_desc $doc_long_desc my @groupvars = qw($desc $doc_title $doc_short_desc $doc_long_desc
$lib_private $lib_private $skip_gi
@headers %extra); @headers %extra);
# Hook some variables into the top-level namespace # Hook some variables into the top-level namespace