forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
b613f1f1f2
commit
c9dc09e980
@ -1031,20 +1031,17 @@ gtk_css_provider_get_style (GtkStyleProvider *provider,
|
|||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_provider_get_style_property (GtkStyleProvider *provider,
|
gtk_css_provider_get_style_property (GtkStyleProvider *provider,
|
||||||
GtkWidgetPath *path,
|
GtkWidgetPath *path,
|
||||||
const gchar *property_name,
|
GParamSpec *pspec,
|
||||||
GValue *value)
|
GValue *value)
|
||||||
{
|
{
|
||||||
GArray *priority_info;
|
GArray *priority_info;
|
||||||
gboolean found = FALSE;
|
gboolean found = FALSE;
|
||||||
gchar *prop_name;
|
gchar *prop_name;
|
||||||
GType path_type;
|
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
path_type = gtk_widget_path_get_widget_type (path);
|
|
||||||
|
|
||||||
prop_name = g_strdup_printf ("-%s-%s",
|
prop_name = g_strdup_printf ("-%s-%s",
|
||||||
g_type_name (path_type),
|
g_type_name (pspec->owner_type),
|
||||||
property_name);
|
pspec->name);
|
||||||
|
|
||||||
priority_info = css_provider_get_selectors (GTK_CSS_PROVIDER (provider), path);
|
priority_info = css_provider_get_selectors (GTK_CSS_PROVIDER (provider), path);
|
||||||
|
|
||||||
|
@ -2040,8 +2040,9 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
|
|||||||
else
|
else
|
||||||
global = global->prev;
|
global = global->prev;
|
||||||
|
|
||||||
if (gtk_style_provider_get_style_property (provider_data->provider, priv->widget_path,
|
if (gtk_style_provider_get_style_property (provider_data->provider,
|
||||||
pspec->name, &pcache->value))
|
priv->widget_path, pspec,
|
||||||
|
&pcache->value))
|
||||||
{
|
{
|
||||||
/* Resolve symbolic colors to GdkColor/GdkRGBA */
|
/* Resolve symbolic colors to GdkColor/GdkRGBA */
|
||||||
if (G_VALUE_TYPE (&pcache->value) == GTK_TYPE_SYMBOLIC_COLOR)
|
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:
|
* gtk_style_provider_get_style_property:
|
||||||
* @provider: a #GtkStyleProvider
|
* @provider: a #GtkStyleProvider
|
||||||
* @path: #GtkWidgetPath to query
|
* @path: #GtkWidgetPath to query
|
||||||
* @property_name: the property name
|
* @pspec: The #GParamSpec to query
|
||||||
* @value: (out): return location for the property value
|
* @value: (out): return location for the property value
|
||||||
*
|
*
|
||||||
* Looks up a widget style property as defined by @provider for
|
* 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
|
* Returns: %TRUE if the property was found and has a value, %FALSE otherwise
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gtk_style_provider_get_style_property (GtkStyleProvider *provider,
|
gtk_style_provider_get_style_property (GtkStyleProvider *provider,
|
||||||
GtkWidgetPath *path,
|
GtkWidgetPath *path,
|
||||||
const gchar *property_name,
|
GParamSpec *pspec,
|
||||||
GValue *value)
|
GValue *value)
|
||||||
{
|
{
|
||||||
GtkStyleProviderIface *iface;
|
GtkStyleProviderIface *iface;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), FALSE);
|
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 (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);
|
g_return_val_if_fail (value != NULL, FALSE);
|
||||||
|
|
||||||
iface = GTK_STYLE_PROVIDER_GET_IFACE (provider);
|
iface = GTK_STYLE_PROVIDER_GET_IFACE (provider);
|
||||||
@ -112,7 +113,7 @@ gtk_style_provider_get_style_property (GtkStyleProvider *provider,
|
|||||||
if (!iface->get_style_property)
|
if (!iface->get_style_property)
|
||||||
return FALSE;
|
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,
|
gboolean (* get_style_property) (GtkStyleProvider *provider,
|
||||||
GtkWidgetPath *path,
|
GtkWidgetPath *path,
|
||||||
const gchar *property_name,
|
GParamSpec *pspec,
|
||||||
GValue *value);
|
GValue *value);
|
||||||
|
|
||||||
GtkIconFactory * (* get_icon_factory) (GtkStyleProvider *provider,
|
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,
|
gboolean gtk_style_provider_get_style_property (GtkStyleProvider *provider,
|
||||||
GtkWidgetPath *path,
|
GtkWidgetPath *path,
|
||||||
const gchar *property_name,
|
GParamSpec *pspec,
|
||||||
GValue *value);
|
GValue *value);
|
||||||
|
|
||||||
GtkIconFactory * gtk_style_provider_get_icon_factory (GtkStyleProvider *provider,
|
GtkIconFactory * gtk_style_provider_get_icon_factory (GtkStyleProvider *provider,
|
||||||
|
Loading…
Reference in New Issue
Block a user