[gtk+/gtk-style-context: 90/191] GtkStyleSet: Register GtkThemingEngine type.



commit 94db76d504e14314a036ddc0962cf73f5f91c61f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Jun 13 17:31:22 2010 +0200

    GtkStyleSet: Register GtkThemingEngine type.
    
    This has been also hooked up to the CSS provider, which parses the "engine"
    value to load the corresponding module.

 gtk/gtkcssprovider.c   |    8 ++++++++
 gtk/gtkstylecontext.c  |    4 ++++
 gtk/gtkstyleset.c      |    2 ++
 gtk/gtkthemingengine.c |    2 +-
 4 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index f1e324a..e61ea73 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -905,6 +905,14 @@ parse_value (GType        type,
       g_value_set_double (value, g_ascii_strtod (value_str, NULL));
       return TRUE;
     }
+  else if (type == GTK_TYPE_THEMING_ENGINE)
+    {
+      GtkThemingEngine *engine;
+
+      engine = gtk_theming_engine_load (value_str);
+      g_value_set_object (value, engine);
+      return TRUE;
+    }
   else
     g_warning ("Cannot parse string '%s' for type %s", value_str, g_type_name (type));
 
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index b12fda3..848d809 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -145,6 +145,10 @@ rebuild_properties (GtkStyleContext *context)
           g_object_unref (provider_style);
         }
     }
+
+  gtk_style_set_get (priv->store, GTK_STATE_NORMAL,
+                     "engine", &priv->theming_engine,
+                     NULL);
 }
 
 void
diff --git a/gtk/gtkstyleset.c b/gtk/gtkstyleset.c
index 2bc91aa..5d8a856 100644
--- a/gtk/gtkstyleset.c
+++ b/gtk/gtkstyleset.c
@@ -25,6 +25,7 @@
 #include "gtkstyleprovider.h"
 #include "gtkstyleset.h"
 #include "gtkprivate.h"
+#include "gtkthemingengine.h"
 #include "gtkintl.h"
 
 #include "gtkalias.h"
@@ -78,6 +79,7 @@ gtk_style_set_class_init (GtkStyleSetClass *klass)
   gtk_style_set_register_property ("font", PANGO_TYPE_FONT_DESCRIPTION);
 
   gtk_style_set_register_property ("padding", GTK_TYPE_BORDER);
+  gtk_style_set_register_property ("engine", GTK_TYPE_THEMING_ENGINE);
 
   g_type_class_add_private (object_class, sizeof (GtkStyleSetPrivate));
 }
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index 3a019dc..5d4c8ce 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -393,7 +393,7 @@ gtk_theming_engine_load (const gchar *name)
 
   if (!engine)
     {
-      if (!default_engine)
+      if (G_UNLIKELY (!default_engine))
         default_engine = g_object_new (GTK_TYPE_THEMING_ENGINE, NULL);
 
       engine = default_engine;



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