diff --git a/src/graphmanager/graphview.rs b/src/graphmanager/graphview.rs index 4c5e31b..077402a 100644 --- a/src/graphmanager/graphview.rs +++ b/src/graphmanager/graphview.rs @@ -37,6 +37,7 @@ use std::cell::RefMut; use std::{cmp::Ordering, collections::HashMap}; static GRAPHVIEW_STYLE: &str = include_str!("graphview.css"); +pub static GRAPHVIEW_XML_VERSION: &str = "0.1"; mod imp { use super::*; @@ -830,8 +831,11 @@ impl GraphView { .perform_indent(true) .create_writer(&mut buffer); - writer - .write(XMLWEvent::start_element("Graph").attr("id", &private.id.get().to_string()))?; + writer.write( + XMLWEvent::start_element("Graph") + .attr("id", &private.id.get().to_string()) + .attr("version", GRAPHVIEW_XML_VERSION), + )?; //Get the nodes let nodes = self.all_nodes(NodeType::All); @@ -920,6 +924,11 @@ impl GraphView { if let Some(id) = attrs.get::(&String::from("id")) { self.set_id(id.parse::().expect("id should be an u32")); } + if let Some(version) = attrs.get::(&"version".to_string()) { + info!("Found file format version: {}", version); + } else { + warn!("No file format version found"); + } } "Node" => { let id = attrs