[gxml] GomProperty serialization use Nick



commit 856a7a74625e5a1ceb4ff37bdddc2f1cb3c609e3
Author: Daniel Espinosa <esodan gmail com>
Date:   Thu Jan 26 10:33:23 2017 -0600

    GomProperty serialization use Nick
    
    If no property name is set, nick definition is used.

 NEWS              |    9 +++++++++
 gxml/XParser.vala |   11 ++++++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 48ddfaf..b3c1f25 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
+===============
+Version 0.13.90
+===============
+
+* Added XSD interfaces (unstable) and GXml.Gom* implementation
+* Fixes on GXml.Gom* reading and writing namespaces
+* New and updated translations:
+    Updated Polish      by Piotr Drąg <piotrdrag gmail com>
+
 
 ===============
 Version 0.13.0
diff --git a/gxml/XParser.vala b/gxml/XParser.vala
index cdddf5a..1384faf 100644
--- a/gxml/XParser.vala
+++ b/gxml/XParser.vala
@@ -634,7 +634,16 @@ public class GXml.XParser : Object, GXml.Parser {
       node.get_property (pspec.name, ref v);
       GomProperty gp = v.get_object () as GomProperty;
       if (gp == null) continue;
-      size += tw.write_attribute (gp.attribute_name, gp.value);
+      string attname = gp.attribute_name;
+      if (attname == null) {
+        if ("::" in pspec.get_nick ()) {
+          attname = pspec.get_nick ().replace ("::","");
+        } else {
+          warning (_("Invalid attribute name for Property: %s").printf (pspec.value_type));
+          attname = pspec.get_nick ();
+        }
+      }
+      size += tw.write_attribute (attname, gp.value);
       size += tw.end_attribute ();
       if (size > 1500)
         tw.flush ();


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