app, libgimp*: GimpParamSpecCoreObjectArray struct hidden too.

New libgimpbase function: gimp_param_spec_core_object_array_get_object_type()
This commit is contained in:
Jehan 2025-01-25 00:02:29 +01:00
parent b51f2b5252
commit f09d97b9a5
7 changed files with 44 additions and 28 deletions

View file

@ -672,8 +672,7 @@ gimp_plug_in_procedure_add_menu_path (GimpPlugInProcedure *proc,
}
else
{
GimpParamSpecCoreObjectArray *spec = GIMP_PARAM_SPEC_CORE_OBJECT_ARRAY (procedure->args[2]);
const gchar *type_name = g_type_name (spec->object_type);
const gchar *type_name = g_type_name (gimp_param_spec_core_object_array_get_object_type (procedure->args[2]));
if (g_strcmp0 (type_name, "GimpDrawable") != 0 &&
g_strcmp0 (type_name, "GimpLayer") != 0)
@ -695,8 +694,7 @@ gimp_plug_in_procedure_add_menu_path (GimpPlugInProcedure *proc,
}
else
{
GimpParamSpecCoreObjectArray *spec = GIMP_PARAM_SPEC_CORE_OBJECT_ARRAY (procedure->args[2]);
const gchar *type_name = g_type_name (spec->object_type);
const gchar *type_name = g_type_name (gimp_param_spec_core_object_array_get_object_type (procedure->args[2]));
if (g_strcmp0 (type_name, "GimpDrawable") != 0 &&
g_strcmp0 (type_name, "GimpChannel") != 0)

View file

@ -685,7 +685,7 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
param_def->param_def_type = GP_PARAM_DEF_TYPE_ID_ARRAY;
param_def->meta.m_id_array.type_name =
(gchar *) g_type_name (GIMP_PARAM_SPEC_CORE_OBJECT_ARRAY (pspec)->object_type);
(gchar *) g_type_name (gimp_param_spec_core_object_array_get_object_type (pspec));
}
else if (pspec_type == GIMP_TYPE_PARAM_EXPORT_OPTIONS)
{
@ -1090,7 +1090,7 @@ gimp_gp_param_to_value (gpointer gimp,
}
else if (pspec != NULL)
{
object_type = GIMP_PARAM_SPEC_CORE_OBJECT_ARRAY (pspec)->object_type;
object_type = gimp_param_spec_core_object_array_get_object_type (pspec);
}
if (param->data.d_id_array.size > 1 && ! g_type_is_a (object_type, G_TYPE_OBJECT))

View file

@ -450,7 +450,7 @@ gimp_procedure_config_save_metadata (GimpProcedureConfig *config,
/**
* gimp_procedure_config_get_core_object_array:
* @config: a #GimpProcedureConfig
* @property_name: the name of a [struct@ParamSpecCoreObjectArray] param spec.
* @property_name: the name of a #GimpParamSpecCoreObjectArray param spec.
*
* A function for bindings to get a [type@CoreObjectArray] property. Getting
* these with [method@GObject.Object.get] or [method@GObject.Object.get_property] won't
@ -501,7 +501,7 @@ gimp_procedure_config_get_core_object_array (GimpProcedureConfig *config,
/**
* gimp_procedure_config_set_core_object_array:
* @config: a #GimpProcedureConfig
* @property_name: the name of a [struct@ParamSpecCoreObjectArray] param spec.
* @property_name: the name of a #GimpParamSpecCoreObjectArray param spec.
* @objects: (array length=n_objects) (transfer none): an array of #GObjects.
* @n_objects: the numbers of @objects.
*
@ -560,7 +560,7 @@ gimp_procedure_config_set_core_object_array (GimpProcedureConfig *config,
/**
* gimp_procedure_config_get_color_array:
* @config: a #GimpProcedureConfig
* @property_name: the name of a [struct@ParamSpecCoreObjectArray] param spec.
* @property_name: the name of a #GParamSpecBoxed param spec with [type@ColorArray] value type.
*
* A function for bindings to get a [type@ColorArray] property. Getting
* these with [method@GObject.Object.get] or [method@GObject.Object.get_property] won't
@ -612,7 +612,7 @@ gimp_procedure_config_get_color_array (GimpProcedureConfig *config,
/**
* gimp_procedure_config_set_color_array:
* @config: a #GimpProcedureConfig
* @property_name: the name of a [struct@ParamSpecCoreObjectArray] param spec.
* @property_name: the name of a #GParamSpecBoxed param spec with [type@ColorArray] value type.
* @colors: (array length=n_colors) (transfer none): an array of [class@Gegl.Color].
* @n_colors: the numbers of @colors.
*

View file

@ -141,6 +141,7 @@ EXPORTS
gimp_param_spec_array
gimp_param_spec_choice
gimp_param_spec_core_object_array
gimp_param_spec_core_object_array_get_object_type
gimp_param_spec_double_array
gimp_param_spec_export_options
gimp_param_spec_file

View file

@ -1323,6 +1323,17 @@ gimp_core_object_array_copy (GimpCoreObjectArray array)
* GIMP_TYPE_PARAM_CORE_OBJECT_ARRAY
*/
#define GIMP_PARAM_SPEC_CORE_OBJECT_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_CORE_OBJECT_ARRAY, GimpParamSpecCoreObjectArray))
typedef struct _GimpParamSpecCoreObjectArray GimpParamSpecCoreObjectArray;
struct _GimpParamSpecCoreObjectArray
{
GParamSpecBoxed parent_instance;
GType object_type;
};
static void gimp_param_core_object_array_class_init (GParamSpecClass *klass);
static void gimp_param_core_object_array_init (GParamSpec *pspec);
static gboolean gimp_param_core_object_array_validate (GParamSpec *pspec,
@ -1463,3 +1474,19 @@ gimp_param_spec_core_object_array (const gchar *name,
return G_PARAM_SPEC (array_spec);
}
/**
* gimp_param_spec_core_object_array_get_object_type:
* @pspec: a #GParamSpec to hold a #GimpParamSpecCoreObjectArray value.
*
* Returns: the type for objects in the object array.
*
* Since: 3.0
**/
GType
gimp_param_spec_core_object_array_get_object_type (GParamSpec *pspec)
{
g_return_val_if_fail (GIMP_IS_PARAM_SPEC_CORE_OBJECT_ARRAY (pspec), G_TYPE_NONE);
return GIMP_PARAM_SPEC_CORE_OBJECT_ARRAY (pspec)->object_type;
}

View file

@ -396,18 +396,8 @@ gsize gimp_core_object_array_get_length (GObject **array);
*/
#define GIMP_TYPE_PARAM_CORE_OBJECT_ARRAY (gimp_param_core_object_array_get_type ())
#define GIMP_PARAM_SPEC_CORE_OBJECT_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_CORE_OBJECT_ARRAY, GimpParamSpecCoreObjectArray))
#define GIMP_IS_PARAM_SPEC_CORE_OBJECT_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_CORE_OBJECT_ARRAY))
typedef struct _GimpParamSpecCoreObjectArray GimpParamSpecCoreObjectArray;
struct _GimpParamSpecCoreObjectArray
{
GParamSpecBoxed parent_instance;
GType object_type;
};
GType gimp_param_core_object_array_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_core_object_array (const gchar *name,
@ -416,6 +406,8 @@ GParamSpec * gimp_param_spec_core_object_array (const gchar *name,
GType object_type,
GParamFlags flags);
GType gimp_param_spec_core_object_array_get_object_type (GParamSpec *pspec);
G_END_DECLS

View file

@ -295,10 +295,8 @@ gimp_config_param_spec_duplicate (GParamSpec *pspec)
}
else if (GIMP_IS_PARAM_SPEC_CORE_OBJECT_ARRAY (pspec))
{
GimpParamSpecCoreObjectArray *spec = GIMP_PARAM_SPEC_CORE_OBJECT_ARRAY (pspec);
copy = gimp_param_spec_core_object_array (name, nick, blurb,
spec->object_type,
gimp_param_spec_core_object_array_get_object_type (pspec),
flags);
}
else if (GIMP_IS_PARAM_SPEC_EXPORT_OPTIONS (pspec))