1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-05 21:02:42 +02:00

app, libgimp, pdb: fix a null_ok/none_ok mixup.

We had 2 flags to indicate that a PDB argument could be nullable:
null_ok and none_ok. That was a huge mixup and the PDB generation code
was using sometimes one, sometimes the other. Let's settle for only
none_ok.

This fixes a bunch of annotations.
This commit is contained in:
Jehan
2025-01-20 20:11:14 +01:00
parent d8df72869f
commit 305303330c
45 changed files with 76 additions and 79 deletions

View File

@@ -173,7 +173,7 @@ register_brush_select_procs (GimpPDB *pdb)
gimp_param_spec_brush ("initial-brush",
"initial brush",
"The brush to set as the initial choice",
FALSE,
TRUE,
NULL,
FALSE,
GIMP_PARAM_READWRITE));

View File

@@ -172,7 +172,7 @@ register_drawable_select_procs (GimpPDB *pdb)
gimp_param_spec_drawable ("initial-drawable",
"initial drawable",
"The drawable to set as the initial choice",
FALSE,
TRUE,
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
gimp_procedure_add_argument (procedure,
g_param_spec_boxed ("parent-window",

View File

@@ -175,7 +175,7 @@ register_font_select_procs (GimpPDB *pdb)
gimp_param_spec_font ("initial-font",
"initial font",
"The name of the initial font choice.",
FALSE,
TRUE,
NULL,
FALSE,
GIMP_PARAM_READWRITE));

View File

@@ -179,7 +179,7 @@ register_gradient_select_procs (GimpPDB *pdb)
gimp_param_spec_gradient ("initial-gradient",
"initial gradient",
"The initial gradient choice",
FALSE,
TRUE,
NULL,
FALSE,
GIMP_PARAM_READWRITE));

View File

@@ -173,7 +173,7 @@ register_palette_select_procs (GimpPDB *pdb)
gimp_param_spec_palette ("initial-palette",
"initial palette",
"The palette to set as the initial choice.",
FALSE,
TRUE,
NULL,
FALSE,
GIMP_PARAM_READWRITE));

View File

@@ -173,7 +173,7 @@ register_pattern_select_procs (GimpPDB *pdb)
gimp_param_spec_pattern ("initial-pattern",
"initial pattern",
"The pattern to set as the initial choice",
FALSE,
TRUE,
NULL,
FALSE,
GIMP_PARAM_READWRITE));

View File

