GtkStyleSet: Register GtkThemingEngine type.

This has been also hooked up to the CSS provider, which parses the "engine"
value to load the corresponding module.
This commit is contained in:
Carlos Garnacho 2010-06-13 17:31:22 +02:00
parent 327a9fc66a
commit 66d1cb8054
4 changed files with 15 additions and 1 deletions

View File

@ -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));

View File

@ -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

View File

@ -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));
}

View File

@ -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;