[glade/offscreen-design-layout] * plugins/gtk+/glade-attributes.c: Fixed mismatching PangoAttributeType with GType, closes bug 597



commit 2b1304b4d7fed2f22d22b4dcadee56fa77a6e764
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Thu Jan 13 18:37:59 2011 +0900

    	* plugins/gtk+/glade-attributes.c: Fixed mismatching PangoAttributeType with GType,
    	closes bug 597045.

 ChangeLog                       |    3 +++
 plugins/gtk+/glade-attributes.c |   25 +++----------------------
 2 files changed, 6 insertions(+), 22 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bca39dd..d2378ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@
 	* gladeui/glade-signal-editor.c: Left align the warning icon and expand the first
 	  row of the signal tree when loading a widget.
 
+	* plugins/gtk+/glade-attributes.c: Fixed mismatching PangoAttributeType with GType,
+	closes bug 597045.
+
 2011-01-12  Tristan Van Berkom <tristanvb openismus com>
 
 	* gladeui/glade-palette.c: Fixed leaking project (set_project NULL when
diff --git a/plugins/gtk+/glade-attributes.c b/plugins/gtk+/glade-attributes.c
index 93e3dfe..34eab5f 100644
--- a/plugins/gtk+/glade-attributes.c
+++ b/plugins/gtk+/glade-attributes.c
@@ -148,7 +148,8 @@ GLADE_MAKE_EPROP (GladeEPropAttrs, glade_eprop_attrs)
 	 (type) == EDIT_SPIN ? COLUMN_SPIN_ACTIVE :     \
 	 (type) == EDIT_COMBO ? COLUMN_COMBO_ACTIVE: COLUMN_BUTTON_ACTIVE)
 
-     static GtkListStore *get_enum_model_for_combo (PangoAttrType type)
+
+static GtkListStore *get_enum_model_for_combo (PangoAttrType type)
 {
   static GtkListStore *style_store = NULL,
       *weight_store = NULL, *variant_store = NULL,
@@ -521,25 +522,6 @@ glade_gtk_string_from_attr (GladeAttribute * gattr)
   return ret;
 }
 
-static gint
-enum_value_from_string (PangoAttrType type, const gchar * strval)
-{
-  GEnumClass *enum_class;
-  GEnumValue *enum_value;
-  gint value = 0;
-
-  enum_class = g_type_class_ref (type_from_attr_type (type));
-  if ((enum_value = g_enum_get_value_by_nick (enum_class, strval)) != NULL)
-    value = enum_value->value;
-  else
-    g_critical ("Couldnt find enum value for %s, type %s",
-                strval, g_type_name (type_from_attr_type (type)));
-
-  g_type_class_unref (enum_class);
-
-  return value;
-}
-
 GladeAttribute *
 glade_gtk_attribute_from_string (PangoAttrType type, const gchar * strval)
 {
@@ -570,10 +552,9 @@ glade_gtk_attribute_from_string (PangoAttrType type, const gchar * strval)
         /* Enums ... */
         g_value_init (&(gattr->value), type_from_attr_type (type));
         g_value_set_enum (&(gattr->value),
-                          enum_value_from_string (type, strval));
+                          glade_utils_enum_value_from_string (type_from_attr_type (type), strval));
         break;
 
-
       case PANGO_ATTR_UNDERLINE:
       case PANGO_ATTR_STRIKETHROUGH:
         /* Booleans */



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