diff --git a/plugins/pyloader/Makefile.am b/plugins/pyloader/Makefile.am
index 46fa224..ab4e79c 100644
--- a/plugins/pyloader/Makefile.am
+++ b/plugins/pyloader/Makefile.am
@@ -84,7 +84,6 @@ libpyloader_la_LIBADD = \
libpyloader_la_LDFLAGS = \
$(PYTHON_LDFLAGS) \
$(PYTHON_EXTRA_LDFLAGS) \
- $(LT_LDFLAGS) \
-version-info 0:0:0 \
-module
diff --git a/src/gui_builder.cc b/src/gui_builder.cc
index cf3a1cd..d2c9d35 100644
--- a/src/gui_builder.cc
+++ b/src/gui_builder.cc
@@ -144,16 +144,8 @@ GuiBuilder::on_file_new_activate()
{
Simulation& sim = Simulation::get_instance();
History& history = sim.get_history();
- const Environment& env = history.get_environment_at(0);
- if(!(_filename.empty() && env.get_processes().empty() && env.get_resources().empty()))
- {
- Gtk::MessageDialog want_to_save(get_initial_window(),
- _("Want to save?\nYou'll lose your changes if you don't."),
- true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true);
- if(want_to_save.run() == Gtk::RESPONSE_YES)
- on_file_save_activate();
- }
+ ask_save();
sim.stop();
history.clear();
@@ -165,6 +157,8 @@ GuiBuilder::on_file_new_activate()
void
GuiBuilder::on_file_open_activate()
{
+ ask_save();
+
Glib::ustring msg;
try
{
@@ -531,6 +525,24 @@ GuiBuilder::on_toggle_simulation_mode()
}
+void
+GuiBuilder::ask_save()
+{
+ History& history = Simulation::get_instance().get_history();
+ const Environment& env = history.get_environment_at(0);
+
+ if(!(_filename.empty() && env.get_processes().empty() && env.get_resources().empty()))
+ {
+ Gtk::MessageDialog want_to_save(get_initial_window(),
+ _("Want to save?\nYou'll lose your changes if you don't."),
+ true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true);
+ want_to_save.set_default_response(Gtk::RESPONSE_YES);
+ if(want_to_save.run() == Gtk::RESPONSE_YES)
+ on_file_save_activate();
+ }
+}
+
+
GuiBuilder::GuiBuilder(const std::string& gladefile)
: _refXml(Xml::create(gladefile)), _controller(Simulation::get_instance(), _refXml),
_holt_container(Simulation::get_instance()),
@@ -538,6 +550,9 @@ GuiBuilder::GuiBuilder(const std::string& gladefile)
{
using namespace Gtk;
+ Window& main_window = get_initial_window();
+ main_window.signal_delete_event().connect(sigc::bind_return(sigc::hide(sigc::mem_fun(*this, &GuiBuilder::ask_save)), false));
+
// ---------------- Menu items ------------------
// Note: the Play, Pause and Stop menu items are already managed by sgpem::SimulationController.
@@ -564,6 +579,7 @@ GuiBuilder::GuiBuilder(const std::string& gladefile)
MenuItem* file_quit = NULL;
_refXml->get_widget("MenuItem.File.Quit", file_quit);
+ file_quit->signal_activate().connect(sigc::mem_fun(*this, &GuiBuilder::ask_save));
file_quit->signal_activate().connect(sigc::ptr_fun(&Main::quit));
// preferences dialog
@@ -670,7 +686,6 @@ GuiBuilder::GuiBuilder(const std::string& gladefile)
simulation_jump_to->signal_clicked().connect(sigc::mem_fun(*this, &GuiBuilder::on_simulation_jump_to_clicked));
- Window& main_window = get_initial_window();
// HoltGraph container window
_holt_container.set_transient_for(main_window);
_holt_container.get_holt_widget().set_show_threads(_show_threads);
diff --git a/src/gui_builder.hh b/src/gui_builder.hh
index baa288d..6bfc282 100644
--- a/src/gui_builder.hh
+++ b/src/gui_builder.hh
@@ -62,7 +62,7 @@ namespace sgpem
void on_view_show_threads_activate();
void on_view_show_holt_graph_activate();
- void on_view_show_statistics_activate();
+ void on_view_show_statistics_activate();
void on_configure_cpu_policy();
void on_configure_resource_policy();
@@ -86,6 +86,8 @@ namespace sgpem
StatisticsContainerWindow _statistics_container;
SimulationWidget* _simulation_widget;
bool _show_threads;
+
+ void ask_save();
};
} //~ namespace sgpem