From 5a42798af412fb220336983b76d307dc6bf2678a Mon Sep 17 00:00:00 2001 From: Konstantin Dmitriev Date: Dec 13 2019 04:35:50 +0000 Subject: Remove App::open_as() method, as it doesn't serves its purpose anyway. See https://github.com/synfig/synfig/issues/949 --- diff --git a/synfig-studio/src/gui/app.cpp b/synfig-studio/src/gui/app.cpp index c90d134..dab7b58 100644 --- a/synfig-studio/src/gui/app.cpp +++ b/synfig-studio/src/gui/app.cpp @@ -3746,13 +3746,7 @@ App::wrap_into_temporary_filesystem( } bool -App::open(std::string filename) -{ - return open_as(filename,filename); -} - -bool -App::open_as(std::string filename,std::string as,synfig::FileContainerZip::file_size_t truncate_storage_size) +App::open(std::string filename, /* std::string as, */ synfig::FileContainerZip::file_size_t truncate_storage_size) { #ifdef _WIN32 size_t buf_size = PATH_MAX - 1; @@ -3780,12 +3774,12 @@ App::open_as(std::string filename,std::string as,synfig::FileContainerZip::file_ FileSystem::Handle canvas_file_system = CanvasFileNaming::make_filesystem(container); // wrap into temporary file system - canvas_file_system = wrap_into_temporary_filesystem(canvas_file_system, filename, as, truncate_storage_size); + canvas_file_system = wrap_into_temporary_filesystem(canvas_file_system, filename, filename, truncate_storage_size); // file to open inside canvas file-system String canvas_filename = CanvasFileNaming::project_file(filename); - etl::handle canvas = open_canvas_as(canvas_file_system ->get_identifier(canvas_filename), as, errors, warnings); + etl::handle canvas = open_canvas_as(canvas_file_system ->get_identifier(canvas_filename), filename, errors, warnings); if(canvas && get_instance(canvas)) { get_instance(canvas)->find_canvas_view(canvas)->present(); @@ -3805,8 +3799,8 @@ App::open_as(std::string filename,std::string as,synfig::FileContainerZip::file_ _("Close"), warnings); - if (as.find(custom_filename_prefix.c_str()) != 0) - add_recent_file(as); + if (filename.find(custom_filename_prefix.c_str()) != 0) + add_recent_file(filename); handle instance(Instance::create(canvas, container)); @@ -4122,7 +4116,7 @@ App::dialog_open(string filename) truncate_storage_size = i->storage_size; } - if(open_as(filename,filename,truncate_storage_size)) + if(open(filename,truncate_storage_size)) break; get_ui_interface()->error(_("Unable to open file")); diff --git a/synfig-studio/src/gui/app.h b/synfig-studio/src/gui/app.h index 44fc661..b3251cc 100644 --- a/synfig-studio/src/gui/app.h +++ b/synfig-studio/src/gui/app.h @@ -366,11 +366,9 @@ public: std::string as, synfig::FileContainerZip::file_size_t truncate_storage_size = 0 ); - static bool open(std::string filename); - - static bool open_as( + static bool open( std::string filename, - std::string as, + /* std::string as, */ synfig::FileContainerZip::file_size_t truncate_storage_size = 0 ); static bool open_from_temporary_filesystem(std::string temporary_filename); diff --git a/synfig-studio/src/gui/mainwindow.cpp b/synfig-studio/src/gui/mainwindow.cpp index 5df031a..2edf9d8 100644 --- a/synfig-studio/src/gui/mainwindow.cpp +++ b/synfig-studio/src/gui/mainwindow.cpp @@ -391,7 +391,7 @@ MainWindow::on_recent_files_changed() menu_items += ""; action_group->add( Gtk::Action::create(action_name, quoted, fullnames[i]), - sigc::hide_return(sigc::bind(sigc::ptr_fun(&App::open),fullnames[i])) + sigc::hide_return(sigc::bind(sigc::ptr_fun(&App::open),fullnames[i],0)) ); }