[gtk+/wip/css: 43/153] styleproperty: Add custom registration func for shorthands
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/css: 43/153] styleproperty: Add custom registration func for shorthands
- Date: Sat, 7 Jan 2012 02:00:11 +0000 (UTC)
commit ca1d565157e880ca7ed6ab08b685718dc66619e5
Author: Benjamin Otte <otte redhat com>
Date: Sat Dec 31 15:43:13 2011 +0100
styleproperty: Add custom registration func for shorthands
gtk/gtkcssshorthandpropertyimpl.c | 44 +++++++++++++++++++++++++++++++------
1 files changed, 37 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkcssshorthandpropertyimpl.c b/gtk/gtkcssshorthandpropertyimpl.c
index 493377a..85da098 100644
--- a/gtk/gtkcssshorthandpropertyimpl.c
+++ b/gtk/gtkcssshorthandpropertyimpl.c
@@ -765,10 +765,40 @@ unset_border_image (GtkStyleProperties *props,
gtk_style_properties_unset_property (props, "border-image-width", state);
}
+static void
+_gtk_css_shorthand_property_register (GParamSpec *pspec,
+ GtkStylePropertyFlags flags,
+ GtkStylePropertyParser property_parse_func,
+ GtkStyleUnpackFunc unpack_func,
+ GtkStylePackFunc pack_func,
+ GtkStyleParseFunc parse_func,
+ GtkStylePrintFunc print_func,
+ const GValue * initial_value,
+ GtkStyleUnsetFunc unset_func)
+{
+ GtkStyleProperty *node;
+
+ g_return_if_fail (pack_func != NULL);
+ g_return_if_fail (unpack_func != NULL);
+
+ node = g_object_new (GTK_TYPE_CSS_SHORTHAND_PROPERTY,
+ "name", pspec->name,
+ NULL);
+
+ node->flags = flags;
+ node->pspec = pspec;
+ node->property_parse_func = property_parse_func;
+ node->pack_func = pack_func;
+ node->unpack_func = unpack_func;
+ node->parse_func = parse_func;
+ node->print_func = print_func;
+ node->unset_func = unset_func;
+}
+
void
_gtk_css_shorthand_property_init_properties (void)
{
- _gtk_style_property_register (g_param_spec_boxed ("font",
+ _gtk_css_shorthand_property_register (g_param_spec_boxed ("font",
"Font Description",
"Font Description",
PANGO_TYPE_FONT_DESCRIPTION, 0),
@@ -780,7 +810,7 @@ _gtk_css_shorthand_property_init_properties (void)
NULL,
NULL,
unset_font_description);
- _gtk_style_property_register (g_param_spec_boxed ("margin",
+ _gtk_css_shorthand_property_register (g_param_spec_boxed ("margin",
"Margin",
"Margin",
GTK_TYPE_BORDER, 0),
@@ -792,7 +822,7 @@ _gtk_css_shorthand_property_init_properties (void)
NULL,
NULL,
unset_margin);
- _gtk_style_property_register (g_param_spec_boxed ("padding",
+ _gtk_css_shorthand_property_register (g_param_spec_boxed ("padding",
"Padding",
"Padding",
GTK_TYPE_BORDER, 0),
@@ -804,7 +834,7 @@ _gtk_css_shorthand_property_init_properties (void)
NULL,
NULL,
unset_padding);
- _gtk_style_property_register (g_param_spec_boxed ("border-width",
+ _gtk_css_shorthand_property_register (g_param_spec_boxed ("border-width",
"Border width",
"Border width, in pixels",
GTK_TYPE_BORDER, 0),
@@ -816,7 +846,7 @@ _gtk_css_shorthand_property_init_properties (void)
NULL,
NULL,
unset_border_width);
- _gtk_style_property_register (g_param_spec_int ("border-radius",
+ _gtk_css_shorthand_property_register (g_param_spec_int ("border-radius",
"Border radius",
"Border radius, in pixels",
0, G_MAXINT, 0, 0),
@@ -828,7 +858,7 @@ _gtk_css_shorthand_property_init_properties (void)
border_radius_value_print,
NULL,
unset_border_radius);
- _gtk_style_property_register (g_param_spec_boxed ("border-color",
+ _gtk_css_shorthand_property_register (g_param_spec_boxed ("border-color",
"Border color",
"Border color",
GDK_TYPE_RGBA, 0),
@@ -840,7 +870,7 @@ _gtk_css_shorthand_property_init_properties (void)
NULL,
NULL,
unset_border_color);
- _gtk_style_property_register (g_param_spec_boxed ("border-image",
+ _gtk_css_shorthand_property_register (g_param_spec_boxed ("border-image",
"Border Image",
"Border Image",
GTK_TYPE_BORDER_IMAGE, 0),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]