[gtk+] styleproperty: Add flags
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] styleproperty: Add flags
- Date: Thu, 2 Jun 2011 00:13:19 +0000 (UTC)
commit 4feddc6190f36b8968a94d0b5a0c71a1d5b76e88
Author: Benjamin Otte <otte redhat com>
Date: Tue May 31 12:20:47 2011 +0200
styleproperty: Add flags
This allows to set a bunch of specific features, like inheritance in
here, without having to molest the psec.
gtk/gtkstyleproperties.c | 1 +
gtk/gtkstyleproperty.c | 16 +++++++++++++++-
gtk/gtkstylepropertyprivate.h | 6 ++++++
3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkstyleproperties.c b/gtk/gtkstyleproperties.c
index dfe7915..4f9a4bb 100644
--- a/gtk/gtkstyleproperties.c
+++ b/gtk/gtkstyleproperties.c
@@ -312,6 +312,7 @@ gtk_style_properties_register_property (GtkStylePropertyParser parse_func,
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
_gtk_style_property_register (pspec,
+ 0,
parse_func,
NULL,
NULL,
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c
index a6bf234..0a3a2e1 100644
--- a/gtk/gtkstyleproperty.c
+++ b/gtk/gtkstyleproperty.c
@@ -1946,7 +1946,8 @@ _gtk_style_property_is_inherit (const GtkStyleProperty *property)
{
g_return_val_if_fail (property != NULL, FALSE);
- return gtk_style_param_get_inherit (property->pspec);
+ return property->flags & GTK_STYLE_PROPERTY_INHERIT ||
+ gtk_style_param_get_inherit (property->pspec);
}
gboolean
@@ -2017,6 +2018,7 @@ gtk_style_property_init (void)
G_TYPE_STRV, 0);
gtk_style_param_set_inherit (pspec, TRUE);
_gtk_style_property_register (pspec,
+ 0,
NULL,
NULL,
NULL,
@@ -2057,6 +2059,7 @@ gtk_style_property_init (void)
PANGO_TYPE_FONT_DESCRIPTION, 0);
gtk_style_param_set_inherit (pspec, TRUE);
_gtk_style_property_register (pspec,
+ 0,
NULL,
unpack_font_description,
pack_font_description,
@@ -2095,6 +2098,7 @@ gtk_style_property_init (void)
"Margin",
"Margin",
GTK_TYPE_BORDER, 0),
+ 0,
NULL,
unpack_margin,
pack_margin,
@@ -2125,6 +2129,7 @@ gtk_style_property_init (void)
"Padding",
"Padding",
GTK_TYPE_BORDER, 0),
+ 0,
NULL,
unpack_padding,
pack_padding,
@@ -2155,6 +2160,7 @@ gtk_style_property_init (void)
"Border width",
"Border width, in pixels",
GTK_TYPE_BORDER, 0),
+ 0,
NULL,
unpack_border_width,
pack_border_width,
@@ -2166,6 +2172,7 @@ gtk_style_property_init (void)
"Border top left radius",
"Border radius of top left corner, in pixels",
GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0),
+ 0,
NULL,
NULL,
NULL,
@@ -2176,6 +2183,7 @@ gtk_style_property_init (void)
"Border top right radius",
"Border radius of top right corner, in pixels",
GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0),
+ 0,
NULL,
NULL,
NULL,
@@ -2186,6 +2194,7 @@ gtk_style_property_init (void)
"Border bottom right radius",
"Border radius of bottom right corner, in pixels",
GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0),
+ 0,
NULL,
NULL,
NULL,
@@ -2196,6 +2205,7 @@ gtk_style_property_init (void)
"Border bottom left radius",
"Border radius of bottom left corner, in pixels",
GTK_TYPE_CSS_BORDER_CORNER_RADIUS, 0),
+ 0,
NULL,
NULL,
NULL,
@@ -2206,6 +2216,7 @@ gtk_style_property_init (void)
"Border radius",
"Border radius, in pixels",
0, G_MAXINT, 0, 0),
+ 0,
NULL,
unpack_border_radius,
pack_border_radius,
@@ -2250,6 +2261,7 @@ gtk_style_property_init (void)
"Key bindings",
"Key bindings",
G_TYPE_PTR_ARRAY, 0),
+ 0,
NULL,
NULL,
NULL,
@@ -2268,6 +2280,7 @@ _gtk_style_property_lookup (const char *name)
void
_gtk_style_property_register (GParamSpec *pspec,
+ GtkStylePropertyFlags flags,
GtkStylePropertyParser property_parse_func,
GtkStyleUnpackFunc unpack_func,
GtkStylePackFunc pack_func,
@@ -2291,6 +2304,7 @@ _gtk_style_property_register (GParamSpec *pspec,
}
node = g_slice_new0 (GtkStyleProperty);
+ node->flags = flags;
node->pspec = pspec;
node->property_parse_func = property_parse_func;
node->pack_func = pack_func;
diff --git a/gtk/gtkstylepropertyprivate.h b/gtk/gtkstylepropertyprivate.h
index 7ee23f8..dab6f07 100644
--- a/gtk/gtkstylepropertyprivate.h
+++ b/gtk/gtkstylepropertyprivate.h
@@ -25,6 +25,9 @@
G_BEGIN_DECLS
typedef struct _GtkStyleProperty GtkStyleProperty;
+typedef enum {
+ GTK_STYLE_PROPERTY_INHERIT = (1 << 0)
+} GtkStylePropertyFlags;
typedef GParameter * (* GtkStyleUnpackFunc) (const GValue *value,
guint *n_params);
@@ -43,6 +46,8 @@ typedef void (* GtkStyleDefaultValueFunc) (GtkStyleProperties
struct _GtkStyleProperty
{
GParamSpec *pspec;
+ GtkStylePropertyFlags flags;
+
GtkStylePropertyParser property_parse_func;
GtkStyleUnpackFunc unpack_func;
GtkStylePackFunc pack_func;
@@ -54,6 +59,7 @@ struct _GtkStyleProperty
const GtkStyleProperty * _gtk_style_property_lookup (const char *name);
void _gtk_style_property_register (GParamSpec *pspec,
+ GtkStylePropertyFlags flags,
GtkStylePropertyParser property_parse_func,
GtkStyleUnpackFunc unpack_func,
GtkStylePackFunc pack_func,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]