public void Read(Wrapper.Widget baseWidget, XmlElement elem) { name = elem.GetAttribute("name"); if (elem.HasAttribute("type")) { type = (Gtk.UIManagerItemType)Enum.Parse(typeof(Gtk.UIManagerItemType), elem.GetAttribute("type")); } // The name of an action may be empty in some situations (e.g. when adding a new action but before entering the name) XmlAttribute actionAt = elem.Attributes ["action"]; if (actionAt != null) { string aname = actionAt.Value; foreach (ActionGroup grp in baseWidget.LocalActionGroups) { action = grp.GetAction(aname); if (action != null) { break; } } if (action == null) { foreach (ActionGroup group in baseWidget.Project.ActionGroups) { action = group.GetAction(aname); if (action != null) { break; } } } if (action != null) { lastActionName = action.Name; action.Deleted += OnActionDeleted; action.ObjectChanged += OnActionChanged; } } try { loading = true; foreach (XmlElement child in elem.SelectNodes("node")) { ActionTreeNode node = new ActionTreeNode(); node.Read(baseWidget, child); Children.Add(node); } } finally { loading = false; } }
public void Read(Wrapper.Widget baseWidget, XmlElement elem) { name = elem.GetAttribute ("name"); if (elem.HasAttribute ("type")) type = (Gtk.UIManagerItemType) Enum.Parse (typeof(Gtk.UIManagerItemType), elem.GetAttribute ("type")); // The name of an action may be empty in some situations (e.g. when adding a new action but before entering the name) XmlAttribute actionAt = elem.Attributes ["action"]; if (actionAt != null) { string aname = actionAt.Value; foreach (ActionGroup grp in baseWidget.LocalActionGroups) { action = grp.GetAction (aname); if (action != null) break; } if (action == null) { foreach (ActionGroup group in baseWidget.Project.ActionGroups) { action = group.GetAction (aname); if (action != null) break; } } if (action != null) { lastActionName = action.Name; action.Deleted += OnActionDeleted; action.ObjectChanged += OnActionChanged; } } try { loading = true; foreach (XmlElement child in elem.SelectNodes ("node")) { ActionTreeNode node = new ActionTreeNode (); node.Read (baseWidget, child); Children.Add (node); } } finally { loading = false; } }