Commit c9dc09e9 authored by Carlos Garnacho's avatar Carlos Garnacho

GtkStyleProvider: Pass a GParamSpec in get_style_property().

This is so we can know the owner type of the property, and matching
with the stored strings in GtkCssProvider is direct.
parent b613f1f1
......@@ -1031,20 +1031,17 @@ gtk_css_provider_get_style (GtkStyleProvider *provider,
static gboolean
gtk_css_provider_get_style_property (GtkStyleProvider *provider,
GtkWidgetPath *path,
const gchar *property_name,
GParamSpec *pspec,
GValue *value)
{
GArray *priority_info;
gboolean found = FALSE;
gchar *prop_name;
GType path_type;
gint i;
path_type = gtk_widget_path_get_widget_type (path);
prop_name = g_strdup_printf ("-%s-%s",
g_type_name (path_type),
property_name);
g_type_name (pspec->owner_type),
pspec->name);
priority_info = css_provider_get_selectors (GTK_CSS_PROVIDER (provider), path);
......
......@@ -2040,8 +2040,9 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
else
global = global->prev;
if (gtk_style_provider_get_style_property (provider_data->provider, priv->widget_path,
pspec->name, &pcache->value))
if (gtk_style_provider_get_style_property (provider_data->provider,
priv->widget_path, pspec,
&pcache->value))
{
/* Resolve symbolic colors to GdkColor/GdkRGBA */
if (G_VALUE_TYPE (&pcache->value) == GTK_TYPE_SYMBOLIC_COLOR)
......
......@@ -86,25 +86,26 @@ gtk_style_provider_get_style (GtkStyleProvider *provider,
* gtk_style_provider_get_style_property:
* @provider: a #GtkStyleProvider
* @path: #GtkWidgetPath to query
* @property_name: the property name
* @pspec: The #GParamSpec to query
* @value: (out): return location for the property value
*
* Looks up a widget style property as defined by @provider for
* the widget represented by @widget_path.
* the widget represented by @path.
*
* Returns: %TRUE if the property was found and has a value, %FALSE otherwise
**/
gboolean
gtk_style_provider_get_style_property (GtkStyleProvider *provider,
GtkWidgetPath *path,
const gchar *property_name,
GParamSpec *pspec,
GValue *value)
{
GtkStyleProviderIface *iface;
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), FALSE);
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
g_return_val_if_fail (path != NULL, FALSE);
g_return_val_if_fail (property_name != NULL, FALSE);
g_return_val_if_fail (g_type_is_a (gtk_widget_path_get_widget_type (path), pspec->owner_type), FALSE);
g_return_val_if_fail (value != NULL, FALSE);
iface = GTK_STYLE_PROVIDER_GET_IFACE (provider);
......@@ -112,7 +113,7 @@ gtk_style_provider_get_style_property (GtkStyleProvider *provider,
if (!iface->get_style_property)
return FALSE;
return iface->get_style_property (provider, path, property_name, value);
return iface->get_style_property (provider, path, pspec, value);
}
/**
......
......@@ -57,7 +57,7 @@ struct _GtkStyleProviderIface
gboolean (* get_style_property) (GtkStyleProvider *provider,
GtkWidgetPath *path,
const gchar *property_name,
GParamSpec *pspec,
GValue *value);
GtkIconFactory * (* get_icon_factory) (GtkStyleProvider *provider,
......@@ -71,7 +71,7 @@ GtkStyleProperties *gtk_style_provider_get_style (GtkStyleProvider *provider,
gboolean gtk_style_provider_get_style_property (GtkStyleProvider *provider,
GtkWidgetPath *path,
const gchar *property_name,
GParamSpec *pspec,
GValue *value);
GtkIconFactory * gtk_style_provider_get_icon_factory (GtkStyleProvider *provider,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment