From d8694b2f5b3a2f69c563d03726678e0e8d0f1a66 Mon Sep 17 00:00:00 2001 From: elvez Date: Fri, 18 Aug 2006 00:27:33 +0000 Subject: [PATCH] - Removed "visible" flag from popup dialogs - Laid out widget code for request adding. That`s not a trivial dialog like the previous... git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@900 3ecf2c5c-341e-0410-92b4-d18e462d057c --- glade/add-process-dialog.glade | 1 - glade/add-request-dialog.glade | 1 - glade/add-resource-dialog.glade | 1 - glade/add-thread-dialog.glade | 1 - glade/configure-cpu-policy-dialog.glade | 1 - glade/configure-dialog.glade | 1 - src/schedulables_tree_widget.cc | 36 +++++++++++++++++++++---- src/schedulables_tree_widget.hh | 3 +++ 8 files changed, 34 insertions(+), 11 deletions(-) diff --git a/glade/add-process-dialog.glade b/glade/add-process-dialog.glade index f699959..9a696d6 100644 --- a/glade/add-process-dialog.glade +++ b/glade/add-process-dialog.glade @@ -4,7 +4,6 @@ - True Add Process GTK_WINDOW_TOPLEVEL GTK_WIN_POS_MOUSE diff --git a/glade/add-request-dialog.glade b/glade/add-request-dialog.glade index f1373b2..79a8652 100644 --- a/glade/add-request-dialog.glade +++ b/glade/add-request-dialog.glade @@ -5,7 +5,6 @@ 0 - True Add Request GTK_WINDOW_TOPLEVEL GTK_WIN_POS_MOUSE diff --git a/glade/add-resource-dialog.glade b/glade/add-resource-dialog.glade index e39612c..d7b1be1 100644 --- a/glade/add-resource-dialog.glade +++ b/glade/add-resource-dialog.glade @@ -4,7 +4,6 @@ - True Add Resource GTK_WINDOW_TOPLEVEL GTK_WIN_POS_MOUSE diff --git a/glade/add-thread-dialog.glade b/glade/add-thread-dialog.glade index 7ce1313..b5d5fe3 100644 --- a/glade/add-thread-dialog.glade +++ b/glade/add-thread-dialog.glade @@ -4,7 +4,6 @@ - True Add Thread GTK_WINDOW_TOPLEVEL GTK_WIN_POS_MOUSE diff --git a/glade/configure-cpu-policy-dialog.glade b/glade/configure-cpu-policy-dialog.glade index 3500e13..4c26e07 100644 --- a/glade/configure-cpu-policy-dialog.glade +++ b/glade/configure-cpu-policy-dialog.glade @@ -5,7 +5,6 @@ 0 - True Configure the CPU Policy GTK_WINDOW_TOPLEVEL GTK_WIN_POS_MOUSE diff --git a/glade/configure-dialog.glade b/glade/configure-dialog.glade index 2c2145f..5d4a7bd 100644 --- a/glade/configure-dialog.glade +++ b/glade/configure-dialog.glade @@ -5,7 +5,6 @@ 0 - True SGPEMv2 Preferences GTK_WINDOW_TOPLEVEL GTK_WIN_POS_CENTER_ON_PARENT diff --git a/src/schedulables_tree_widget.cc b/src/schedulables_tree_widget.cc index 0aef4c5..6ce7e10 100644 --- a/src/schedulables_tree_widget.cc +++ b/src/schedulables_tree_widget.cc @@ -41,7 +41,8 @@ using Gnome::Glade::Xml; 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")) { _columns.add(_main_column); @@ -66,6 +67,9 @@ SchedulablesTreeWidget::SchedulablesTreeWidget() : _action_group->add( Gtk::Action::create("AddThread", "Add Thread"), sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_add_thread) ); + _action_group->add( Gtk::Action::create("AddRequest", "Add Request"), + sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_add_request) ); + _UIManager = Gtk::UIManager::create(); _UIManager->insert_action_group(_action_group); @@ -74,6 +78,7 @@ SchedulablesTreeWidget::SchedulablesTreeWidget() : " " " " " " + " " " " ""; @@ -83,10 +88,8 @@ SchedulablesTreeWidget::SchedulablesTreeWidget() : /** DIALOGS **/ _add_process_dialog_glade->get_widget("AddProcessDialog", _add_process_dialog); _add_thread_dialog_glade->get_widget("AddThreadDialog", _add_thread_dialog); - //FIXME why do I need to call this? Is it reasonable? - _add_process_dialog->hide(); - _add_thread_dialog->hide(); - + _add_request_dialog_glade->get_widget("AddRequestDialog", _add_request_dialog); + set_headers_visible(false); Simulation::get_instance().get_history().attach(*this); @@ -235,3 +238,26 @@ SchedulablesTreeWidget::_on_add_thread() _add_thread_dialog->hide(); } + +void +SchedulablesTreeWidget::_on_add_request() +{ + TreeModel::iterator sel = get_selection()->get_selected(); + + if(!sel) + return; + + const void* p_handle = (*sel)[_handles_column]; + HandleType type = (*sel)[_types_column]; + Thread* t = reinterpret_cast(const_cast(p_handle)); + + if(t == NULL || type != htype_thread) + return; + + if(_add_request_dialog->run() == RESPONSE_OK) + { + //FIXME writre code for me :-) + } + + _add_request_dialog->hide(); +} diff --git a/src/schedulables_tree_widget.hh b/src/schedulables_tree_widget.hh index dfcf4e9..2dc8c2a 100644 --- a/src/schedulables_tree_widget.hh +++ b/src/schedulables_tree_widget.hh @@ -61,6 +61,7 @@ namespace sgpem void _on_add_process(); void _on_add_thread(); + void _on_add_request(); Glib::RefPtr _model; Gtk::TreeModelColumnRecord _columns; @@ -72,8 +73,10 @@ namespace sgpem Gtk::Menu* _menu; Glib::RefPtr _add_process_dialog_glade; Glib::RefPtr _add_thread_dialog_glade; + Glib::RefPtr _add_request_dialog_glade; Gtk::Dialog* _add_process_dialog; Gtk::Dialog* _add_thread_dialog; + Gtk::Dialog* _add_request_dialog; }; } //~ namespace sgpem