summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2010-11-17 02:42:27 +0100
committerCarlos Garnacho <carlosg@gnome.org>2010-12-04 15:39:13 +0100
commitc9dc09e980d26844d72bf740ddffc1a5530f2627 (patch)
tree141d72501d72ac4c6ed59e51e8484d8710db2f49
parentb613f1f1f288d9e24ca8830834e6bc533a3e3727 (diff)
downloadgtk+-c9dc09e980d26844d72bf740ddffc1a5530f2627.tar.gz
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.
-rw-r--r--gtk/gtkcssprovider.c9
-rw-r--r--gtk/gtkstylecontext.c5
-rw-r--r--gtk/gtkstyleprovider.c11
-rw-r--r--gtk/gtkstyleprovider.h4
4 files changed, 14 insertions, 15 deletions
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 8f703f4ef1..73ad759b65 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -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);
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 58faf5d777..09970bb54a 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -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)
diff --git a/gtk/gtkstyleprovider.c b/gtk/gtkstyleprovider.c
index 0f1312f34f..5033410188 100644
--- a/gtk/gtkstyleprovider.c
+++ b/gtk/gtkstyleprovider.c
@@ -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);
}
/**
diff --git a/gtk/gtkstyleprovider.h b/gtk/gtkstyleprovider.h
index 9e67a3286d..e901a20fbf 100644
--- a/gtk/gtkstyleprovider.h
+++ b/gtk/gtkstyleprovider.h
@@ -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,