summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-03-17 16:42:15 +0000
committerDavid Robillard <d@drobilla.net>2014-03-17 16:42:15 +0000
commit2f18f7f73da0d4592135ce383be9156bca8acb5f (patch)
treedc30946bb598da8741fd042f24e61057e1ceee45
parent612186c6dd6549bfd3a44ba61181ce1b6ac49733 (diff)
downloadingen-2f18f7f73da0d4592135ce383be9156bca8acb5f.tar.gz
ingen-2f18f7f73da0d4592135ce383be9156bca8acb5f.tar.bz2
ingen-2f18f7f73da0d4592135ce383be9156bca8acb5f.zip
Tidy up draw dialog code.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5343 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/gui/GraphBox.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index 99debec3..913bcc52 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -592,28 +592,24 @@ GraphBox::event_draw()
Gtk::Button* save_button = dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
save_button->property_has_default() = true;
- int result = dialog.run();
-
- if (result == Gtk::RESPONSE_OK) {
+ if (dialog.run() == Gtk::RESPONSE_OK) {
std::string filename = dialog.get_filename();
if (filename.find(".") == std::string::npos)
filename += ".dot";
- bool confirm = true;
if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) {
- int ret = message_dialog(
+ const int ret = message_dialog(
(boost::format("File exists! Overwrite %1%?") % filename).str(),
"", Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO);
- confirm = (ret == Gtk::RESPONSE_YES);
+ if (ret != Gtk::RESPONSE_YES) {
+ return;
+ }
}
- if (confirm) {
- _view->canvas()->export_dot(filename.c_str());
- _status_bar->push(
- (boost::format("Rendered %1% to %2%")
- % _graph->path() % filename).str(),
- STATUS_CONTEXT_GRAPH);
- }
+ _view->canvas()->export_dot(filename.c_str());
+ _status_bar->push((boost::format("Rendered %1% to %2%")
+ % _graph->path() % filename).str(),
+ STATUS_CONTEXT_GRAPH);
}
}