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



commit 0a47fe87098c800293a2139eea984db1203bdde3
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                 |   12 +++++++++++-
 gladeui/glade-property.c  |    7 -------
 gladeui/glade-xml-utils.c |    8 +++++++-
 3 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3816170..87bf90f 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  Juan Pablo Ugarte <juanpablougarte gmail com>
 
 	* configure.ac, NEWS: Rolling 3.10.1
@@ -11,7 +21,7 @@
 	  Emit parse-finished signal before setting loading state to false.
 
 	* plugins/gtk+/glade-gtk-grid.c: infer n-row and n-column virtual
-	  properties value from children packing props. 
+	  properties value from children packing props.
 
 2011-10-06  Tristan Van Berkom <tvb gnome org>
 
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 558adcd..1789645 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]