[gtk+] label: Allow using more underline modes



commit 69300df1fc94e6dbaea0f9c2c9215eb45d345a80
Author: Benjamin Otte <otte redhat com>
Date:   Mon Apr 25 01:48:59 2011 +0200

    label: Allow using more underline modes

 gtk/gtklabel.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 2fb4dc9..3b6504e 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -1346,8 +1346,16 @@ attribute_from_text (GtkBuilder   *builder,
 	attribute = pango_attr_stretch_new (g_value_get_enum (&val));
       break;
     case PANGO_ATTR_UNDERLINE:
-      if (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, value, &val, error))
-	attribute = pango_attr_underline_new (g_value_get_boolean (&val));
+      if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_UNDERLINE, value, &val, NULL))
+	attribute = pango_attr_underline_new (g_value_get_enum (&val));
+      else
+        {
+          /* XXX: allow boolean for backwards compat, so ignore error */
+          /* Deprecate this somehow */
+          g_value_unset (&val);
+          if (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, value, &val, error))
+            attribute = pango_attr_underline_new (g_value_get_boolean (&val));
+        }
       break;
     case PANGO_ATTR_STRIKETHROUGH:	
       if (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, value, &val, error))



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