styleproperties: Adapt _gtk_style_properties_peek_property()

Optionally return the GtkStyleProperty that was looked up. This feature
isn't used yet, but will soon be.
This commit is contained in:
Benjamin Otte
2011-05-21 17:19:50 +02:00
parent 727a839d71
commit 5f5cc79623
3 changed files with 34 additions and 17 deletions

View File

@ -3363,7 +3363,9 @@ gtk_style_context_get_color (GtkStyleContext *context,
data = style_data_lookup (context); data = style_data_lookup (context);
value = _gtk_style_properties_peek_property (data->store, value = _gtk_style_properties_peek_property (data->store,
"color", state); "color",
state,
NULL);
if (value) if (value)
{ {
@ -3402,7 +3404,9 @@ gtk_style_context_get_background_color (GtkStyleContext *context,
data = style_data_lookup (context); data = style_data_lookup (context);
value = _gtk_style_properties_peek_property (data->store, value = _gtk_style_properties_peek_property (data->store,
"background-color", state); "background-color",
state,
NULL);
if (value) if (value)
{ {
@ -3441,7 +3445,9 @@ gtk_style_context_get_border_color (GtkStyleContext *context,
data = style_data_lookup (context); data = style_data_lookup (context);
value = _gtk_style_properties_peek_property (data->store, value = _gtk_style_properties_peek_property (data->store,
"border-color", state); "border-color",
state,
NULL);
if (value) if (value)
{ {
@ -3481,7 +3487,9 @@ gtk_style_context_get_border (GtkStyleContext *context,
data = style_data_lookup (context); data = style_data_lookup (context);
value = _gtk_style_properties_peek_property (data->store, value = _gtk_style_properties_peek_property (data->store,
"border-width", state); "border-width",
state,
NULL);
if (value) if (value)
{ {
@ -3521,7 +3529,9 @@ gtk_style_context_get_padding (GtkStyleContext *context,
data = style_data_lookup (context); data = style_data_lookup (context);
value = _gtk_style_properties_peek_property (data->store, value = _gtk_style_properties_peek_property (data->store,
"padding", state); "padding",
state,
NULL);
if (value) if (value)
{ {
@ -3561,7 +3571,9 @@ gtk_style_context_get_margin (GtkStyleContext *context,
data = style_data_lookup (context); data = style_data_lookup (context);
value = _gtk_style_properties_peek_property (data->store, value = _gtk_style_properties_peek_property (data->store,
"margin", state); "margin",
state,
NULL);
if (value) if (value)
{ {
@ -3599,7 +3611,7 @@ gtk_style_context_get_font (GtkStyleContext *context,
g_return_val_if_fail (priv->widget_path != NULL, NULL); g_return_val_if_fail (priv->widget_path != NULL, NULL);
data = style_data_lookup (context); data = style_data_lookup (context);
value = _gtk_style_properties_peek_property (data->store, "font", state); value = _gtk_style_properties_peek_property (data->store, "font", state, NULL);
if (value) if (value)
return g_value_get_boxed (value); return g_value_get_boxed (value);

View File

@ -799,9 +799,10 @@ lookup_default_value (const GtkStyleProperty *node,
} }
const GValue * const GValue *
_gtk_style_properties_peek_property (GtkStyleProperties *props, _gtk_style_properties_peek_property (GtkStyleProperties *props,
const gchar *prop_name, const gchar *prop_name,
GtkStateFlags state) GtkStateFlags state,
const GtkStyleProperty **property)
{ {
GtkStylePropertiesPrivate *priv; GtkStylePropertiesPrivate *priv;
const GtkStyleProperty *node; const GtkStyleProperty *node;
@ -812,6 +813,8 @@ _gtk_style_properties_peek_property (GtkStyleProperties *props,
g_return_val_if_fail (prop_name != NULL, NULL); g_return_val_if_fail (prop_name != NULL, NULL);
node = _gtk_style_property_lookup (prop_name); node = _gtk_style_property_lookup (prop_name);
if (property)
*property = node;
if (!node) if (!node)
{ {

View File

@ -21,17 +21,19 @@
#define __GTK_STYLE_PROPERTIES_PRIVATE_H__ #define __GTK_STYLE_PROPERTIES_PRIVATE_H__
#include "gtkstyleproperties.h" #include "gtkstyleproperties.h"
#include "gtkstylepropertyprivate.h"
G_BEGIN_DECLS G_BEGIN_DECLS
const GValue * _gtk_style_properties_peek_property (GtkStyleProperties *props, const GValue * _gtk_style_properties_peek_property (GtkStyleProperties *props,
const gchar *prop_name, const gchar *prop_name,
GtkStateFlags state); GtkStateFlags state,
const GtkStyleProperty **property);
void _gtk_style_properties_set_property_by_pspec (GtkStyleProperties *props, void _gtk_style_properties_set_property_by_pspec (GtkStyleProperties *props,
GParamSpec *pspec, GParamSpec *pspec,
GtkStateFlags state, GtkStateFlags state,
const GValue *value); const GValue *value);
G_END_DECLS G_END_DECLS