[gxml] GOM: Fixed build



commit 3796ad48975bc09eeeba9c78a6b73b5446c8a763
Author: Daniel Espinosa <esodan gmail com>
Date:   Thu Oct 27 14:40:25 2016 -0500

    GOM: Fixed build

 gxml/DomCollections.vala   |    2 +-
 gxml/GXmlListChildren.vala |    2 +-
 gxml/GomElement.vala       |   13 +++++++------
 gxml/GomNode.vala          |   15 +++++++++------
 gxml/GomObject.vala        |   10 +++++++++-
 gxml/GomText.vala          |    5 ++++-
 6 files changed, 31 insertions(+), 16 deletions(-)
---
diff --git a/gxml/DomCollections.vala b/gxml/DomCollections.vala
index 99aacbe..0020b5e 100644
--- a/gxml/DomCollections.vala
+++ b/gxml/DomCollections.vala
@@ -69,7 +69,7 @@ public interface GXml.DomChildNode : GLib.Object {
 
 public interface GXml.DomNodeList : GLib.Object, Gee.BidirList<GXml.DomNode>  {
   public abstract DomNode? item (ulong index);
-  public abstract ulong length { get; }
+  public abstract int length { get; }
 }
 
 public interface GXml.DomHTMLCollection : GLib.Object, Gee.BidirList<GXml.DomElement> {
diff --git a/gxml/GXmlListChildren.vala b/gxml/GXmlListChildren.vala
index 60859b3..72b24b9 100644
--- a/gxml/GXmlListChildren.vala
+++ b/gxml/GXmlListChildren.vala
@@ -250,7 +250,7 @@ public class GXml.GListChildren : AbstractBidirList<GXml.Node>,
   }
   // DomNodeList implementation
   public DomNode? item (ulong index) { return (DomNode) @get ((int) index); }
-  public ulong length { get { return (ulong) size; } }
+  public int length { get { return size; } }
   // DomHTMLCollection
   public new GXml.DomElement? get_element (int index) {
     if (index > this.size || index < 0) return null;
diff --git a/gxml/GomElement.vala b/gxml/GomElement.vala
index e2d0d23..81826d7 100644
--- a/gxml/GomElement.vala
+++ b/gxml/GomElement.vala
@@ -34,7 +34,7 @@ public class GXml.GomElement : GomNode,
                               DomElement,
                               GomObject {
   // DomNode overrides
-  public string? lookup_prefix (string? nspace) {
+  public new string? lookup_prefix (string? nspace) {
     if (namespace_uri == nspace && this.prefix != null)
       return this.prefix;
     foreach (DomNode a in attributes.values) {
@@ -45,7 +45,7 @@ public class GXml.GomElement : GomNode,
     if (parent_node == null) return null;
     return parent_node.lookup_prefix (nspace);
   }
-  public string? DomNode.lookup_namespace_uri (string? prefix) {
+  public new string? lookup_namespace_uri (string? prefix) {
     if (namespace_uri != null && this.prefix == prefix)
       return namespace_uri;
     string s = "";
@@ -130,12 +130,10 @@ public class GXml.GomElement : GomNode,
   // GXml.DomElement
   protected string _namespace_uri = null;
   public string? namespace_uri { owned get { return _namespace_uri.dup (); } }
-  protected string _prefix = null;
   public string? prefix { owned get { return _prefix; } }
   /**
    * Derived classes should define this value at construction time.
    */
-  protected string _local_name = "";
   public string local_name {
     owned get {
       return _local_name;
@@ -216,7 +214,7 @@ public class GXml.GomElement : GomNode,
       var v = get (name);
       if (v == null) return null;
       var n = new GomAttr (_element, name, v);
-      set (name, null);
+      unset (name);
       return n;
     }
     // Introduced in DOM Level 2:
@@ -316,7 +314,10 @@ public class GXml.GomElement : GomNode,
         _namespace_uri = namespace_uri;
       }
     var a = new GomAttr.namespace (this, namespace_uri, p, n, value);
-    _attributes.set_named_item_ns (a);
+    try { _attributes.set_named_item_ns (a); }
+    catch (GLib.Error e) {
+      GLib.message (_("Setting namespaced property error: ")+e.message);
+    }
   }
   public void remove_attribute (string name) {
     (this as GomElement).remove_attribute (name);
diff --git a/gxml/GomNode.vala b/gxml/GomNode.vala
index 85a57dd..8b23565 100644
--- a/gxml/GomNode.vala
+++ b/gxml/GomNode.vala
@@ -52,12 +52,7 @@ public class GXml.GomNode : Object,
       return null;
     }
   }
-  // TODO: Move to GomElement
-  protected class NodeList : Gee.ArrayList<DomNode>, DomNodeList {
-    public DomNode? item (ulong index) { return base.get ((int) index); }
-    public ulong length { get { return (ulong) base.size; } }
-  }
-  protected NodeList _child_nodes = new NodeList ();
+  protected GomNodeList _child_nodes = new GomNodeList ();
   public DomNodeList child_nodes { owned get { return _child_nodes as DomNodeList; } }
   public DomNode? first_child {
     owned get {
@@ -270,3 +265,11 @@ public class GXml.GomNode : Object,
   public bool dispatch_event (DomEvent event)
   { return false; } // FIXME:
 }
+
+/**
+ * List of {@link DomNode} implementing {@link DomNodeList}
+ */
+public class GXml.GomNodeList : Gee.ArrayList<DomNode>, DomNodeList {
+  public DomNode? item (ulong index) { return base.get ((int) index); }
+  public int length { get { return size; } }
+}
diff --git a/gxml/GomObject.vala b/gxml/GomObject.vala
index 574c19b..7e613d8 100644
--- a/gxml/GomObject.vala
+++ b/gxml/GomObject.vala
@@ -115,7 +115,15 @@ public interface GXml.GomObject : GLib.Object,
   public virtual void remove_attribute (string name) {
     var prop = get_class ().find_property (name);
     if (prop != null) {
-      set_attribute (name, null);
+      if (prop.value_type.is_a (typeof (SerializableProperty))) {
+        (this as SerializableProperty).set_serializable_property_value (null);
+        return;
+      }
+      if (prop.value_type.is_a (typeof (SerializableCollection))) {
+        return;
+      }
+      Value v = Value (typeof (Object));
+      (this as Object).set_property (name, v);
       return;
     }
     (this as DomElement).remove_attribute (name);
diff --git a/gxml/GomText.vala b/gxml/GomText.vala
index 94c98fe..6133a01 100644
--- a/gxml/GomText.vala
+++ b/gxml/GomText.vala
@@ -73,7 +73,10 @@ public class GXml.GomText : GomCharacterData,
     _local_name = "#TEXT";
   }
 
-  public GomText (DomDocument doc, string data);
+  public GomText (DomDocument doc, string data) {
+    _document = doc;
+    _data = data;
+  }
 }
 public class GXml.GomProcessingInstruction : GomCharacterData,
                                             DomProcessingInstruction


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