Add validator to the subtitle save command to check if there are actually unsaved changes

Originally committed to SVN as r5868.
This commit is contained in:
Thomas Goyne 2011-11-16 22:43:56 +00:00
parent 14c9d8ec87
commit 1590b2a65e

View file

@ -350,10 +350,15 @@ struct subtitle_save : public Command {
STR_MENU("&Save Subtitles") STR_MENU("&Save Subtitles")
STR_DISP("Save Subtitles") STR_DISP("Save Subtitles")
STR_HELP("Saves subtitles.") STR_HELP("Saves subtitles.")
CMD_TYPE(COMMAND_VALIDATE)
void operator()(agi::Context *c) { void operator()(agi::Context *c) {
save_subtitles(c, c->ass->CanSave() ? c->ass->filename : ""); save_subtitles(c, c->ass->CanSave() ? c->ass->filename : "");
} }
bool Validate(const agi::Context *c) {
return c->ass->IsModified();
}
}; };