public CreateEntryDialog(Connection connection, Template theTemplate) { if (connection == null) throw new ArgumentNullException("connection"); if (theTemplate == null) throw new ArgumentNullException("theTemplate"); conn = connection; t = theTemplate; isTemplate = true; Init (); foreach (string s in t.Classes) { attrListStore.AppendValues ("objectClass", s, "Optional"); _objectClass.Add (s); } showAttributes (); createEntryDialog.Icon = Global.latIcon; createEntryDialog.Run (); createEntryDialog.Run (); createEntryDialog.Destroy (); }
public TemplateEditorDialog(Connection connection, Template theTemplate) { conn = connection; _isEdit = true; t = theTemplate; Init (); nameEntry.Text = t.Name; nameEntry.Sensitive = false; foreach (string s in t.Classes) { objListStore.AppendValues (s); _objectClass.Add (s); } ShowAttributes (); templateEditorDialog.Run (); templateEditorDialog.Destroy (); }
public void OnOkClicked(object o, EventArgs args) { if (_isEdit) { t.Name = nameEntry.Text; t.ClearAttributes (); } else { t = new Template (nameEntry.Text); } t.AddClass (_objectClass); foreach (object[] row in attrListStore) { string nam = (string) row[0]; string val = (string) row[2]; if (string.IsNullOrEmpty(nam) || string.IsNullOrEmpty(val)) continue; t.AddAttribute (nam, val); } }
public void Update(Template t) { for (int i = 0; i < _templates.Count; i++) { Template p = (Template) _templates[i]; if (t.Name.Equals (p.Name)) { _templates[i] = t; break; } } }
public void Add(Template t) { _templates.Add (t); }