X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Finstance.cpp;h=7cfba5c1cde013493f6c3926bad8006975aba470;hb=8d7d3cdebad707c13d8365e2860dfc42666445fd;hp=2d4ecdb918f2a185c136cb14b9f869e5f615efb7;hpb=9fc17cc46bd63a7508b82c967801a09be882fe57;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/instance.cpp b/synfig-studio/trunk/src/gtkmm/instance.cpp index 2d4ecdb..7cfba5c 100644 --- a/synfig-studio/trunk/src/gtkmm/instance.cpp +++ b/synfig-studio/trunk/src/gtkmm/instance.cpp @@ -199,7 +199,7 @@ studio::Instance::save_as(const synfig::String &file_name) list >::iterator iter; for(iter=canvas_view_list().begin();iter!=canvas_view_list().end();iter++) (*iter)->render_settings.set_entry_filename(); - App::add_recent_file(file_name); + App::add_recent_file(etl::handle(this)); return true; } return false; @@ -214,10 +214,8 @@ studio::Instance::open() Instance::Status studio::Instance::save() { - // the filename will be set to "Synfig Animation 1" or some such when first created - // and will be changed to an absolute path once it has been saved - // so if it still begins with "Synfig Animation " then we need to ask where to save it - if(get_file_name().find(DEFAULT_FILENAME_PREFIX)==0) + // if we don't have a real filename yet then we need to ask where to save it + if (!has_real_filename()) { if (dialog_save_as()) return STATUS_OK; @@ -226,12 +224,24 @@ studio::Instance::save() } if (synfigapp::Instance::save()) + { + App::add_recent_file(etl::handle(this)); return STATUS_OK; + } App::dialog_error_blocking("Save - Error","Unable to save to '" + get_file_name() + "'"); return STATUS_ERROR; } +// the filename will be set to "Synfig Animation 1" or some such when first created +// and will be changed to an absolute path once it has been saved +// so if it still begins with "Synfig Animation " then we don't have a real filename yet +bool +studio::Instance::has_real_filename() +{ + return get_file_name().find(DEFAULT_FILENAME_PREFIX) != 0; +} + bool studio::Instance::dialog_save_as() { @@ -264,7 +274,7 @@ studio::Instance::dialog_save_as() } } - if (get_file_name().find(DEFAULT_FILENAME_PREFIX) != 0) + if (has_real_filename()) filename = absolute_path(filename); // show the canvas' name if it has one, else its ID