[gxml/gsoc2013: 55/69] Tiny fixes.



commit f63fdeb3d912ba7b9f93bc1606846c16116836c9
Author: Richard Schwarting <aquarichy gmail com>
Date:   Sat Jul 27 00:01:54 2013 -0400

    Tiny fixes.
    
    DomNode.vala: make check_wrong_document and check_read_only protected so only subclasses can see them
    Element.vala: fix remove_attribute_node
    ProcessingInstruction: properly get and set 'data'

 gxml/DomNode.vala               |    4 ++--
 gxml/Element.vala               |    8 ++------
 gxml/ProcessingInstruction.vala |   12 +++++++++---
 3 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/gxml/DomNode.vala b/gxml/DomNode.vala
index 597a316..3371fbc 100644
--- a/gxml/DomNode.vala
+++ b/gxml/DomNode.vala
@@ -48,14 +48,14 @@ namespace GXml {
 
                /* Utility methods */
 
-               private void check_wrong_document (DomNode node) {
+               protected void check_wrong_document (DomNode node) {
                        if (this.owner_document != node.owner_document) {
                                GLib.warning ("WRONG_DOCUMENT_ERR: Node tried to interact with this document 
'%p' but belonged to document '%p'", this.owner_document, node.owner_document);
                        }
                }
 
 
-               internal bool check_read_only () {
+               protected bool check_read_only () {
                        // TODO: introduce a concept of read-only-ness, perhaps
                        // if read-only, raise NO_MODIFICATION_ALLOWED_ERR
                        return false;
diff --git a/gxml/Element.vala b/gxml/Element.vala
index 702bf40..b301927 100644
--- a/gxml/Element.vala
+++ b/gxml/Element.vala
@@ -328,13 +328,9 @@ namespace GXml {
                 * it wasn't found.
                 */
                public Attr remove_attribute_node (Attr old_attr) {
-                       Attr old;
-
-                       this.check_read_only ()
+                       this.check_read_only ();
 
-                       // TODO: need to check for nulls. < Nope, ? controls that.
-                       old = this.attributes.remove (old_attr.name);
-                       if (old == null) {
+                       if (this.attributes.remove (old_attr.name) == false) {
                                GLib.warning ("NOT_FOUND_ERR: No child with name '%s' exists in node '%s'", 
old_attr.name, this.node_name);
                        }
 
diff --git a/gxml/ProcessingInstruction.vala b/gxml/ProcessingInstruction.vala
index ae8ac3e..1edc05b 100644
--- a/gxml/ProcessingInstruction.vala
+++ b/gxml/ProcessingInstruction.vala
@@ -54,15 +54,21 @@ namespace GXml {
                        get;
                        private set;
                }
+
+               private string _data;
+
                /**
                 * The data used by the target, like {{{href="style.xsl" type="text/xml"}}}
                 */
                // TODO: confirm that data here is freeform attributes
                public string data /* throws DomError (not supported yet) */ {
-                       get;
+                       get {
+                               return _data;
+                       }
                        set {
-                               this.check_read_only (); // TODO: does this prevent data from being set? test
-                       };
+                               this.check_read_only ();
+                               this._data = value;
+                       }
                }
                /**
                 * The target name.


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