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



commit 60e086b07207a0b02b4241359ca6712f2441cd14
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 |   12 +++++++++---
 3 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5cb2f48..b409f4f 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-04  Tristan Van Berkom <tvb gnome org>
 
 	* plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-gtk.c: Ensure 'related-action'
diff --git a/gladeui/glade-property.c b/gladeui/glade-property.c
index e70a7bd..6c65b59 100644
--- a/gladeui/glade-property.c
+++ b/gladeui/glade-property.c
@@ -1151,13 +1151,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 c280c8f..8958fe8 100644
--- a/gladeui/glade-xml-utils.c
+++ b/gladeui/glade-xml-utils.c
@@ -121,9 +121,15 @@ glade_xml_get_content (GladeXmlNode *node_in)
 void
 glade_xml_set_content (GladeXmlNode *node_in, const gchar *content)
 {
-	xmlNodePtr node = (xmlNodePtr) node_in;
-
-	xmlNodeSetContent(node, BAD_CAST(content));
+  xmlNodePtr node = (xmlNodePtr) node_in;
+  xmlChar   *content_encoded;
+
+  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]