[gtk+/gtk-style-context: 263/347] GtkCssProvider: Make it able to parse enums.



commit c4dd7037dadc846b93a221f3ca7c5f5f1f5008ad
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Oct 20 18:04:39 2010 +0200

    GtkCssProvider: Make it able to parse enums.

 gtk/gtkcssprovider.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 001b062..045bd64 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -2314,6 +2314,17 @@ css_provider_parse_value (GtkCssProvider *css_provider,
       else
         parsed = FALSE;
     }
+  else if (G_TYPE_IS_ENUM (type))
+    {
+      GEnumClass *class;
+      GEnumValue *enum_value;
+
+      class = g_type_class_ref (type);
+      enum_value = g_enum_get_value_by_nick (class, value_str);
+
+      g_value_set_enum (value, enum_value->value);
+      g_type_class_unref (class);
+    }
   else if (type == GTK_TYPE_9SLICE)
     {
       Gtk9Slice *slice;



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