summaryrefslogtreecommitdiff
path: root/gtk/gtkcssselector.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2011-12-29 14:26:45 +0100
committerBenjamin Otte <otte@redhat.com>2012-01-09 18:37:50 +0100
commita6ac53e2a9e121ef670509e1b39892710d774f7a (patch)
tree403e4fcf02fe8c221c007eccaf47aeb4396454bf /gtk/gtkcssselector.c
parenta3225fdd423f8e75500d25b3c8bf41f6edccdfa2 (diff)
downloadgtk+-a6ac53e2a9e121ef670509e1b39892710d774f7a.tar.gz
css: Change prototype of _gtk_css_selector_matches()
Passing the length of the widget path that is relevant is not necessary anymore, it was only useful for inheritance. Instead, we now pass the state flags and let the selector do the state matching for us.
Diffstat (limited to 'gtk/gtkcssselector.c')
-rw-r--r--gtk/gtkcssselector.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c
index b3ccb44e47..21f3437040 100644
--- a/gtk/gtkcssselector.c
+++ b/gtk/gtkcssselector.c
@@ -390,7 +390,7 @@ gtk_css_selector_matches_previous (const GtkCssSelector *selector,
* _gtk_css_selector_matches:
* @selector: the selector
* @path: the path to check
- * @length: How many elements of the path are to be used
+ * @state: The state to match
*
* Checks if the @selector matches the given @path. If @length is
* smaller than the number of elements in @path, it is assumed that
@@ -403,15 +403,19 @@ gtk_css_selector_matches_previous (const GtkCssSelector *selector,
gboolean
_gtk_css_selector_matches (const GtkCssSelector *selector,
const GtkWidgetPath *path,
- guint length)
+ GtkStateFlags state)
{
GSList *list;
gboolean match;
+ guint length;
g_return_val_if_fail (selector != NULL, FALSE);
g_return_val_if_fail (path != NULL, FALSE);
- g_return_val_if_fail (length <= gtk_widget_path_length (path), FALSE);
+ if ((selector->state & state) != selector->state)
+ return FALSE;
+
+ length = gtk_widget_path_length (path);
if (length == 0)
return FALSE;