Drop an unnecessary argument from G_DEFINE_PROPERTIES

By renaming the variable holding the properties array (which can also
conflict with existing code) we can avoid the lowercase type name.
This commit is contained in:
Emmanuele Bassi 2013-06-27 15:07:26 +01:00
parent 55941c1e1a
commit a2a6cb2058
3 changed files with 14 additions and 15 deletions

View File

@ -497,18 +497,17 @@ void g_property_init_default (GProperty *property,
GPtrArray *g_define_properties = g_ptr_array_new (); \
g_ptr_array_add (g_define_properties, NULL);
#define _G_DEFINE_PROPERTIES_END(T_N, t_n, g_class) \
t_n##_properties_len = g_define_properties->len; \
t_n##_properties = (GParamSpec **) g_ptr_array_free (g_define_properties, FALSE); \
#define _G_DEFINE_PROPERTIES_END(TypeName, g_class) \
TypeName##_properties_len = g_define_properties->len; \
TypeName##_properties = (GParamSpec **) g_ptr_array_free (g_define_properties, FALSE); \
g_object_class_install_properties (G_OBJECT_CLASS (g_class), \
t_n##_properties_len, \
t_n##_properties); \
TypeName##_properties_len, \
TypeName##_properties); \
}
/**
* G_DEFINE_PROPERTIES:
* @T_N: the name of the type, in CamelCase
* @t_n: the name of the type, in lower case, with spaces replaced by underscores
* @g_class: a pointer to the class structure of the type
* @_C_: a list of G_DEFINE_PROPERTY_EXTENDED calls
*
@ -520,10 +519,10 @@ void g_property_init_default (GProperty *property,
*
* Since: 2.38
*/
#define G_DEFINE_PROPERTIES(T_N, t_n, g_class, _C_) \
#define G_DEFINE_PROPERTIES(T_N, g_class, _C_) \
_G_DEFINE_PROPERTIES_BEGIN() \
{ _C_; } \
_G_DEFINE_PROPERTIES_END(T_N, t_n, g_class)
_G_DEFINE_PROPERTIES_END(T_N, g_class)
#define _G_DEFINE_DIRECT_PROPERTY_EXTENDED_BEGIN(T_N, c_type, name, flags) \
{ \
@ -711,9 +710,9 @@ void g_property_init_default (GProperty *property,
const char *pname = g_property_canonicalize_name (#f_n); \
int i; \
\
for (i = 1; i < t_n##_properties_len; i++) \
for (i = 1; i < T_N##_properties_len; i++) \
{ \
GParamSpec *pspec = t_n##_properties[i]; \
GParamSpec *pspec = T_N##_properties[i]; \
if (pspec != NULL && pspec->name == pname) \
{ \
g_property = (GProperty *) pspec; \
@ -755,9 +754,9 @@ void g_property_init_default (GProperty *property,
const char *pname = g_property_canonicalize_name (#f_n); \
int i; \
\
for (i = 1; i < t_n##_properties_len; i++) \
for (i = 1; i < T_N##_properties_len; i++) \
{ \
GParamSpec *pspec = t_n##_properties[i]; \
GParamSpec *pspec = T_N##_properties[i]; \
if (pspec != NULL && pspec->name == pname) \
{ \
g_property = (GProperty *) pspec; \

View File

@ -1665,8 +1665,8 @@ static void type_name##_init (TypeName *self); \
static void type_name##_class_init (TypeName##Class *klass); \
static gpointer type_name##_parent_class = NULL; \
static gint TypeName##_private_offset; \
static GParamSpec **type_name##_properties G_GNUC_UNUSED; \
static guint type_name##_properties_len G_GNUC_UNUSED; \
static GParamSpec **TypeName##_properties G_GNUC_UNUSED; \
static guint TypeName##_properties_len G_GNUC_UNUSED; \
\
_G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \
\

View File

@ -118,7 +118,7 @@ test_object_class_init (TestObjectClass *klass)
gobject_class->constructed = test_object_constructed;
gobject_class->finalize = test_object_finalize;
G_DEFINE_PROPERTIES (TestObject, test_object, klass,
G_DEFINE_PROPERTIES (TestObject, klass,
G_DEFINE_PROPERTY (TestObject,
int,
integer_val,