summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/task_manager_gtk.cc
diff options
context:
space:
mode:
authormdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-02 21:54:24 +0000
committermdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-02 21:54:24 +0000
commitd3e3e9d88047d6cf4754edc75286bedee9182781 (patch)
tree2ce2ec332e99b2ea01236c94b723733ebaa7f628 /chrome/browser/gtk/task_manager_gtk.cc
parent6655e481d1af6acf30538050af3ffc6df0d8d577 (diff)
downloadchromium_src-d3e3e9d88047d6cf4754edc75286bedee9182781.zip
chromium_src-d3e3e9d88047d6cf4754edc75286bedee9182781.tar.gz
chromium_src-d3e3e9d88047d6cf4754edc75286bedee9182781.tar.bz2
Linux: make the columns in the task manager avoid causing scroll bars.
BUG=17930 TEST=open the task manager and load some pages; the network column shouldn't force a horizontal scrollbar Review URL: http://codereview.chromium.org/186001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25245 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/task_manager_gtk.cc')
-rw-r--r--chrome/browser/gtk/task_manager_gtk.cc29
1 files changed, 23 insertions, 6 deletions
diff --git a/chrome/browser/gtk/task_manager_gtk.cc b/chrome/browser/gtk/task_manager_gtk.cc
index 535872d..f7f9906 100644
--- a/chrome/browser/gtk/task_manager_gtk.cc
+++ b/chrome/browser/gtk/task_manager_gtk.cc
@@ -632,15 +632,32 @@ void TaskManagerGtk::OnResponse(GtkDialog* dialog, gint response_id,
// static
void TaskManagerGtk::OnTreeViewRealize(GtkTreeView* treeview,
TaskManagerGtk* task_manager) {
- GtkTreeViewColumn* column = gtk_tree_view_get_column(
- GTK_TREE_VIEW(task_manager->treeview_),
+ // Four columns show by default: the page column, the memory column, the
+ // CPU column, and the network column. Initially we set the page column to
+ // take all the extra space, with the other columns being sized to fit the
+ // column names. Here we turn off the expand property of the first column
+ // (to make the table behave sanely when the user resizes columns) and set
+ // the effective sizes of all four default columns to the automatically
+ // chosen size before any rows are added. This causes them to stay at that
+ // size even if the data would overflow, preventing a horizontal scroll
+ // bar from appearing due to the row data.
+ const TaskManagerColumn dfl_columns[] = {kTaskManagerNetwork, kTaskManagerCPU,
+ kTaskManagerPhysicalMem};
+ GtkTreeViewColumn* column = NULL;
+ gint width;
+ for (size_t i = 0; i < arraysize(dfl_columns); ++i) {
+ column = gtk_tree_view_get_column(treeview,
+ TreeViewColumnIndexFromID(dfl_columns[i]));
+ width = gtk_tree_view_column_get_width(column);
+ TreeViewColumnSetWidth(column, width);
+ }
+ // Do the page column separately since it's a little different.
+ column = gtk_tree_view_get_column(treeview,
TreeViewColumnIndexFromID(kTaskManagerPage));
- gint width = gtk_tree_view_column_get_width(column);
+ width = gtk_tree_view_column_get_width(column);
// Turn expanding back off to make resizing columns behave sanely.
gtk_tree_view_column_set_expand(column, FALSE);
- // Subtract 1 to work around some sort of fencepost error in GTK: without
- // it, a horizontal scroll bar with one pixel of wiggle room will appear.
- TreeViewColumnSetWidth(column, width - 1);
+ TreeViewColumnSetWidth(column, width);
}
// static