From 1115a7820a7a9dda9d2042c39ad5b7bb10919f86 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 14 Feb 2015 07:06:49 +0000 Subject: Fix save issues. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5564 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/App.cpp | 9 ++++++--- src/gui/GraphBox.cpp | 12 +++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/gui/App.cpp b/src/gui/App.cpp index 3deda1a2..730243a7 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -349,8 +349,11 @@ App::quit(Gtk::Window* dialog_parent) quit = (d.run() == Gtk::RESPONSE_CLOSE); } - if (quit) - Gtk::Main::quit(); + if (!quit) { + return false; + } + + Gtk::Main::quit(); try { const std::string path = _world->conf().save( @@ -361,7 +364,7 @@ App::quit(Gtk::Window* dialog_parent) % e.what()); } - return quit; + return true; } bool diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 8e59c0e7..9c100f93 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -145,8 +145,6 @@ GraphBox::GraphBox(BaseObjectType* cobject, sigc::mem_fun(this, &GraphBox::event_port_names_toggled)); _menu_arrange->signal_activate().connect( sigc::mem_fun(this, &GraphBox::event_arrange)); - _menu_quit->signal_activate().connect( - sigc::mem_fun(this, &GraphBox::event_quit)); _menu_zoom_in->signal_activate().connect( sigc::mem_fun(this, &GraphBox::event_zoom_in)); _menu_zoom_out->signal_activate().connect( @@ -501,7 +499,7 @@ GraphBox::event_save_as() const URIs& uris = _app->uris(); while (true) { Gtk::FileChooserDialog dialog( - "Save Graph", Gtk::FILE_CHOOSER_ACTION_CREATE_FOLDER); + "Save Graph", Gtk::FILE_CHOOSER_ACTION_SAVE); if (_window) { dialog.set_transient_for(*_window); } @@ -532,6 +530,11 @@ GraphBox::event_save_as() if (basename.find('.') == std::string::npos) { filename += ".ingen"; basename += ".ingen"; + } else if (filename.substr(filename.length() - 4) == ".ttl") { + const Glib::ustring dir = Glib::path_get_dirname(filename); + if (dir.substr(dir.length() - 6) != ".ingen") { + error("File does not appear to be in an Ingen bundle."); + } } else if (filename.substr(filename.length() - 6) != ".ingen") { error("Ingen bundles must end in \".ingen\""); continue; @@ -579,8 +582,7 @@ GraphBox::event_save_as() _app->loader()->save_graph(_graph, uri); const_cast(_graph.get())->set_property( uris.ingen_file, - _app->forge().alloc_uri(uri.c_str()), - Resource::Graph::EXTERNAL); + _app->forge().alloc_uri(uri.c_str())); _status_bar->push( (boost::format("Saved %1% to %2%") % _graph->path().c_str() % filename).str(), -- cgit v1.2.1