libgimp: also hide structs for GimpParamSpec(Display|Drawable|Image|Item).

New libgimp functions:

- gimp_param_spec_display_none_allowed()
- gimp_param_spec_drawable_filter_none_allowed()
- gimp_param_spec_image_none_allowed()
- gimp_param_spec_item_none_allowed()

I believe that now all param spec strucs which needed to be hidden are
effectively hidden!
This commit is contained in:
Jehan 2025-01-25 16:38:26 +01:00
parent ae6ab8bc57
commit 094414186b
4 changed files with 144 additions and 72 deletions

View File

@ -722,14 +722,18 @@ EXPORTS
gimp_param_spec_brush
gimp_param_spec_channel
gimp_param_spec_display
gimp_param_spec_display_none_allowed
gimp_param_spec_drawable
gimp_param_spec_drawable_filter
gimp_param_spec_drawable_filter_none_allowed
gimp_param_spec_font
gimp_param_spec_get_desc
gimp_param_spec_gradient
gimp_param_spec_group_layer
gimp_param_spec_image
gimp_param_spec_image_none_allowed
gimp_param_spec_item
gimp_param_spec_item_none_allowed
gimp_param_spec_layer
gimp_param_spec_layer_mask
gimp_param_spec_palette

View File

@ -620,35 +620,27 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
}
else if (pspec_type == GIMP_TYPE_PARAM_IMAGE)
{
GimpParamSpecImage *ispec = GIMP_PARAM_SPEC_IMAGE (pspec);
param_def->param_def_type = GP_PARAM_DEF_TYPE_ID;
param_def->meta.m_id.none_ok = ispec->none_ok;
param_def->meta.m_id.none_ok = gimp_param_spec_image_none_allowed (pspec);
}
else if (GIMP_IS_PARAM_SPEC_ITEM (pspec))
{
GimpParamSpecItem *ispec = GIMP_PARAM_SPEC_ITEM (pspec);
param_def->param_def_type = GP_PARAM_DEF_TYPE_ID;
param_def->meta.m_id.none_ok = ispec->none_ok;
param_def->meta.m_id.none_ok = gimp_param_spec_item_none_allowed (pspec);
}
else if (GIMP_IS_PARAM_SPEC_DRAWABLE_FILTER (pspec))
{
GimpParamSpecDrawableFilter *fspec = GIMP_PARAM_SPEC_DRAWABLE_FILTER (pspec);
param_def->param_def_type = GP_PARAM_DEF_TYPE_ID;
param_def->meta.m_id.none_ok = fspec->none_ok;
param_def->meta.m_id.none_ok = gimp_param_spec_drawable_filter_none_allowed (pspec);
}
else if (pspec_type == GIMP_TYPE_PARAM_DISPLAY)
{
GimpParamSpecDisplay *ispec = GIMP_PARAM_SPEC_DISPLAY (pspec);
param_def->param_def_type = GP_PARAM_DEF_TYPE_ID;
param_def->meta.m_id.none_ok = ispec->none_ok;
param_def->meta.m_id.none_ok = gimp_param_spec_display_none_allowed (pspec);
}
else if (GIMP_IS_PARAM_SPEC_RESOURCE (pspec))
{

View File

@ -28,6 +28,17 @@
* GIMP_TYPE_PARAM_IMAGE
*/
#define GIMP_PARAM_SPEC_IMAGE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_IMAGE, GimpParamSpecImage))
typedef struct _GimpParamSpecImage GimpParamSpecImage;
struct _GimpParamSpecImage
{
GParamSpecObject parent_instance;
gboolean none_ok;
};
static void gimp_param_image_class_init (GParamSpecClass *klass);
static void gimp_param_image_init (GParamSpec *pspec);
static gboolean gimp_param_image_validate (GParamSpec *pspec,
@ -130,11 +141,38 @@ gimp_param_spec_image (const gchar *name,
return G_PARAM_SPEC (ispec);
}
/**
* gimp_param_spec_image_none_allowed:
* @pspec: a #GParamSpec to hold a [class@Gimp.Image] value.
*
* Returns: %TRUE if a %NULL value is allowed.
*
* Since: 3.0
**/
gboolean
gimp_param_spec_image_none_allowed (GParamSpec *pspec)
{
g_return_val_if_fail (GIMP_IS_PARAM_SPEC_IMAGE (pspec), FALSE);
return GIMP_PARAM_SPEC_IMAGE (pspec)->none_ok;
}
/*
* GIMP_TYPE_PARAM_ITEM
*/
#define GIMP_PARAM_SPEC_ITEM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_ITEM, GimpParamSpecItem))
typedef struct _GimpParamSpecItem GimpParamSpecItem;
struct _GimpParamSpecItem
{
GParamSpecObject parent_instance;
gboolean none_ok;
};
static void gimp_param_item_class_init (GParamSpecClass *klass);
static void gimp_param_item_init (GParamSpec *pspec);
static gboolean gimp_param_item_validate (GParamSpec *pspec,
@ -237,6 +275,22 @@ gimp_param_spec_item (const gchar *name,
return G_PARAM_SPEC (ispec);
}
/**
* gimp_param_spec_item_none_allowed:
* @pspec: a #GParamSpec to hold a [class@Gimp.Item] value.
*
* Returns: %TRUE if a %NULL value is allowed.
*
* Since: 3.0
**/
gboolean
gimp_param_spec_item_none_allowed (GParamSpec *pspec)
{
g_return_val_if_fail (GIMP_IS_PARAM_SPEC_ITEM (pspec), FALSE);
return GIMP_PARAM_SPEC_ITEM (pspec)->none_ok;
}
/*
* GIMP_TYPE_PARAM_DRAWABLE
@ -882,6 +936,17 @@ gimp_param_spec_path (const gchar *name,
* GIMP_TYPE_PARAM_DRAWABLE_FILTER
*/
#define GIMP_PARAM_SPEC_DRAWABLE_FILTER(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_DRAWABLE_FILTER, GimpParamSpecDrawableFilter))
typedef struct _GimpParamSpecDrawableFilter GimpParamSpecDrawableFilter;
struct _GimpParamSpecDrawableFilter
{
GParamSpecObject parent_instance;
gboolean none_ok;
};
static void gimp_param_drawable_filter_class_init (GParamSpecClass *klass);
static void gimp_param_drawable_filter_init (GParamSpec *pspec);
@ -957,11 +1022,38 @@ gimp_param_spec_drawable_filter (const gchar *name,
return G_PARAM_SPEC (fspec);
}
/**
* gimp_param_spec_drawable_filter_none_allowed:
* @pspec: a #GParamSpec to hold a [class@Gimp.DrawableFilter] value.
*
* Returns: %TRUE if a %NULL value is allowed.
*
* Since: 3.0
**/
gboolean
gimp_param_spec_drawable_filter_none_allowed (GParamSpec *pspec)
{
g_return_val_if_fail (GIMP_IS_PARAM_SPEC_DRAWABLE_FILTER (pspec), FALSE);
return GIMP_PARAM_SPEC_DRAWABLE_FILTER (pspec)->none_ok;
}
/*
* GIMP_TYPE_PARAM_DISPLAY
*/
#define GIMP_PARAM_SPEC_DISPLAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_DISPLAY, GimpParamSpecDisplay))
typedef struct _GimpParamSpecDisplay GimpParamSpecDisplay;
struct _GimpParamSpecDisplay
{
GParamSpecObject parent_instance;
gboolean none_ok;
};
static void gimp_param_display_class_init (GParamSpecClass *klass);
static void gimp_param_display_init (GParamSpec *pspec);
static gboolean gimp_param_display_validate (GParamSpec *pspec,
@ -1064,6 +1156,22 @@ gimp_param_spec_display (const gchar *name,
return G_PARAM_SPEC (dspec);
}
/**
* gimp_param_spec_display_none_allowed:
* @pspec: a #GParamSpec to hold a [class@Gimp.Display] value.
*
* Returns: %TRUE if a %NULL value is allowed.
*
* Since: 3.0
**/
gboolean
gimp_param_spec_display_none_allowed (GParamSpec *pspec)
{
g_return_val_if_fail (GIMP_IS_PARAM_SPEC_DISPLAY (pspec), FALSE);
return GIMP_PARAM_SPEC_DISPLAY (pspec)->none_ok;
}
/*
* GIMP_TYPE_PARAM_RESOURCE

View File

@ -38,25 +38,17 @@ G_BEGIN_DECLS
GIMP_TYPE_IMAGE))
#define GIMP_TYPE_PARAM_IMAGE (gimp_param_image_get_type ())
#define GIMP_PARAM_SPEC_IMAGE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_IMAGE, GimpParamSpecImage))
#define GIMP_IS_PARAM_SPEC_IMAGE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_IMAGE))
typedef struct _GimpParamSpecImage GimpParamSpecImage;
GType gimp_param_image_get_type (void) G_GNUC_CONST;
struct _GimpParamSpecImage
{
GParamSpecObject parent_instance;
GParamSpec * gimp_param_spec_image (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean none_ok,
GParamFlags flags);
gboolean none_ok;
};
GType gimp_param_image_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_image (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean none_ok,
GParamFlags flags);
gboolean gimp_param_spec_image_none_allowed (GParamSpec *pspec);
/*
@ -67,25 +59,17 @@ GParamSpec * gimp_param_spec_image (const gchar *name,
GIMP_TYPE_ITEM))
#define GIMP_TYPE_PARAM_ITEM (gimp_param_item_get_type ())
#define GIMP_PARAM_SPEC_ITEM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_ITEM, GimpParamSpecItem))
#define GIMP_IS_PARAM_SPEC_ITEM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_ITEM))
typedef struct _GimpParamSpecItem GimpParamSpecItem;
GType gimp_param_item_get_type (void) G_GNUC_CONST;
struct _GimpParamSpecItem
{
GParamSpecObject parent_instance;
GParamSpec * gimp_param_spec_item (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean none_ok,
GParamFlags flags);
gboolean none_ok;
};
GType gimp_param_item_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_item (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean none_ok,
GParamFlags flags);
gboolean gimp_param_spec_item_none_allowed (GParamSpec *pspec);
/*
@ -248,25 +232,17 @@ GParamSpec * gimp_param_spec_path (const gchar *name,
GIMP_TYPE_DRAWABLE_FILTER))
#define GIMP_TYPE_PARAM_DRAWABLE_FILTER (gimp_param_drawable_filter_get_type ())
#define GIMP_PARAM_SPEC_DRAWABLE_FILTER(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_DRAWABLE_FILTER, GimpParamSpecDrawableFilter))
#define GIMP_IS_PARAM_SPEC_DRAWABLE_FILTER(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_DRAWABLE_FILTER))
typedef struct _GimpParamSpecDrawableFilter GimpParamSpecDrawableFilter;
GType gimp_param_drawable_filter_get_type (void) G_GNUC_CONST;
struct _GimpParamSpecDrawableFilter
{
GParamSpecObject parent_instance;
GParamSpec * gimp_param_spec_drawable_filter (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean none_ok,
GParamFlags flags);
gboolean none_ok;
};
GType gimp_param_drawable_filter_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_drawable_filter (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean none_ok,
GParamFlags flags);
gboolean gimp_param_spec_drawable_filter_none_allowed (GParamSpec *pspec);
/*
@ -277,25 +253,17 @@ GParamSpec * gimp_param_spec_drawable_filter (const gchar *name,
GIMP_TYPE_DISPLAY))
#define GIMP_TYPE_PARAM_DISPLAY (gimp_param_display_get_type ())
#define GIMP_PARAM_SPEC_DISPLAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_DISPLAY, GimpParamSpecDisplay))
#define GIMP_IS_PARAM_SPEC_DISPLAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_DISPLAY))
typedef struct _GimpParamSpecDisplay GimpParamSpecDisplay;
GType gimp_param_display_get_type (void) G_GNUC_CONST;
struct _GimpParamSpecDisplay
{
GParamSpecObject parent_instance;
GParamSpec * gimp_param_spec_display (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean none_ok,
GParamFlags flags);
gboolean none_ok;
};
GType gimp_param_display_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_display (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean none_ok,
GParamFlags flags);
gboolean gimp_param_spec_display_none_allowed (GParamSpec *pspec);
/*