summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorerg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-20 23:18:35 +0000
committererg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-20 23:18:35 +0000
commit11e01e6bcf5165c93d1c2d50cb5c80159cecf2e5 (patch)
tree18e8b5c41ebe88b7fae0fd04767ac1825232f476 /chrome/browser
parentd2fcb931494b3b39b70f87986e3cc86041835691 (diff)
downloadchromium_src-11e01e6bcf5165c93d1c2d50cb5c80159cecf2e5.zip
chromium_src-11e01e6bcf5165c93d1c2d50cb5c80159cecf2e5.tar.gz
chromium_src-11e01e6bcf5165c93d1c2d50cb5c80159cecf2e5.tar.bz2
GTK: Fix the sensitivity of the "end process" button.
When no task is selected, the end process button shouldn't be enabled. When an entry is removed, we should check to see if we removed the currently selected item. BUG=40836 TEST=none Review URL: http://codereview.chromium.org/1723002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45110 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/gtk/task_manager_gtk.cc33
1 files changed, 20 insertions, 13 deletions
diff --git a/chrome/browser/gtk/task_manager_gtk.cc b/chrome/browser/gtk/task_manager_gtk.cc
index af8010a..20840f3 100644
--- a/chrome/browser/gtk/task_manager_gtk.cc
+++ b/chrome/browser/gtk/task_manager_gtk.cc
@@ -341,18 +341,25 @@ void TaskManagerGtk::OnItemsAdded(int start, int length) {
}
void TaskManagerGtk::OnItemsRemoved(int start, int length) {
- AutoReset autoreset(&ignore_selection_changed_, true);
+ {
+ AutoReset autoreset(&ignore_selection_changed_, true);
- GtkTreeIter iter;
- gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(process_list_), &iter,
- NULL, start);
+ GtkTreeIter iter;
+ gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(process_list_), &iter,
+ NULL, start);
- for (int i = 0; i < length; i++) {
- // |iter| is moved to the next valid node when the current node is removed.
- gtk_list_store_remove(process_list_, &iter);
+ for (int i = 0; i < length; i++) {
+ // |iter| is moved to the next valid node when the current node is
+ // removed.
+ gtk_list_store_remove(process_list_, &iter);
+ }
+
+ process_count_ -= length;
}
- process_count_ -= length;
+ // It is possible that we have removed the current selection; run selection
+ // changed to detect that case.
+ OnSelectionChanged(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview_)));
}
////////////////////////////////////////////////////////////////////////////////
@@ -384,11 +391,6 @@ void TaskManagerGtk::Init() {
// metacity.
gtk_window_set_type_hint(GTK_WINDOW(dialog_), GDK_WINDOW_TYPE_HINT_NORMAL);
- // The response button should not be sensitive when the dialog is first opened
- // because the selection is initially empty.
- gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog_),
- kTaskManagerResponseKill, FALSE);
-
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kPurgeMemoryButton)) {
gtk_dialog_add_button(GTK_DIALOG(dialog_),
@@ -400,6 +402,11 @@ void TaskManagerGtk::Init() {
l10n_util::GetStringUTF8(IDS_TASK_MANAGER_KILL).c_str(),
kTaskManagerResponseKill);
+ // The response button should not be sensitive when the dialog is first opened
+ // because the selection is initially empty.
+ gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog_),
+ kTaskManagerResponseKill, FALSE);
+
GtkWidget* link = gtk_chrome_link_button_new(
l10n_util::GetStringUTF8(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK).c_str());
gtk_dialog_add_action_widget(GTK_DIALOG(dialog_), link,