[gtk+/parser: 3/80] cssprovider: Store cssprovider in scanner's user data



commit b8922238aa4e59d5c8d33437a5887e5641ebfdc6
Author: Benjamin Otte <otte redhat com>
Date:   Tue Apr 5 19:56:00 2011 +0200

    cssprovider: Store cssprovider in scanner's user data

 gtk/gtkcssprovider.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index e1729cb..d38d1da 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -1039,12 +1039,14 @@ selector_style_info_set_style (SelectorStyleInfo *info,
 }
 
 static GScanner *
-create_scanner (void)
+gtk_css_provider_create_scanner (GtkCssProvider *provider)
 {
   GScanner *scanner;
 
   scanner = g_scanner_new (NULL);
 
+  scanner->user_data = provider;
+
   g_scanner_scope_add_symbol (scanner, SCOPE_PSEUDO_CLASS, "active", GUINT_TO_POINTER (GTK_STATE_ACTIVE));
   g_scanner_scope_add_symbol (scanner, SCOPE_PSEUDO_CLASS, "prelight", GUINT_TO_POINTER (GTK_STATE_PRELIGHT));
   g_scanner_scope_add_symbol (scanner, SCOPE_PSEUDO_CLASS, "hover", GUINT_TO_POINTER (GTK_STATE_PRELIGHT));
@@ -1079,7 +1081,7 @@ gtk_css_provider_init (GtkCssProvider *css_provider)
                                                            GtkCssProviderPrivate);
 
   priv->selectors_info = g_ptr_array_new_with_free_func ((GDestroyNotify) selector_style_info_free);
-  priv->scanner = create_scanner ();
+  priv->scanner = gtk_css_provider_create_scanner (css_provider);
 
   priv->symbolic_colors = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                  (GDestroyNotify) g_free,
@@ -3284,7 +3286,7 @@ parse_rule (GtkCssProvider  *css_provider,
           scanner_backup = priv->scanner;
 
           priv->state = NULL;
-          priv->scanner = create_scanner ();
+          priv->scanner = gtk_css_provider_create_scanner (css_provider);
 
           /* FIXME: Avoid recursive importing */
           loaded = gtk_css_provider_load_from_path_internal (css_provider, path,



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