public static void Import(ProjectBackend project, string filename) { XmlDocument doc = new XmlDocument(); doc.PreserveWhitespace = true; doc.XmlResolver = null; doc.Load(filename); project.SetFileName(filename); project.Id = System.IO.Path.GetFileName(filename); doc = GladeUtils.XslImportTransform(doc); XmlNode node = doc.SelectSingleNode("/glade-interface"); if (node == null) { throw new ApplicationException(Catalog.GetString("Not a glade file according to node name.")); } ObjectReader reader = new ObjectReader(project, FileFormat.Glade); foreach (XmlElement toplevel in node.SelectNodes("widget")) { Wrapper.Container wrapper = Stetic.ObjectWrapper.ReadObject(reader, toplevel) as Wrapper.Container; if (wrapper != null) { project.AddWidget((Gtk.Widget)wrapper.Wrapped); } } }
public static void Import (ProjectBackend project, string filename) { XmlDocument doc = new XmlDocument (); doc.PreserveWhitespace = true; doc.XmlResolver = null; doc.Load (filename); project.Id = System.IO.Path.GetFileName (filename); doc = GladeUtils.XslImportTransform (doc); XmlNode node = doc.SelectSingleNode ("/glade-interface"); if (node == null) throw new ApplicationException (Catalog.GetString ("Not a glade file according to node name.")); ObjectReader reader = new ObjectReader (project, FileFormat.Glade); foreach (XmlElement toplevel in node.SelectNodes ("widget")) { Wrapper.Container wrapper = Stetic.ObjectWrapper.ReadObject (reader, toplevel, null) as Wrapper.Container; if (wrapper != null) project.AddWidget ((Gtk.Widget)wrapper.Wrapped); } }