From 608aeac60ef43243b85c0dcc5894ccc79f35fba5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 21 Oct 2007 19:02:02 +0000 Subject: Fix crash on OSC connection. Fix patch filename persistance. git-svn-id: http://svn.drobilla.net/lad/ingen@894 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/PatchWindow.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/libs/gui/PatchWindow.cpp') diff --git a/src/libs/gui/PatchWindow.cpp b/src/libs/gui/PatchWindow.cpp index 716d4356..5569c037 100644 --- a/src/libs/gui/PatchWindow.cpp +++ b/src/libs/gui/PatchWindow.cpp @@ -304,10 +304,11 @@ PatchWindow::event_import_location() void PatchWindow::event_save() { - if (_patch->filename() == "") + GraphObject::Variables::const_iterator doc = _patch->variables().find("ingen:document"); + if (doc == _patch->variables().end()) event_save_as(); else - App::instance().loader()->save_patch(_patch, _patch->filename()); + App::instance().loader()->save_patch(_patch, doc->second.get_string()); } @@ -330,9 +331,9 @@ PatchWindow::event_save_as() save_button->property_has_default() = true; // Set current folder to most sensible default - const string& current_filename = _patch->filename(); - if (current_filename.length() > 0) - dialog.set_filename(current_filename); + GraphObject::Variables::const_iterator doc = _patch->variables().find("ingen:document"); + if (doc != _patch->variables().end()) + dialog.set_uri(doc->second.get_string()); else if (App::instance().configuration()->patch_folder().length() > 0) dialog.set_current_folder(App::instance().configuration()->patch_folder()); @@ -365,8 +366,8 @@ PatchWindow::event_save_as() if (confirm) { App::instance().loader()->save_patch(_patch, filename); - _patch->set_filename(filename); - //_patch->set_variable("filename", Atom(filename.c_str())); + App::instance().engine()->set_variable(_patch->path(), "ingen:document", + Atom(Glib::filename_to_uri(filename).c_str())); } } App::instance().configuration()->set_patch_folder(dialog.get_current_folder()); -- cgit v1.2.1