X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Finstance.cpp;h=0c0f7ac28d1df8fde5b7898fce99f8b0fadcb001;hb=f79c62e519e5e14513897880f4d2710f7a464afb;hp=2eb47620054744036a1777aaaeaacea110fa7082;hpb=b08d1e8f61500392efbe15e599245d3b68e55594;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/instance.cpp b/synfig-studio/trunk/src/gtkmm/instance.cpp index 2eb4762..0c0f7ac 100644 --- a/synfig-studio/trunk/src/gtkmm/instance.cpp +++ b/synfig-studio/trunk/src/gtkmm/instance.cpp @@ -213,8 +213,9 @@ studio::Instance::save() if (synfigapp::Instance::save()) return STATUS_OK; - else - return STATUS_ERROR; + + App::dialog_error_blocking("Save - Error","Unable to save to '" + get_file_name() + "'"); + return STATUS_ERROR; } bool @@ -282,9 +283,19 @@ studio::Instance::dialog_save_as() { struct stat s; - // if stat() succeeds, or it fails with something other than 'file doesn't exist', the file exists + int stat_return = stat(filename.c_str(), &s); + + // if stat() fails with something other than 'file doesn't exist', there's been a real + // error of some kind. let's give up now and ask for a new path. + if (stat_return == -1 && errno != ENOENT) + { + perror(filename.c_str()); + App::dialog_error_blocking("SaveAs - Error","Unable to check whether '" + filename + "' exists."); + continue; + } + // 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) && + if ((stat_return == 0) && !App::dialog_yes_no("File exists", "A file named '" + filename + @@ -296,7 +307,7 @@ studio::Instance::dialog_save_as() if(save_as(filename)) return true; - App::dialog_error_blocking("SaveAs - Error","Unable to save file"); + App::dialog_error_blocking("SaveAs - Error","Unable to save to '" + filename + "'"); } return false; @@ -632,9 +643,17 @@ Instance::safe_revert() bool Instance::safe_close() { - handle uim; - uim=find_canvas_view(get_canvas())->get_ui_interface(); + handle canvas_view = find_canvas_view(get_canvas()); + handle uim=canvas_view->get_ui_interface(); + // if the animation is currently playing, closing the window will cause a crash, + // so don't allow it + if (canvas_view->is_playing()) + { + canvas_view->present(); + App::dialog_error_blocking("Close Error", "The animation is currently playing so the window cannot be closed."); + return false; + } if(get_action_count()) do {