- Add standard file extension when needed (note: this doesn't

behaves exactly like the design says, since it doesn't allow for 
Serializer::get_filename_extension() to return a *list*
of space-separated extensions; rather, it assumes that a Serializer
will return just *one* extension)


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@999 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-09-02 13:35:14 +00:00
parent 40ab20a87a
commit c0a89b1bd1
1 changed files with 8 additions and 1 deletions

View File

@ -225,8 +225,15 @@ GuiBuilder::on_file_saveas_activate()
int result = dialog.run(); int result = dialog.run();
if(result==Gtk::RESPONSE_OK) if(result==Gtk::RESPONSE_OK)
{ {
serializer.save_snapshot(dialog.get_filename(), history);
_filename = dialog.get_filename(); _filename = dialog.get_filename();
// Append standard extension if none (or a different one) is provided
std::string ext = std::string(".") + serializer.get_filename_extension();
if(_filename.size() < ext.size() || _filename.substr(_filename.size() - ext.size()) != ext)
_filename += ext;
serializer.save_snapshot(_filename, history);
msg = "File: " + _filename + " saved."; msg = "File: " + _filename + " saved.";
} // end - if(result==Gtk::RESPONSE_OK) } // end - if(result==Gtk::RESPONSE_OK)