[gxml] Fixed GomElement.id implementation



commit 117f0d452c34615e515950c6ac24c597130e3792
Author: Daniel Espinosa <esodan gmail com>
Date:   Sat Oct 21 08:17:13 2017 -0500

    Fixed GomElement.id implementation

 gxml/GomElement.vala     |    6 ++----
 test/GomElementTest.vala |    3 +++
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gxml/GomElement.vala b/gxml/GomElement.vala
index 96f6f28..7f7de8f 100644
--- a/gxml/GomElement.vala
+++ b/gxml/GomElement.vala
@@ -298,10 +298,8 @@ public class GXml.GomElement : GomNode,
   /**
    * An attribute called 'id'.
    */
-  public string? id {
-    owned get { return (this as GomElement).get_attribute ("id"); }
-    set { (this as GomObject).set_attribute ("id", value); }
-  }
+  [Description (nick="::id")]
+  public string? id { owned get; set; }
   /**
    * An attribute called 'class'.
    */
diff --git a/test/GomElementTest.vala b/test/GomElementTest.vala
index d2999af..a231741 100644
--- a/test/GomElementTest.vala
+++ b/test/GomElementTest.vala
@@ -164,6 +164,9 @@ class GomElementTest : GXmlTest  {
                                assert (elem.get_attribute_ns ("http://www.gnome.org/GXml";, "xola") == null);
                                assert (elem.get_attribute ("xola") == null);
                                assert (elem.attributes.size == 2);
+                               elem.id = "idnode";
+                               assert ("id=\"idnode\"" in elem.write_string ());
+                               assert (elem.id == "idnode");
                                try {
 #if DEBUG
                                        message ("Documento:"+parser.write_string ());


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