From b35632fd3d2547414c80023c5c60c847e3dc92ea Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Thu, 10 Dec 2009 15:11:08 +0100 Subject: grapher: more implementation stap process window The process arguments are displayed, and the "kill" button is insensitive when a process is dead or nothing is selected. * grapher/grapher.cxx (ProcWindow _killButton, _restartButton, _stapArgsLabel, _scriptArgsLabel): new members (ProcWindow::ProcWindow): hook 'em up (ProcWindow::onSelectionChanged): Enable / disable kill button and display process arguments. * grapher/processwindow.glade: Replace bizzare handle window with a horizontal pane. Tweak various widget sizes. --- grapher/grapher.cxx | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'grapher/grapher.cxx') diff --git a/grapher/grapher.cxx b/grapher/grapher.cxx index 8e7a4dba..e3d5289a 100644 --- a/grapher/grapher.cxx +++ b/grapher/grapher.cxx @@ -335,6 +335,10 @@ public: Glib::RefPtr _xml; Gtk::Window* _window; Gtk::TreeView* _dataTreeView; + Gtk::Button* _killButton; + Gtk::Button* _restartButton; + Gtk::Label* _stapArgsLabel; + Gtk::Label* _scriptArgsLabel; Glib::RefPtr _listStore; Glib::RefPtr _listSelection; void onClose(); @@ -376,15 +380,19 @@ ProcWindow::ProcWindow() _xml->get_widget("button5", button); button->signal_clicked().connect(sigc::mem_fun(*this, &ProcWindow::onClose), false); - _xml->get_widget("button1", button); - button->signal_clicked().connect(sigc::mem_fun(*this, &ProcWindow::onKill), - false); + _xml->get_widget("button1", _killButton); + _killButton->signal_clicked() + .connect(sigc::mem_fun(*this, &ProcWindow::onKill), false); + _killButton->set_sensitive(false); + _xml->get_widget("button2", _restartButton); + _restartButton->set_sensitive(false); parserListChangedSignal() .connect(sigc::mem_fun(*this, &ProcWindow::onParserListChanged)); _listSelection = _dataTreeView->get_selection(); _listSelection->signal_changed() .connect(sigc::mem_fun(*this, &ProcWindow::onSelectionChanged)); - + _xml->get_widget("label7", _stapArgsLabel); + _xml->get_widget("label8", _scriptArgsLabel); } void ProcWindow::onClose() @@ -436,6 +444,28 @@ void ProcWindow::onParserListChanged() void ProcWindow::onSelectionChanged() { + Gtk::TreeModel::iterator itr = _listSelection->get_selected(); + shared_ptr proc; + if (itr) + { + Gtk::TreeModel::Row row = *itr; + proc = row[_modelColumns._proc]; + } + if (proc) + { + if (proc->pid >= 0) + _killButton->set_sensitive(true); + else + _killButton->set_sensitive(false); + _stapArgsLabel->set_text(proc->stapArgs); + _scriptArgsLabel->set_text(proc->scriptArgs); + } + else + { + _killButton->set_sensitive(false); + _stapArgsLabel->set_text(""); + _scriptArgsLabel->set_text(""); + } } void ProcWindow::onKill() -- cgit