forked from AuroraMiddleware/gtk
styleproperties: constify gtk_style_property_lookup()
This commit is contained in:
parent
1bd065fa4d
commit
a2200e8971
@ -388,7 +388,7 @@ gtk_style_properties_provider_init (GtkStyleProviderIface *iface)
|
|||||||
iface->get_style = gtk_style_properties_get_style;
|
iface->get_style = gtk_style_properties_get_style;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkStyleProperty *
|
static const GtkStyleProperty *
|
||||||
gtk_style_property_lookup (const char *name)
|
gtk_style_property_lookup (const char *name)
|
||||||
{
|
{
|
||||||
if (!properties)
|
if (!properties)
|
||||||
@ -415,6 +415,7 @@ void
|
|||||||
gtk_style_properties_register_property (GtkStylePropertyParser parse_func,
|
gtk_style_properties_register_property (GtkStylePropertyParser parse_func,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
|
const GtkStyleProperty *existing;
|
||||||
GtkStyleProperty *node;
|
GtkStyleProperty *node;
|
||||||
|
|
||||||
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
|
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
|
||||||
@ -423,10 +424,11 @@ gtk_style_properties_register_property (GtkStylePropertyParser parse_func,
|
|||||||
if (G_UNLIKELY (!properties))
|
if (G_UNLIKELY (!properties))
|
||||||
properties = g_hash_table_new (g_str_hash, g_str_equal);
|
properties = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
|
|
||||||
if ((node = gtk_style_property_lookup (pspec->name)) != NULL)
|
existing = gtk_style_property_lookup (pspec->name);
|
||||||
|
if (existing != NULL)
|
||||||
{
|
{
|
||||||
g_warning ("Property \"%s\" was already registered with type %s",
|
g_warning ("Property \"%s\" was already registered with type %s",
|
||||||
pspec->name, g_type_name (node->pspec->value_type));
|
pspec->name, g_type_name (existing->pspec->value_type));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,7 +458,7 @@ gtk_style_properties_lookup_property (const gchar *property_name,
|
|||||||
GtkStylePropertyParser *parse_func,
|
GtkStylePropertyParser *parse_func,
|
||||||
GParamSpec **pspec)
|
GParamSpec **pspec)
|
||||||
{
|
{
|
||||||
GtkStyleProperty *node;
|
const GtkStyleProperty *node;
|
||||||
GtkStylePropertiesClass *klass;
|
GtkStylePropertiesClass *klass;
|
||||||
gboolean found = FALSE;
|
gboolean found = FALSE;
|
||||||
|
|
||||||
@ -680,7 +682,7 @@ gtk_style_properties_set_property (GtkStyleProperties *props,
|
|||||||
GtkStateFlags state,
|
GtkStateFlags state,
|
||||||
const GValue *value)
|
const GValue *value)
|
||||||
{
|
{
|
||||||
GtkStyleProperty *node;
|
const GtkStyleProperty *node;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
||||||
g_return_if_fail (property != NULL);
|
g_return_if_fail (property != NULL);
|
||||||
@ -725,7 +727,7 @@ gtk_style_properties_set_valist (GtkStyleProperties *props,
|
|||||||
|
|
||||||
while (property_name)
|
while (property_name)
|
||||||
{
|
{
|
||||||
GtkStyleProperty *node;
|
const GtkStyleProperty *node;
|
||||||
PropertyData *prop;
|
PropertyData *prop;
|
||||||
gchar *error = NULL;
|
gchar *error = NULL;
|
||||||
GValue *val;
|
GValue *val;
|
||||||
@ -869,9 +871,9 @@ resolve_shadow (GtkStyleProperties *props,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
style_properties_resolve_type (GtkStyleProperties *props,
|
style_properties_resolve_type (GtkStyleProperties *props,
|
||||||
GtkStyleProperty *node,
|
const GtkStyleProperty *node,
|
||||||
GValue *val)
|
GValue *val)
|
||||||
{
|
{
|
||||||
if (val && G_VALUE_TYPE (val) == GTK_TYPE_SYMBOLIC_COLOR)
|
if (val && G_VALUE_TYPE (val) == GTK_TYPE_SYMBOLIC_COLOR)
|
||||||
{
|
{
|
||||||
@ -905,8 +907,8 @@ style_properties_resolve_type (GtkStyleProperties *props,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lookup_default_value (GtkStyleProperty *node,
|
lookup_default_value (const GtkStyleProperty *node,
|
||||||
GValue *value)
|
GValue *value)
|
||||||
{
|
{
|
||||||
if (node->pspec->value_type == GTK_TYPE_THEMING_ENGINE)
|
if (node->pspec->value_type == GTK_TYPE_THEMING_ENGINE)
|
||||||
g_value_set_object (value, gtk_theming_engine_load (NULL));
|
g_value_set_object (value, gtk_theming_engine_load (NULL));
|
||||||
@ -932,7 +934,7 @@ _gtk_style_properties_peek_property (GtkStyleProperties *props,
|
|||||||
GtkStateFlags state)
|
GtkStateFlags state)
|
||||||
{
|
{
|
||||||
GtkStylePropertiesPrivate *priv;
|
GtkStylePropertiesPrivate *priv;
|
||||||
GtkStyleProperty *node;
|
const GtkStyleProperty *node;
|
||||||
PropertyData *prop;
|
PropertyData *prop;
|
||||||
GValue *val;
|
GValue *val;
|
||||||
|
|
||||||
@ -983,7 +985,7 @@ gtk_style_properties_get_property (GtkStyleProperties *props,
|
|||||||
GValue *value)
|
GValue *value)
|
||||||
{
|
{
|
||||||
GtkStylePropertiesPrivate *priv;
|
GtkStylePropertiesPrivate *priv;
|
||||||
GtkStyleProperty *node;
|
const GtkStyleProperty *node;
|
||||||
PropertyData *prop;
|
PropertyData *prop;
|
||||||
GValue *val;
|
GValue *val;
|
||||||
|
|
||||||
@ -1048,7 +1050,7 @@ gtk_style_properties_get_valist (GtkStyleProperties *props,
|
|||||||
|
|
||||||
while (property_name)
|
while (property_name)
|
||||||
{
|
{
|
||||||
GtkStyleProperty *node;
|
const GtkStyleProperty *node;
|
||||||
PropertyData *prop;
|
PropertyData *prop;
|
||||||
gchar *error = NULL;
|
gchar *error = NULL;
|
||||||
GValue *val = NULL;
|
GValue *val = NULL;
|
||||||
@ -1137,7 +1139,7 @@ gtk_style_properties_unset_property (GtkStyleProperties *props,
|
|||||||
GtkStateFlags state)
|
GtkStateFlags state)
|
||||||
{
|
{
|
||||||
GtkStylePropertiesPrivate *priv;
|
GtkStylePropertiesPrivate *priv;
|
||||||
GtkStyleProperty *node;
|
const GtkStyleProperty *node;
|
||||||
PropertyData *prop;
|
PropertyData *prop;
|
||||||
guint pos;
|
guint pos;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user