[gtk/matthiasc/for-master: 4/8] css: Print selectors



commit ed57445267e1d746288966ec33d1d8f39fa5cfc2
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jan 23 18:51:42 2020 -0500

    css: Print selectors
    
    Add code that prints all the selectors when a theme
    is loaded.

 gtk/gtkcssprovider.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 6c25afae67..c8d3eb0656 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -978,15 +978,55 @@ gtk_css_provider_postprocess (GtkCssProvider *css_provider)
 
       ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, i);
 
+
       _gtk_css_selector_tree_builder_add (builder,
                                          ruleset->selector,
                                          &ruleset->selector_match,
                                          ruleset);
     }
 
+#if 0
+  {
+    GString *str = g_string_new ("");
+    g_string_append_printf (str, "%d rules\n", priv->rulesets->len);
+
+    for (i = 0; i < priv->rulesets->len; i++)
+      {
+        GtkCssRuleset *ruleset;
+
+        ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, i);
+
+        _gtk_css_selector_print (ruleset->selector, str);
+        g_string_append (str, "\n");
+      }
+
+    g_print ("%s\n", str->str);
+    g_string_free (str, TRUE);
+  }
+#endif
+
   priv->tree = _gtk_css_selector_tree_builder_build (builder);
   _gtk_css_selector_tree_builder_free (builder);
 
+#ifdef PRINT_SELECTORS 
+  {
+    GString *str = g_string_new ("");
+
+    for (i = 0; i < priv->rulesets->len; i++)
+      {
+        GtkCssRuleset *ruleset;
+
+        ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, i);
+
+        _gtk_css_selector_print (ruleset->selector, str);
+        g_string_append (str, "\n");
+      }
+
+    g_print ("%s\n", str->str);
+    g_string_free (str, TRUE);
+  }
+#endif
+
 #ifndef VERIFY_TREE
   for (i = 0; i < priv->rulesets->len; i++)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]