void OnCommandCreated(object s, EventArgs args) { CustomCommandWidget widget = (CustomCommandWidget)s; commands.Add(widget.CustomCommand); // Add an empty slot to allow adding more commands. AddCommandSlot(null); }
void AddCommandSlot (CustomCommand cmd) { CustomCommandWidget widget = new CustomCommandWidget (entry, cmd, configSelector, supportedTypes); vboxCommands.PackStart (widget, false, false, 0); widget.CommandCreated += OnCommandCreated; widget.CommandRemoved += OnCommandRemoved; widget.Show (); lastSlot = widget; }
void OnCommandRemoved(object s, EventArgs args) { CustomCommandWidget widget = (CustomCommandWidget)s; commands.Remove(widget.CustomCommand); if (lastSlot != widget) { vboxCommands.Remove(widget); } }
void AddCommandSlot(CustomCommand cmd) { CustomCommandWidget widget = new CustomCommandWidget(entry, cmd, configSelector, supportedTypes); vboxCommands.PackStart(widget, false, false, 0); widget.CommandCreated += OnCommandCreated; widget.CommandRemoved += OnCommandRemoved; widget.Show(); lastSlot = widget; }