@@ -253,7 +253,7 @@ gimp_get_parasite_list (void)
/**
* gimp_temp_file:
* @extension: The extension the file will have.
* @extension: (nullable): The extension the file will have.
*
* Generates a unique temporary file.
*

View File

@@ -41,8 +41,8 @@
* gimp_brushes_popup:
* @brush_callback: The callback PDB proc to call when user chooses a brush.
* @popup_title: Title of the brush selection dialog.
* @initial_brush: The brush to set as the initial choice.
* @parent_window: An optional parent window handle for the popup to be set transient to.
* @initial_brush: (nullable): The brush to set as the initial choice.
* @parent_window: (nullable): An optional parent window handle for the popup to be set transient to.
*
* Invokes the GIMP brush selection dialog.
*

View File

@@ -38,7 +38,7 @@
/**
* gimp_buffers_get_name_list:
* @filter: An optional regular expression used to filter the list.
* @filter: (nullable): An optional regular expression used to filter the list.
*
* Retrieve a complete listing of the available buffers.
*

View File

@@ -77,7 +77,7 @@ gimp_drawable_filter_id_is_valid (gint filter_id)
* gimp_drawable_filter_new:
* @drawable: The drawable.
* @operation_name: The GEGL operation's name.
* @name: The effect name.
* @name: (nullable): The effect name.
*
* Create a new drawable filter.
*

View File

@@ -41,8 +41,8 @@
* @callback: The callback PDB proc to call when user chooses an drawable.
* @popup_title: Title of the drawable selection dialog.
* @drawable_type: The name of the GIMP_TYPE_DRAWABLE subtype.
* @initial_drawable: The drawable to set as the initial choice.
* @parent_window: An optional parent window handle for the popup to be set transient to.
* @initial_drawable: (nullable): The drawable to set as the initial choice.
* @parent_window: (nullable): An optional parent window handle for the popup to be set transient to.
*
* Invokes the drawable selection dialog.
*

View File

@@ -73,7 +73,7 @@ gimp_dynamics_refresh (void)
/**
* gimp_dynamics_get_name_list:
* @filter: An optional regular expression used to filter the list.
* @filter: (nullable): An optional regular expression used to filter the list.
*
* Retrieve the list of loaded paint dynamics.
*

View File

@@ -117,7 +117,7 @@ _gimp_fonts_get_custom_configs (gchar **sysconfig,
/**
* gimp_fonts_get_list:
* @filter: An optional regular expression used to filter the list.
* @filter: (nullable): An optional regular expression used to filter the list.
*
* Retrieve the list of loaded fonts.
*

View File

@@ -49,8 +49,8 @@
* gimp_fonts_popup:
* @font_callback: The callback PDB proc to call when user chooses a font.
* @popup_title: Title of the font selection dialog.
* @initial_font: The name of the initial font choice.
* @parent_window: An optional parent window handle for the popup to be set transient to.
* @initial_font: (nullable): The name of the initial font choice.
* @parent_window: (nullable): An optional parent window handle for the popup to be set transient to.
*
* Invokes the Gimp font selection dialog.
*

View File

@@ -70,7 +70,7 @@ gimp_gradients_refresh (void)
/**
* gimp_gradients_get_list:
* @filter: An optional regular expression used to filter the list.
* @filter: (nullable): An optional regular expression used to filter the list.
*
* Retrieve the list of loaded gradients.
*

View File

@@ -41,8 +41,8 @@
* gimp_gradients_popup:
* @gradient_callback: The callback PDB proc to call when user chooses a gradient.
* @popup_title: Title of the gradient selection dialog.
* @initial_gradient: The initial gradient choice.
* @parent_window: An optional parent window handle for the popup to be set transient to.
* @initial_gradient: (nullable): The initial gradient choice.
* @parent_window: (nullable): An optional parent window handle for the popup to be set transient to.
*
* Invokes the Gimp gradients selection dialog.
*

View File

@@ -38,7 +38,7 @@
/**
* gimp_help:
* @help_domain: The help domain in which help_id is registered.
* @help_domain: (nullable): The help domain in which help_id is registered.
* @help_id: The help page's ID.
*
* Load a help page.

View File

@@ -42,7 +42,7 @@
* @width: The layer width.
* @height: The layer height.
* @type: The layer type.
* @name: The layer name.
* @name: (nullable): The layer name.
* @opacity: The layer opacity.
* @mode: The layer combination mode.
*
@@ -98,7 +98,7 @@ _gimp_layer_new (GimpImage *image,
* gimp_layer_new_from_visible:
* @image: The source image from where the content is copied.
* @dest_image: The destination image to which to add the layer.
* @name: The layer name.
* @name: (nullable): The layer name.
*
* Create a new layer from what is visible in an image.
*

View File

@@ -266,7 +266,7 @@ gimp_palette_set_columns (GimpPalette *palette,
/**
* gimp_palette_add_entry:
* @palette: The palette.
* @entry_name: A name for the entry.
* @entry_name: (nullable): A name for the entry.
* @color: The color for the added entry.
* @entry_num: (out): The index of the added entry.
*
@@ -488,7 +488,7 @@ gimp_palette_get_entry_name (GimpPalette *palette,
* gimp_palette_set_entry_name:
* @palette: The palette.
* @entry_num: The entry to get.
* @entry_name: The new name.
* @entry_name: (nullable): The new name.
*
* Sets the name of an entry in the palette.
*

View File

@@ -70,7 +70,7 @@ gimp_palettes_refresh (void)
/**
* gimp_palettes_get_list:
* @filter: An optional regular expression used to filter the list.
* @filter: (nullable): An optional regular expression used to filter the list.
*
* Retrieves a list of all of the available palettes
*

View File

@@ -41,8 +41,8 @@
* gimp_palettes_popup:
* @palette_callback: The callback PDB proc to call when user chooses a palette.
* @popup_title: Title of the palette selection dialog.
* @initial_palette: The palette to set as the initial choice.
* @parent_window: An optional parent window handle for the popup to be set transient to.
* @initial_palette: (nullable): The palette to set as the initial choice.
* @parent_window: (nullable): An optional parent window handle for the popup to be set transient to.
*
* Invokes the Gimp palette selection dialog.
*

View File

@@ -70,7 +70,7 @@ gimp_patterns_refresh (void)
/**
* gimp_patterns_get_list:
* @filter: An optional regular expression used to filter the list.
* @filter: (nullable): An optional regular expression used to filter the list.
*
* Retrieve a complete listing of the available patterns.
*

View File

@@ -41,8 +41,8 @@
* gimp_patterns_popup:
* @pattern_callback: The callback PDB proc to call when the user chooses a pattern.
* @popup_title: Title of the pattern selection dialog.
* @initial_pattern: The pattern to set as the initial choice.
* @parent_window: An optional parent window handle for the popup to be set transient to.
* @initial_pattern: (nullable): The pattern to set as the initial choice.
* @parent_window: (nullable): An optional parent window handle for the popup to be set transient to.
*
* Invokes the Gimp pattern selection.
*

View File

@@ -349,7 +349,7 @@ _gimp_pdb_get_proc_return_value (const gchar *procedure_name,
/**
* _gimp_pdb_set_proc_image_types:
* @procedure_name: The procedure for which to install the menu path.
* @image_types: The procedure's supported image types.
* @image_types: (nullable): The procedure's supported image types.
*
* Set the supported image types for a plug-in procedure.
*
@@ -658,9 +658,9 @@ _gimp_pdb_set_proc_icon (const gchar *procedure_name,
/**
* _gimp_pdb_set_proc_documentation:
* @procedure_name: The procedure for which to install the menu path.
* @blurb: A short blurb.
* @help: Detailed procedure help.
* @help_id: The procedure help_id.
* @blurb: (nullable): A short blurb.
* @help: (nullable): Detailed procedure help.
* @help_id: (nullable): The procedure help_id.
*
* Set the documentation for a plug-in procedure.
*
@@ -756,9 +756,9 @@ _gimp_pdb_get_proc_documentation (const gchar *procedure_name,
/**
* _gimp_pdb_set_proc_attribution:
* @procedure_name: The procedure for which to install the menu path.
* @authors: Authors of the procedure.
* @copyright: The copyright.
* @date: Copyright date.
* @authors: (nullable): Authors of the procedure.
* @copyright: (nullable): The copyright.
* @date: (nullable): Copyright date.
*
* Set the attribution for a plug-in procedure.
*

View File

@@ -38,7 +38,7 @@
/**
* _gimp_progress_init:
* @message: Message to use in the progress dialog.
* @message: (nullable): Message to use in the progress dialog.
* @gdisplay: (nullable): GimpDisplay to update progressbar in, or %NULL for a separate window.
*
* Initializes the progress bar for the current plug-in.
@@ -146,7 +146,7 @@ gimp_progress_pulse (void)
/**
* gimp_progress_set_text:
* @message: Message to use in the progress dialog.
* @message: (nullable): Message to use in the progress dialog.
*
* Changes the text in the progress bar for the current plug-in.
*

View File

@@ -587,14 +587,14 @@ CODE
}
elsif ($pdbtype eq 'string') {
$allow_non_utf8 = exists $arg->{allow_non_utf8} ? 'TRUE' : 'FALSE';
$null_ok = exists $arg->{null_ok} ? 'TRUE' : 'FALSE';
$none_ok = exists $arg->{none_ok} ? 'TRUE' : 'FALSE';
$non_empty = exists $arg->{non_empty} ? 'TRUE' : 'FALSE';
$default = exists $arg->{default} ? $arg->{default} : NULL;
$pspec = <<CODE;
gimp_param_spec_string ("$name",
"$nick",
"$blurb",
$allow_non_utf8, $null_ok, $non_empty,
$allow_non_utf8, $none_ok, $non_empty,
$default,
$flags)
CODE

View File

@@ -27,9 +27,9 @@ sub brushes_popup {
desc => 'The callback PDB proc to call when user chooses a brush' },
{ name => 'popup_title', type => 'string',
desc => 'Title of the brush selection dialog' },
{ name => 'initial_brush', type => 'brush', null_ok => 1,
{ name => 'initial_brush', type => 'brush', none_ok => 1,
desc => 'The brush to set as the initial choice' },
{ name => 'parent_window', type => 'bytes', null_ok => 1,
{ name => 'parent_window', type => 'bytes', none_ok => 1,
desc => 'An optional parent window handle for the popup to be set transient to' }
);

View File

@@ -26,7 +26,7 @@ HELP
&mitch_pdb_misc('2005', '2.4');
@inargs = (
{ name => 'filter', type => 'string', null_ok => 1,
{ name => 'filter', type => 'string', none_ok => 1,
desc => 'An optional regular expression used to filter the list' }
);

View File

@@ -64,7 +64,7 @@ HELP
{ name => 'operation_name', type => 'string',
desc => "The GEGL operation's name" },
{ name => 'name', type => 'string',
desc => 'The effect name', null_ok => 0 },
desc => 'The effect name', none_ok => 0 },
);
@outargs = (

View File

@@ -27,9 +27,9 @@ sub drawables_popup {
desc => 'Title of the drawable selection dialog' },
{ name => 'drawable_type', type => 'string', non_empty => 1,
desc => 'The name of the GIMP_TYPE_DRAWABLE subtype' },
{ name => 'initial_drawable', type => 'drawable', null_ok => 1, no_validate => 1,
{ name => 'initial_drawable', type => 'drawable', none_ok => 1, no_validate => 1,
desc => 'The drawable to set as the initial choice' },
{ name => 'parent_window', type => 'bytes', null_ok => 1,
{ name => 'parent_window', type => 'bytes', none_ok => 1,
desc => 'An optional parent window handle for the popup to be set transient to' }
);

View File

@@ -47,7 +47,7 @@ HELP
&mitch_pdb_misc('2011', '2.8');
@inargs = (
{ name => 'filter', type => 'string', null_ok => 1,
{ name => 'filter', type => 'string', none_ok => 1,
desc => 'An optional regular expression used to filter the list' }
);

View File

@@ -28,9 +28,9 @@ sub fonts_popup {
desc => 'The callback PDB proc to call when user chooses a font' },
{ name => 'popup_title', type => 'string',
desc => 'Title of the font selection dialog' },
{ name => 'initial_font', type => 'font', null_ok => 1,
{ name => 'initial_font', type => 'font', none_ok => 1,
desc => 'The name of the initial font choice.' },
{ name => 'parent_window', type => 'bytes', null_ok => 1,
{ name => 'parent_window', type => 'bytes', none_ok => 1,
desc => 'An optional parent window handle for the popup to be set transient to' }
);

View File

@@ -49,7 +49,7 @@ HELP
&neo_pdb_misc('2003');
@inargs = (
{ name => 'filter', type => 'string', null_ok => 1,
{ name => 'filter', type => 'string', none_ok => 1,
desc => 'An optional regular expression used to filter the list' }
);

View File

@@ -200,7 +200,7 @@ HELP
@inargs = (
{ name => 'extension', type => 'string',
allow_non_utf8 => 1, null_ok => 1,
allow_non_utf8 => 1, none_ok => 1,
desc => 'The extension the file will have' }
);

View File

@@ -28,9 +28,9 @@ sub gradients_popup {
desc => 'The callback PDB proc to call when user chooses a gradient' },
{ name => 'popup_title', type => 'string',
desc => 'Title of the gradient selection dialog' },
{ name => 'initial_gradient', type => 'gradient', null_ok => 1,
{ name => 'initial_gradient', type => 'gradient', none_ok => 1,
desc => 'The initial gradient choice' },
{ name => 'parent_window', type => 'bytes', null_ok => 1,
{ name => 'parent_window', type => 'bytes', none_ok => 1,
desc => 'An optional parent window handle for the popup to be set transient to' }
);

View File

@@ -47,7 +47,7 @@ HELP
&federico_pdb_misc('1997');
@inargs = (
{ name => 'filter', type => 'string', null_ok => 1,
{ name => 'filter', type => 'string', none_ok => 1,
desc => 'An optional regular expression used to filter the list' }
);

View File

@@ -31,7 +31,7 @@ HELP
&mitch_pdb_misc('2000');
@inargs = (
{ name => 'help_domain', type => 'string', null_ok => 1,
{ name => 'help_domain', type => 'string', none_ok => 1,
desc => "The help domain in which help_id is registered" },
{ name => 'help_id', type => 'string',
desc => "The help page's ID" }

View File

@@ -43,7 +43,7 @@ HELP
{ name => 'type', type => 'enum GimpImageType',
desc => 'The layer type' },
{ name => 'name', type => 'string',
desc => 'The layer name', null_ok => 0 },
desc => 'The layer name', none_ok => 0 },
{ name => 'opacity', type => '0 <= double <= 100',
desc => 'The layer opacity' },
{ name => 'mode', type => 'enum GimpLayerMode',
@@ -144,7 +144,7 @@ HELP
{ name => 'dest_image', type => 'image',
desc => 'The destination image to which to add the layer' },
{ name => 'name', type => 'string',
desc => 'The layer name', null_ok => 1 }
desc => 'The layer name', none_ok => 1 }
);
@outargs = (

View File

@@ -202,9 +202,6 @@ CODE
);
}
# FIXME null_ok should allow None in Python for name, but fails.
sub palette_add_entry {
$blurb = 'Appends an entry to the palette.';
@@ -220,7 +217,7 @@ HELP
@inargs = (
${palette_arg_spec},
{ name => 'entry_name', type => 'string', null_ok => 1,
{ name => 'entry_name', type => 'string', none_ok => 1,
desc => 'A name for the entry' },
{ name => 'color', type => 'geglcolor',
desc => 'The color for the added entry.' }
@@ -414,7 +411,7 @@ HELP
${palette_arg_spec},
{ name => 'entry_num', type => 'int32',
desc => 'The entry to get' },
{ name => 'entry_name', type => 'string', null_ok => 1,
{ name => 'entry_name', type => 'string', none_ok => 1,
desc => 'The new name' }
);

View File

@@ -27,9 +27,9 @@ sub palettes_popup {
desc => 'The callback PDB proc to call when user chooses a palette' },
{ name => 'popup_title', type => 'string',
desc => 'Title of the palette selection dialog' },
{ name => 'initial_palette', type => 'palette', null_ok => 1,
{ name => 'initial_palette', type => 'palette', none_ok => 1,
desc => 'The palette to set as the initial choice.' },
{ name => 'parent_window', type => 'bytes', null_ok => 1,
{ name => 'parent_window', type => 'bytes', none_ok => 1,
desc => 'An optional parent window handle for the popup to be set transient to' }
);

View File

@@ -47,7 +47,7 @@ HELP
&rock_pdb_misc('2001');
@inargs = (
{ name => 'filter', type => 'string', null_ok => 1,
{ name => 'filter', type => 'string', none_ok => 1,
desc => 'An optional regular expression used to filter the list' }
);

View File

@@ -27,9 +27,9 @@ sub patterns_popup {
desc => 'The callback PDB proc to call when the user chooses a pattern' },
{ name => 'popup_title', type => 'string',
desc => 'Title of the pattern selection dialog' },
{ name => 'initial_pattern', type => 'pattern', null_ok => 1,
{ name => 'initial_pattern', type => 'pattern', none_ok => 1,
desc => 'The pattern to set as the initial choice' },
{ name => 'parent_window', type => 'bytes', null_ok => 1,
{ name => 'parent_window', type => 'bytes', none_ok => 1,
desc => 'An optional parent window handle for the popup to be set transient to' }
);

View File

@@ -47,7 +47,7 @@ HELP
&std_pdb_misc;
@inargs = (
{ name => 'filter', type => 'string', null_ok => 1,
{ name => 'filter', type => 'string', none_ok => 1,
desc => 'An optional regular expression used to filter the list' }
);

View File

@@ -360,7 +360,7 @@ HELP
@inargs = (
{ name => 'procedure_name', type => 'string', non_empty => 1,
desc => 'The procedure for which to install the menu path' },
{ name => 'image_types', type => 'string', null_ok => 1,
{ name => 'image_types', type => 'string', none_ok => 1,
desc => "The procedure's supported image types" }
);
@@ -700,11 +700,11 @@ HELP
@inargs = (
{ name => 'procedure_name', type => 'string', non_empty => 1,
desc => 'The procedure for which to install the menu path' },
{ name => 'blurb', type => 'string', null_ok => 1,
{ name => 'blurb', type => 'string', none_ok => 1,
desc => 'A short blurb' },
{ name => 'help', type => 'string', null_ok => 1,
{ name => 'help', type => 'string', none_ok => 1,
desc => 'Detailed procedure help' },
{ name => 'help_id', type => 'string', null_ok => 1,
{ name => 'help_id', type => 'string', none_ok => 1,
desc => 'The procedure help_id' }
);
@@ -792,11 +792,11 @@ HELP
@inargs = (
{ name => 'procedure_name', type => 'string', non_empty => 1,
desc => 'The procedure for which to install the menu path' },
{ name => 'authors', type => 'string', null_ok => 1,
{ name => 'authors', type => 'string', none_ok => 1,
desc => 'Authors of the procedure' },
{ name => 'copyright', type => 'string', null_ok => 1,
{ name => 'copyright', type => 'string', none_ok => 1,
desc => 'The copyright' },
{ name => 'date', type => 'string', null_ok => 1,
{ name => 'date', type => 'string', none_ok => 1,
desc => 'Copyright date' }
);

View File

@@ -29,7 +29,7 @@ HELP
$lib_private = 1;
@inargs = (
{ name => 'message', type => 'string', null_ok => 1,
{ name => 'message', type => 'string', none_ok => 1,
desc => 'Message to use in the progress dialog' },
{ name => 'gdisplay', type => 'display', none_ok => 1,
desc => 'GimpDisplay to update progressbar in, or %NULL for a separate
@@ -130,7 +130,7 @@ HELP
&neo_pdb_misc('2005', '2.4');
@inargs = (
{ name => 'message', type => 'string', null_ok => 1,
{ name => 'message', type => 'string', none_ok => 1,
desc => 'Message to use in the progress dialog' }
);