From eaddc9f254649cd2607e428c023858da17fe5569 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 18 Jun 2010 16:52:34 +0200 Subject: [PATCH] GtkCssProvider: refactor out selector matching. --- gtk/gtkcssprovider.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c index e354675c61..dace8fe364 100644 --- a/gtk/gtkcssprovider.c +++ b/gtk/gtkcssprovider.c @@ -472,17 +472,15 @@ struct StylePriorityInfo GtkStateType state; }; -static GtkStyleSet * -gtk_style_get_style (GtkStyleProvider *provider, - GtkWidgetPath *path) +static GArray * +css_provider_get_selectors (GtkCssProvider *css_provider, + GtkWidgetPath *path) { GtkCssProviderPrivate *priv; - GtkStyleSet *set; GArray *priority_info; guint i, j; - priv = GTK_CSS_PROVIDER_GET_PRIVATE (provider); - set = gtk_style_set_new (); + priv = GTK_CSS_PROVIDER_GET_PRIVATE (css_provider); priority_info = g_array_new (FALSE, FALSE, sizeof (StylePriorityInfo)); for (i = 0; i < priv->selectors_info->len; i++) @@ -520,6 +518,23 @@ gtk_style_get_style (GtkStyleProvider *provider, g_array_append_val (priority_info, new); } + return priority_info; +} + +static GtkStyleSet * +gtk_css_provider_get_style (GtkStyleProvider *provider, + GtkWidgetPath *path) +{ + GtkCssProviderPrivate *priv; + GtkStyleSet *set; + GArray *priority_info; + guint i; + + priv = GTK_CSS_PROVIDER_GET_PRIVATE (provider); + set = gtk_style_set_new (); + + priority_info = css_provider_get_selectors (GTK_CSS_PROVIDER (provider), path); + for (i = 0; i < priority_info->len; i++) { StylePriorityInfo *info;