[glade] * gladeui/glade-property.c, gladeui/glade-xml-utils.c:



commit ee98d82585da32c84c7f3c0d8239b0445f89a263
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sun Oct 9 14:45:46 2011 -0400

    	* gladeui/glade-property.c, gladeui/glade-xml-utils.c:
    
    	Fix a bug on the GtkComboBoxText (and probably others) when adding
    	a special char (like '&') in an item's name: every characters following
    	the special char disappeared while writting the xml file.
    
    	Bug 654609.

 ChangeLog                 |   10 ++++++++++
 gladeui/glade-property.c  |    7 -------
 gladeui/glade-xml-utils.c |    8 +++++++-
 3 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e6bf68b..996bb94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-10-09  Fabien Parent <parent f gmail com>
+
+	* gladeui/glade-property.c, gladeui/glade-xml-utils.c:
+
+	Fix a bug on the GtkComboBoxText (and probably others) when adding
+	a special char (like '&') in an item's name: every characters following
+	the special char disappeared while writting the xml file.
+
+	Bug 654609.
+
 2011-10-06  Tristan Van Berkom <tvb gnome org>
 
 	* gladeui/glade-widget-adaptor.c: Implemented a generic ->depends() routine
diff --git a/gladeui/glade-property.c b/gladeui/glade-property.c
index 8bd9bc8..a90d256 100644
--- a/gladeui/glade-property.c
+++ b/gladeui/glade-property.c
@@ -1192,13 +1192,6 @@ glade_property_write (GladeProperty * property,
      * funcs that may not like NULL.
      */
     value = g_strdup ("");
-  else
-    {
-      /* Escape the string so that it will be parsed as it should. */
-      tmp = value;
-      value = g_markup_escape_text (value, -1);
-      g_free (tmp);
-    }
 
   /* Now dump the node values... */
   prop_node = glade_xml_node_new (context, GLADE_XML_TAG_PROPERTY);
diff --git a/gladeui/glade-xml-utils.c b/gladeui/glade-xml-utils.c
index 29fb2ae..aea3f77 100644
--- a/gladeui/glade-xml-utils.c
+++ b/gladeui/glade-xml-utils.c
@@ -123,8 +123,14 @@ void
 glade_xml_set_content (GladeXmlNode * node_in, const gchar * content)
 {
   xmlNodePtr node = (xmlNodePtr) node_in;
+  xmlChar *content_encoded;
 
-  xmlNodeSetContent (node, BAD_CAST (content));
+  g_return_if_fail (node != NULL);
+  g_return_if_fail (node->doc != NULL);
+
+  content_encoded = xmlEncodeSpecialChars (node->doc, BAD_CAST (content));
+  xmlNodeSetContent (node, BAD_CAST (content_encoded));
+  xmlFree (content_encoded);
 }
 
 /*



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