summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/GraphBox.cpp31
-rw-r--r--src/gui/GraphBox.hpp2
2 files changed, 23 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(
diff --git a/src/gui/GraphBox.hpp b/src/gui/GraphBox.hpp
index 3ffd1f91..20e0a764 100644
--- a/src/gui/GraphBox.hpp
+++ b/src/gui/GraphBox.hpp
@@ -106,6 +106,8 @@ private:
bool confirm(const Glib::ustring& message,
const Glib::ustring& secondary_text="");
+ void save_graph(const Raul::URI& uri);
+
void event_import();
void event_save();
void event_save_as();