- More extensible exception checking in text_simulation

- Started doing initialization of glade dialogs in a lazy manner

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@964 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-08-30 15:31:25 +00:00
parent 9d541e2751
commit 58838fabbc
2 changed files with 22 additions and 7 deletions

View File

@ -53,7 +53,6 @@ SchedulablesTreeWidget::CellRendererTextMarkup::_property_renderable()
} }
SchedulablesTreeWidget::SchedulablesTreeWidget() : SchedulablesTreeWidget::SchedulablesTreeWidget() :
_add_process_dialog_glade(Xml::create(GLADEDIR "/add-process-dialog.glade")),
_add_thread_dialog_glade(Xml::create(GLADEDIR "/add-thread-dialog.glade")), _add_thread_dialog_glade(Xml::create(GLADEDIR "/add-thread-dialog.glade")),
_add_request_dialog_glade(Xml::create(GLADEDIR "/add-request-dialog.glade")) _add_request_dialog_glade(Xml::create(GLADEDIR "/add-request-dialog.glade"))
@ -70,7 +69,6 @@ SchedulablesTreeWidget::SchedulablesTreeWidget() :
tvc->set_cell_data_func(_cell_renderer, sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_cell_name_data)); tvc->set_cell_data_func(_cell_renderer, sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_cell_name_data));
/** DIALOGS **/ /** DIALOGS **/
_add_process_dialog_glade->get_widget("AddProcessDialog", _add_process_dialog);
_add_thread_dialog_glade->get_widget("AddThreadDialog", _add_thread_dialog); _add_thread_dialog_glade->get_widget("AddThreadDialog", _add_thread_dialog);
// NOTE This is *not* reflective programming! AddRequestDialog is the name of // NOTE This is *not* reflective programming! AddRequestDialog is the name of
// the base widget in the glade file. // the base widget in the glade file.
@ -369,14 +367,19 @@ SchedulablesTreeWidget::add_edit_process(bool adding)
{ {
/** This is ugly, I know, we should be using derived widgets, but I also believe we /** This is ugly, I know, we should be using derived widgets, but I also believe we
* have little time, and I'm not going to waste too much of it on the frontend */ * have little time, and I'm not going to waste too much of it on the frontend */
RefPtr<Xml> glade(Xml::create(GLADEDIR "/add-process-dialog.glade"));
Dialog* add_process_dialog;
glade->get_widget("AddProcessDialog", add_process_dialog);
Entry* name_entry; Entry* name_entry;
SpinButton* arrival_time_spin; SpinButton* arrival_time_spin;
SpinButton* base_priority_spin; SpinButton* base_priority_spin;
_add_process_dialog_glade->get_widget("Name.Entry", name_entry); glade->get_widget("Name.Entry", name_entry);
_add_process_dialog_glade->get_widget("ArrivalTime.Spin", arrival_time_spin); glade->get_widget("ArrivalTime.Spin", arrival_time_spin);
_add_process_dialog_glade->get_widget("BasePriority.Spin", base_priority_spin); glade->get_widget("BasePriority.Spin", base_priority_spin);
Process* selection = NULL; Process* selection = NULL;
@ -396,7 +399,7 @@ SchedulablesTreeWidget::add_edit_process(bool adding)
} }
if(_add_process_dialog->run() == RESPONSE_OK) if(add_process_dialog->run() == RESPONSE_OK)
{ {
if(adding) if(adding)
@ -414,7 +417,7 @@ SchedulablesTreeWidget::add_edit_process(bool adding)
} }
} }
_add_process_dialog->hide(); add_process_dialog->hide();
} }
void void

View File

@ -400,6 +400,12 @@ TextSimulation::on_run(const Tokens& arguments)
p_stderr(e.what()); p_stderr(e.what());
p_stderr(_("\nSimulation is now stopped\n")); p_stderr(_("\nSimulation is now stopped\n"));
} }
catch (const CPUPolicyException& e)
{
p_stderr(_("UNKNOWN ERROR: "));
p_stderr(e.what());
p_stderr("\n");
}
Simulation::get_instance().detach(*this); Simulation::get_instance().detach(*this);
} }
@ -482,6 +488,12 @@ TextSimulation::on_jumpto(const Tokens& arguments)
p_stderr(e.what()); p_stderr(e.what());
p_stderr(_("\nSimulation is now stopped\n")); p_stderr(_("\nSimulation is now stopped\n"));
} }
catch (const CPUPolicyException& e)
{
p_stderr(_("UNKNOWN ERROR: "));
p_stderr(e.what());
p_stderr("\n");
}
Simulation::get_instance().detach(*this); Simulation::get_instance().detach(*this);
} }