X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Finstance.cpp;h=da88e80a9be6f247c17977f1bc23e66eff48e130;hb=90a8e832d9ebf093fae1b01a07011d873c323dc5;hp=a60e68a1f32cc5836795c88495b8277dc84aac25;hpb=c6af6e1c3816eb3b15c573089b32e6ae65cd2f49;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/instance.cpp b/synfig-studio/trunk/src/gtkmm/instance.cpp index a60e68a..da88e80 100644 --- a/synfig-studio/trunk/src/gtkmm/instance.cpp +++ b/synfig-studio/trunk/src/gtkmm/instance.cpp @@ -2,7 +2,7 @@ /*! \file gtkmm/instance.cpp ** \brief writeme ** -** $Id: instance.cpp,v 1.2 2005/01/13 18:37:30 darco Exp $ +** $Id$ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley @@ -50,6 +50,8 @@ #include "widget_waypointmodel.h" #include #include "iconcontroler.h" +#include +#include #endif @@ -250,7 +252,13 @@ studio::Instance::dialog_save_as() } } - while(App::dialog_saveas_file("SaveAs", filename)) + // show the canvas' name if it has one, else its ID + while(App::dialog_saveas_file(_("Choose a Filename to Save As") + + String(" (") + + (canvas->get_name().empty() + ? canvas->get_id() + : canvas->get_name()) + + ") ...", filename)) { // If the filename still has wildcards, then we should // continue looking for the file we want @@ -274,6 +282,19 @@ studio::Instance::dialog_save_as() continue; } + { + struct stat s; + // if stat() succeeds, or it fails with something other than 'file doesn't exist', the file exists + // if the file exists and the user doesn't want to overwrite it, keep prompting for a filename + if ((stat(filename.c_str(), &s) != -1 || errno != ENOENT) && + !App::dialog_yes_no("File exists", + "A file named '" + + filename + + "' already exists.\n\n" + "Do you want to replace it with the file you are saving?")) + continue; + } + if(save_as(filename)) break;