]> Pileus Git - ~andy/gtk/commitdiff
GtkStyleProvider: Pass a GParamSpec in get_style_property().
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 17 Nov 2010 01:42:27 +0000 (02:42 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 4 Dec 2010 14:39:13 +0000 (15:39 +0100)
This is so we can know the owner type of the property, and matching
with the stored strings in GtkCssProvider is direct.

gtk/gtkcssprovider.c
gtk/gtkstylecontext.c
gtk/gtkstyleprovider.c
gtk/gtkstyleprovider.h

index 8f703f4ef160c90bf61e4274b6b8fbf4d96dd587..73ad759b6579f0d5cb35e4b42f9a46f247b5beee 100644 (file)
@@ -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);
 
index 58faf5d7779218162e483016f99d6c644e2fc530..09970bb54a636f7a71c0c03043a17aad7a2860d8 100644 (file)
@@ -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)
index 0f1312f34fbc8e5e35bed63cfa29640faa9f3508..5033410188bf5c8d13716e11244311249c470281 100644 (file)
@@ -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);
 }
 
 /**
index 9e67a3286dbb84863b04580f086cd111b4871cc2..e901a20fbf2612dff3de7fe03001da7c5cb5be76 100644 (file)
@@ -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,