summaryrefslogtreecommitdiffstats
path: root/src/gui/GraphBox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/GraphBox.cpp')
-rw-r--r--src/gui/GraphBox.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index 692e378a..6423c016 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -493,11 +493,7 @@ GraphBox::event_save()
if (!document.is_valid() || document.type() != _app->uris().forge.URI) {
event_save_as();
} else {
- _app->loader()->save_graph(_graph, document.ptr<char>());
- _status_bar->push(
- (boost::format("Saved %1% to %2%") % _graph->path().c_str()
- % document.ptr<char>()).str(),
- STATUS_CONTEXT_GRAPH);
+ save_graph(Raul::URI(document.ptr<char>()));
}
}
@@ -528,6 +524,24 @@ GraphBox::confirm(const Glib::ustring& message,
}
void
+GraphBox::save_graph(const Raul::URI& uri)
+{
+ if (_app->interface()->uri().substr(0, 3) == "tcp") {
+ _status_bar->push(
+ (boost::format("Saved %1% to %2% on client")
+ % _graph->path() % uri).str(),
+ STATUS_CONTEXT_GRAPH);
+ _app->loader()->save_graph(_graph, uri);
+ } else {
+ _status_bar->push(
+ (boost::format("Saved %1% to %2% on server")
+ % _graph->path() % uri).str(),
+ STATUS_CONTEXT_GRAPH);
+ _app->interface()->copy(_graph->uri(), uri);
+ }
+}
+
+void
GraphBox::event_save_as()
{
const URIs& uris = _app->uris();
@@ -613,14 +627,11 @@ GraphBox::event_save_as()
if (confirmed) {
const Glib::ustring uri = Glib::filename_to_uri(filename);
- _app->loader()->save_graph(_graph, uri);
+ save_graph(Raul::URI(uri));
+
const_cast<GraphModel*>(_graph.get())->set_property(
uris.ingen_file,
_app->forge().alloc_uri(uri.c_str()));
- _status_bar->push(
- (boost::format("Saved %1% to %2%") % _graph->path().c_str()
- % filename).str(),
- STATUS_CONTEXT_GRAPH);
}
_app->world()->conf().set(