diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2013-07-19 15:55:54 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2013-07-19 16:17:17 -0300 |
commit | eba6befa449bba7ca432c3c09f97b60e5f29570a (patch) | |
tree | affb3d087b536b03580934d3e090ed6b00b97b82 | |
parent | accd7067a18390b6e0050fb234d2de4420b80227 (diff) | |
download | glade-eba6befa449bba7ca432c3c09f97b60e5f29570a.tar.gz |
Added new funtions to handle document level comments
glade_xml_doc_new_comment(), glade_xml_node_prev_with_comments (),
glade_xml_node_add_prev_sibling () and glade_xml_node_add_next_sibling ()
-rw-r--r-- | gladeui/glade-xml-utils.c | 25 | ||||
-rw-r--r-- | gladeui/glade-xml-utils.h | 5 |
2 files changed, 29 insertions, 1 deletions
diff --git a/gladeui/glade-xml-utils.c b/gladeui/glade-xml-utils.c index aea3f77d..e9c91456 100644 --- a/gladeui/glade-xml-utils.c +++ b/gladeui/glade-xml-utils.c @@ -858,6 +858,13 @@ glade_xml_node_next_with_comments (GladeXmlNode * node_in) return (GladeXmlNode *) node->next; } +GladeXmlNode * +glade_xml_node_prev_with_comments (GladeXmlNode * node_in) +{ + xmlNodePtr node = (xmlNodePtr) node_in; + + return (GladeXmlNode *) node->prev; +} const gchar * glade_xml_node_get_name (GladeXmlNode * node_in) @@ -962,3 +969,21 @@ glade_xml_load_sym_from_node (GladeXmlNode * node_in, } return retval; } + +GladeXmlNode * +glade_xml_doc_new_comment (GladeXmlDoc *doc, const gchar *comment) +{ + return (GladeXmlNode *) xmlNewDocComment ((xmlDocPtr) (doc), BAD_CAST (comment)); +} + +GladeXmlNode * +glade_xml_node_add_prev_sibling (GladeXmlNode *node, GladeXmlNode *new_node) +{ + return (GladeXmlNode *) xmlAddPrevSibling ((xmlNodePtr) node, (xmlNodePtr) new_node); +} + +GladeXmlNode * +glade_xml_node_add_next_sibling (GladeXmlNode *node, GladeXmlNode *new_node) +{ + return (GladeXmlNode *) xmlAddNextSibling ((xmlNodePtr) node, (xmlNodePtr) new_node); +} diff --git a/gladeui/glade-xml-utils.h b/gladeui/glade-xml-utils.h index c08f821a..80d3a382 100644 --- a/gladeui/glade-xml-utils.h +++ b/gladeui/glade-xml-utils.h @@ -234,8 +234,10 @@ void glade_xml_node_append_child (GladeXmlNode * node, GladeXmlNode * void glade_xml_node_remove (GladeXmlNode *node_in); gboolean glade_xml_node_is_comment (GladeXmlNode *node_in); GladeXmlNode * glade_xml_node_next_with_comments (GladeXmlNode *node_in); +GladeXmlNode * glade_xml_node_prev_with_comments (GladeXmlNode * node_in); GladeXmlNode * glade_xml_node_get_children_with_comments (GladeXmlNode *node); - +GladeXmlNode * glade_xml_node_add_prev_sibling (GladeXmlNode *node, GladeXmlNode *new_node); +GladeXmlNode * glade_xml_node_add_next_sibling (GladeXmlNode *node, GladeXmlNode *new_node); /* Document Operatons */ GladeXmlNode * glade_xml_doc_get_root (GladeXmlDoc *doc); @@ -243,6 +245,7 @@ GladeXmlDoc * glade_xml_doc_new (void); void glade_xml_doc_set_root (GladeXmlDoc *doc, GladeXmlNode *node); void glade_xml_doc_free (GladeXmlDoc *doc_in); gint glade_xml_doc_save (GladeXmlDoc *doc_in, const gchar *full_path); +GladeXmlNode * glade_xml_doc_new_comment (GladeXmlDoc *doc, const gchar *comment); /* Parse Context */ GladeXmlContext * glade_xml_context_new (GladeXmlDoc *doc, const gchar *name_space); |