libgimpbase: Use G_DEFINE_BOXED_TYPE()

This isn't any functional change, but allows us to get rid of some of
the GObject boilerplate.
This commit is contained in:
Niels De Graef 2019-07-17 07:02:04 +02:00 committed by Jehan
parent cb0ae619d1
commit a551043ffe
2 changed files with 14 additions and 113 deletions

View File

@ -69,18 +69,7 @@ gimp_array_free (GimpArray *array)
} }
} }
GType G_DEFINE_BOXED_TYPE (GimpArray, gimp_array, gimp_array_copy, gimp_array_free)
gimp_array_get_type (void)
{
static GType type = 0;
if (! type)
type = g_boxed_type_register_static ("GimpArray",
(GBoxedCopyFunc) gimp_array_copy,
(GBoxedFreeFunc) gimp_array_free);
return type;
}
/* /*
@ -263,19 +252,8 @@ gimp_value_take_array (GValue *value,
* GIMP_TYPE_UINT8_ARRAY * GIMP_TYPE_UINT8_ARRAY
*/ */
GType typedef GimpArray GimpUint8Array;
gimp_uint8_array_get_type (void) G_DEFINE_BOXED_TYPE (GimpUint8Array, gimp_uint8_array, gimp_array_copy, gimp_array_free)
{
static GType type = 0;
if (! type)
type = g_boxed_type_register_static ("GimpUInt8Array",
(GBoxedCopyFunc) gimp_array_copy,
(GBoxedFreeFunc) gimp_array_free);
return type;
}
/* /*
* GIMP_TYPE_PARAM_UINT8_ARRAY * GIMP_TYPE_PARAM_UINT8_ARRAY
@ -401,18 +379,8 @@ gimp_value_take_uint8_array (GValue *value,
* GIMP_TYPE_INT16_ARRAY * GIMP_TYPE_INT16_ARRAY
*/ */
GType typedef GimpArray GimpInt16Array;
gimp_int16_array_get_type (void) G_DEFINE_BOXED_TYPE (GimpInt16Array, gimp_int16_array, gimp_array_copy, gimp_array_free)
{
static GType type = 0;
if (! type)
type = g_boxed_type_register_static ("GimpInt16Array",
(GBoxedCopyFunc) gimp_array_copy,
(GBoxedFreeFunc) gimp_array_free);
return type;
}
/* /*
@ -542,19 +510,8 @@ gimp_value_take_int16_array (GValue *value,
* GIMP_TYPE_INT32_ARRAY * GIMP_TYPE_INT32_ARRAY
*/ */
GType typedef GimpArray GimpInt32Array;
gimp_int32_array_get_type (void) G_DEFINE_BOXED_TYPE (GimpInt32Array, gimp_int32_array, gimp_array_copy, gimp_array_free)
{
static GType type = 0;
if (! type)
type = g_boxed_type_register_static ("GimpInt32Array",
(GBoxedCopyFunc) gimp_array_copy,
(GBoxedFreeFunc) gimp_array_free);
return type;
}
/* /*
* GIMP_TYPE_PARAM_INT32_ARRAY * GIMP_TYPE_PARAM_INT32_ARRAY
@ -683,19 +640,8 @@ gimp_value_take_int32_array (GValue *value,
* GIMP_TYPE_FLOAT_ARRAY * GIMP_TYPE_FLOAT_ARRAY
*/ */
GType typedef GimpArray GimpFloatArray;
gimp_float_array_get_type (void) G_DEFINE_BOXED_TYPE (GimpFloatArray, gimp_float_array, gimp_array_copy, gimp_array_free)
{
static GType type = 0;
if (! type)
type = g_boxed_type_register_static ("GimpFloatArray",
(GBoxedCopyFunc) gimp_array_copy,
(GBoxedFreeFunc) gimp_array_free);
return type;
}
/* /*
* GIMP_TYPE_PARAM_FLOAT_ARRAY * GIMP_TYPE_PARAM_FLOAT_ARRAY
@ -911,19 +857,7 @@ gimp_string_array_free (GimpStringArray *array)
} }
} }
GType G_DEFINE_BOXED_TYPE (GimpStringArray, gimp_string_array, gimp_string_array_copy, gimp_string_array_free)
gimp_string_array_get_type (void)
{
static GType type = 0;
if (! type)
type = g_boxed_type_register_static ("GimpStringArray",
(GBoxedCopyFunc) gimp_string_array_copy,
(GBoxedFreeFunc) gimp_string_array_free);
return type;
}
/* /*
* GIMP_TYPE_PARAM_STRING_ARRAY * GIMP_TYPE_PARAM_STRING_ARRAY
@ -1146,18 +1080,8 @@ gimp_value_take_string_array (GValue *value,
* GIMP_TYPE_RGB_ARRAY * GIMP_TYPE_RGB_ARRAY
*/ */
GType typedef GimpArray GimpRGBArray;
gimp_rgb_array_get_type (void) G_DEFINE_BOXED_TYPE (GimpRGBArray, gimp_rgb_array, gimp_array_copy, gimp_array_free)
{
static GType type = 0;
if (! type)
type = g_boxed_type_register_static ("GimpRGBArray",
(GBoxedCopyFunc) gimp_array_copy,
(GBoxedFreeFunc) gimp_array_free);
return type;
}
/* /*
@ -1380,18 +1304,7 @@ gimp_object_array_free (GimpObjectArray *array)
} }
} }
GType G_DEFINE_BOXED_TYPE (GimpObjectArray, gimp_object_array, gimp_object_array_copy, gimp_object_array_free)
gimp_object_array_get_type (void)
{
static GType type = 0;
if (! type)
type = g_boxed_type_register_static ("GimpObjectArray",
(GBoxedCopyFunc) gimp_object_array_copy,
(GBoxedFreeFunc) gimp_object_array_free);
return type;
}
/* /*

View File

@ -55,19 +55,7 @@
* GIMP_TYPE_PARASITE * GIMP_TYPE_PARASITE
*/ */
GType G_DEFINE_BOXED_TYPE (GimpParasite, gimp_parasite, gimp_parasite_copy, gimp_parasite_free)
gimp_parasite_get_type (void)
{
static GType type = 0;
if (! type)
type = g_boxed_type_register_static ("GimpParasite",
(GBoxedCopyFunc) gimp_parasite_copy,
(GBoxedFreeFunc) gimp_parasite_free);
return type;
}
/* /*
* GIMP_TYPE_PARAM_PARASITE * GIMP_TYPE_PARAM_PARASITE