[metacity/cowbell] theme data should live in the theme struct



commit e5229b007fc833e62918316d6ae57df9ce8322f4
Author: Thomas Thurman <tthurman gnome org>
Date:   Sat Oct 17 01:17:33 2009 -0400

    theme data should live in the theme struct

 src/ui/theme.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 761aa83..e2f693d 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -8,7 +8,8 @@
 #include <gtk/gtk.h>
 
 struct _MetaTheme {
-  gboolean dummy;
+  ccss_grammar_t        *grammar;
+  ccss_stylesheet_t	*stylesheet;
 };
 
 MetaTheme *the_theme = NULL;
@@ -159,21 +160,25 @@ meta_theme_set_current (const char *name,
 {
   /* stub */
 
-  ccss_grammar_t        *grammar;
-  ccss_stylesheet_t	*stylesheet;
-
   if (!the_theme)
     {
       cowbell_initialise_classes ();
 
       the_theme = g_new0 (MetaTheme, 1);
     }
+  else
+    {
+      ccss_stylesheet_destroy (the_theme->stylesheet);
+      ccss_grammar_destroy (the_theme->grammar);
+    }
 
-  grammar = ccss_cairo_grammar_create ();
-  ccss_grammar_add_functions (grammar, cowbell_functions);
-  stylesheet = ccss_grammar_create_stylesheet_from_file (grammar,
-                                                         "/home/tthurman/.themes/Human/Human.css",
-                                                         NULL);
+  the_theme->grammar = ccss_cairo_grammar_create ();
+  ccss_grammar_add_functions (the_theme->grammar,
+                              cowbell_functions);
+  the_theme->stylesheet =
+    ccss_grammar_create_stylesheet_from_file (the_theme->grammar,
+                                              "/home/tthurman/.themes/Human/Human.css",
+                                              NULL);
 
   g_warning ("THEMES: Setting theme to %s\n", name);
 }



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