styleproperty: Remove unuse args from register()

Those arguments are only relevant for shorthands.
This commit is contained in:
Benjamin Otte 2011-12-31 15:50:56 +01:00
parent 927b922208
commit a3a580d53e
3 changed files with 37 additions and 116 deletions

View File

@ -377,9 +377,6 @@ gtk_style_properties_register_property (GtkStylePropertyParser parse_func,
parse_func, parse_func,
NULL, NULL,
NULL, NULL,
NULL,
NULL,
NULL,
NULL); NULL);
} }

View File

@ -2095,10 +2095,7 @@ gtk_style_property_init_properties (void)
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, &value);
NULL,
&value,
NULL);
rgba_init (&rgba, 0, 0, 0, 0); rgba_init (&rgba, 0, 0, 0, 0);
g_value_set_boxed (&value, &rgba); g_value_set_boxed (&value, &rgba);
_gtk_style_property_register (g_param_spec_boxed ("background-color", _gtk_style_property_register (g_param_spec_boxed ("background-color",
@ -2107,12 +2104,9 @@ gtk_style_property_init_properties (void)
GDK_TYPE_RGBA, 0), GDK_TYPE_RGBA, 0),
0, 0,
NULL, NULL,
NULL,
NULL,
transparent_color_value_parse, transparent_color_value_parse,
NULL, NULL,
&value, &value);
NULL);
g_value_unset (&value); g_value_unset (&value);
g_value_init (&value, G_TYPE_STRV); g_value_init (&value, G_TYPE_STRV);
@ -2123,12 +2117,9 @@ gtk_style_property_init_properties (void)
G_TYPE_STRV, 0), G_TYPE_STRV, 0),
GTK_STYLE_PROPERTY_INHERIT, GTK_STYLE_PROPERTY_INHERIT,
NULL, NULL,
NULL,
NULL,
font_family_parse, font_family_parse,
font_family_value_print, font_family_value_print,
&value, &value);
NULL);
g_value_unset (&value); g_value_unset (&value);
_gtk_style_property_register (g_param_spec_enum ("font-style", _gtk_style_property_register (g_param_spec_enum ("font-style",
"Font style", "Font style",
@ -2139,9 +2130,6 @@ gtk_style_property_init_properties (void)
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL,
NULL,
NULL,
NULL); NULL);
_gtk_style_property_register (g_param_spec_enum ("font-variant", _gtk_style_property_register (g_param_spec_enum ("font-variant",
"Font variant", "Font variant",
@ -2152,9 +2140,6 @@ gtk_style_property_init_properties (void)
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL,
NULL,
NULL,
NULL); NULL);
/* xxx: need to parse this properly, ie parse the numbers */ /* xxx: need to parse this properly, ie parse the numbers */
_gtk_style_property_register (g_param_spec_enum ("font-weight", _gtk_style_property_register (g_param_spec_enum ("font-weight",
@ -2166,9 +2151,6 @@ gtk_style_property_init_properties (void)
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL,
NULL,
NULL,
NULL); NULL);
g_value_init (&value, G_TYPE_DOUBLE); g_value_init (&value, G_TYPE_DOUBLE);
g_value_set_double (&value, 10); g_value_set_double (&value, 10);
@ -2180,10 +2162,7 @@ gtk_style_property_init_properties (void)
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, &value);
NULL,
&value,
NULL);
g_value_unset (&value); g_value_unset (&value);
_gtk_style_property_register (g_param_spec_boxed ("text-shadow", _gtk_style_property_register (g_param_spec_boxed ("text-shadow",
@ -2194,9 +2173,6 @@ gtk_style_property_init_properties (void)
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL,
NULL,
NULL,
NULL); NULL);
_gtk_style_property_register (g_param_spec_boxed ("icon-shadow", _gtk_style_property_register (g_param_spec_boxed ("icon-shadow",
@ -2207,9 +2183,6 @@ gtk_style_property_init_properties (void)
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL,
NULL,
NULL,
NULL); NULL);
gtk_style_properties_register_property (NULL, gtk_style_properties_register_property (NULL,
@ -2284,11 +2257,8 @@ gtk_style_property_init_properties (void)
GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0), GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0),
0, 0,
NULL, NULL,
NULL,
NULL,
border_corner_radius_value_parse, border_corner_radius_value_parse,
border_corner_radius_value_print, border_corner_radius_value_print,
NULL,
NULL); NULL);
_gtk_style_property_register (g_param_spec_boxed ("border-top-right-radius", _gtk_style_property_register (g_param_spec_boxed ("border-top-right-radius",
"Border top right radius", "Border top right radius",
@ -2296,11 +2266,8 @@ gtk_style_property_init_properties (void)
GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0), GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0),
0, 0,
NULL, NULL,
NULL,
NULL,
border_corner_radius_value_parse, border_corner_radius_value_parse,
border_corner_radius_value_print, border_corner_radius_value_print,
NULL,
NULL); NULL);
_gtk_style_property_register (g_param_spec_boxed ("border-bottom-right-radius", _gtk_style_property_register (g_param_spec_boxed ("border-bottom-right-radius",
"Border bottom right radius", "Border bottom right radius",
@ -2308,11 +2275,8 @@ gtk_style_property_init_properties (void)
GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0), GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0),
0, 0,
NULL, NULL,
NULL,
NULL,
border_corner_radius_value_parse, border_corner_radius_value_parse,
border_corner_radius_value_print, border_corner_radius_value_print,
NULL,
NULL); NULL);
_gtk_style_property_register (g_param_spec_boxed ("border-bottom-left-radius", _gtk_style_property_register (g_param_spec_boxed ("border-bottom-left-radius",
"Border bottom left radius", "Border bottom left radius",
@ -2320,11 +2284,8 @@ gtk_style_property_init_properties (void)
GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0), GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0),
0, 0,
NULL, NULL,
NULL,
NULL,
border_corner_radius_value_parse, border_corner_radius_value_parse,
border_corner_radius_value_print, border_corner_radius_value_print,
NULL,
NULL); NULL);
gtk_style_properties_register_property (NULL, gtk_style_properties_register_property (NULL,
@ -2353,48 +2314,36 @@ gtk_style_property_init_properties (void)
GDK_TYPE_RGBA, 0), GDK_TYPE_RGBA, 0),
0, 0,
NULL, NULL,
NULL,
NULL,
transparent_color_value_parse, transparent_color_value_parse,
NULL, NULL,
&value, &value);
NULL);
_gtk_style_property_register (g_param_spec_boxed ("border-right-color", _gtk_style_property_register (g_param_spec_boxed ("border-right-color",
"Border right color", "Border right color",
"Border right color", "Border right color",
GDK_TYPE_RGBA, 0), GDK_TYPE_RGBA, 0),
0, 0,
NULL, NULL,
NULL,
NULL,
transparent_color_value_parse, transparent_color_value_parse,
NULL, NULL,
&value, &value);
NULL);
_gtk_style_property_register (g_param_spec_boxed ("border-bottom-color", _gtk_style_property_register (g_param_spec_boxed ("border-bottom-color",
"Border bottom color", "Border bottom color",
"Border bottom color", "Border bottom color",
GDK_TYPE_RGBA, 0), GDK_TYPE_RGBA, 0),
0, 0,
NULL, NULL,
NULL,
NULL,
transparent_color_value_parse, transparent_color_value_parse,
NULL, NULL,
&value, &value);
NULL);
_gtk_style_property_register (g_param_spec_boxed ("border-left-color", _gtk_style_property_register (g_param_spec_boxed ("border-left-color",
"Border left color", "Border left color",
"Border left color", "Border left color",
GDK_TYPE_RGBA, 0), GDK_TYPE_RGBA, 0),
0, 0,
NULL, NULL,
NULL,
NULL,
transparent_color_value_parse, transparent_color_value_parse,
NULL, NULL,
&value, &value);
NULL);
g_value_unset (&value); g_value_unset (&value);
gtk_style_properties_register_property (NULL, gtk_style_properties_register_property (NULL,
@ -2432,10 +2381,7 @@ gtk_style_property_init_properties (void)
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, &value);
NULL,
&value,
NULL);
g_value_unset (&value); g_value_unset (&value);
gtk_style_properties_register_property (NULL, gtk_style_properties_register_property (NULL,
g_param_spec_object ("engine", g_param_spec_object ("engine",
@ -2455,11 +2401,8 @@ gtk_style_property_init_properties (void)
G_TYPE_PTR_ARRAY, 0), G_TYPE_PTR_ARRAY, 0),
0, 0,
NULL, NULL,
NULL,
NULL,
bindings_value_parse, bindings_value_parse,
bindings_value_print, bindings_value_print,
NULL,
NULL); NULL);
/* initialize shorthands last, they depend on the real properties existing */ /* initialize shorthands last, they depend on the real properties existing */
@ -2511,36 +2454,21 @@ void
_gtk_style_property_register (GParamSpec *pspec, _gtk_style_property_register (GParamSpec *pspec,
GtkStylePropertyFlags flags, GtkStylePropertyFlags flags,
GtkStylePropertyParser property_parse_func, GtkStylePropertyParser property_parse_func,
GtkStyleUnpackFunc unpack_func,
GtkStylePackFunc pack_func,
GtkStyleParseFunc parse_func, GtkStyleParseFunc parse_func,
GtkStylePrintFunc print_func, GtkStylePrintFunc print_func,
const GValue * initial_value, const GValue * initial_value)
GtkStyleUnsetFunc unset_func)
{ {
GtkStyleProperty *node; GtkStyleProperty *node;
g_return_if_fail ((pack_func == NULL) == (unpack_func == NULL));
if (pack_func == NULL)
node = g_object_new (GTK_TYPE_CSS_STYLE_PROPERTY, node = g_object_new (GTK_TYPE_CSS_STYLE_PROPERTY,
"name", pspec->name, "name", pspec->name,
NULL); NULL);
else
node = g_object_new (GTK_TYPE_CSS_SHORTHAND_PROPERTY,
"name", pspec->name,
NULL);
node->flags = flags; node->flags = flags;
node->pspec = pspec; node->pspec = pspec;
node->property_parse_func = property_parse_func; node->property_parse_func = property_parse_func;
node->pack_func = pack_func;
node->unpack_func = unpack_func;
node->parse_func = parse_func; node->parse_func = parse_func;
node->print_func = print_func; node->print_func = print_func;
node->unset_func = unset_func;
if (!GTK_IS_CSS_SHORTHAND_PROPERTY (node))
{
_gtk_style_property_generate_id (node); _gtk_style_property_generate_id (node);
/* initialize the initial value */ /* initialize the initial value */
@ -2570,4 +2498,3 @@ _gtk_style_property_register (GParamSpec *pspec,
g_param_value_set_default (pspec, &node->initial_value); g_param_value_set_default (pspec, &node->initial_value);
} }
} }
}

View File

@ -91,12 +91,9 @@ const char * _gtk_style_property_get_name (GtkStyleProperty
void _gtk_style_property_register (GParamSpec *pspec, void _gtk_style_property_register (GParamSpec *pspec,
GtkStylePropertyFlags flags, GtkStylePropertyFlags flags,
GtkStylePropertyParser property_parse_func, GtkStylePropertyParser property_parse_func,
GtkStyleUnpackFunc unpack_func,
GtkStylePackFunc pack_func,
GtkStyleParseFunc parse_func, GtkStyleParseFunc parse_func,
GtkStylePrintFunc print_func, GtkStylePrintFunc print_func,
const GValue *initial_value, const GValue *initial_value);
GtkStyleUnsetFunc unset_func);
gboolean _gtk_style_property_is_inherit (const GtkStyleProperty *property); gboolean _gtk_style_property_is_inherit (const GtkStyleProperty *property);
guint _gtk_style_property_get_id (const GtkStyleProperty *property); guint _gtk_style_property_get_id (const GtkStyleProperty *property);