public void SetButtons(IEnumerable <DialogButton> newButtons) { if (buttons != null) { foreach (var b in buttons) { ((Gtk.Container)b.Parent).Remove(b); b.Destroy(); } } dialogButtons = newButtons.ToArray(); buttons = new Gtk.Button [dialogButtons.Length]; for (int n = 0; n < dialogButtons.Length; n++) { var db = dialogButtons[n]; Gtk.Button b = (Gtk.Button)Window.AddButton(db.Label, Gtk.ResponseType.None); UpdateButton(db, b); buttons[n] = b; buttons[n].Clicked += HandleButtonClicked; } }